Skip to content

Instantly share code, notes, and snippets.

@Langerz82
Last active August 11, 2024 06:18
Show Gist options
  • Save Langerz82/ff5bf3b9893aebf809032c088cba2e40 to your computer and use it in GitHub Desktop.
Save Langerz82/ff5bf3b9893aebf809032c088cba2e40 to your computer and use it in GitHub Desktop.
EmuELEC - Midi Template for Kelv
#!/bin/bash
RA_CFG=/storage/.config/retroarch/retroarch.cfg
set_midi_source()
{
local midi_source=$1
pkill -9 timidity
pkill -9 mt32d
pkill -9 fluidsynth
local MIDI_OUTPUT=OFF
case $midi_source in
fluidsynth)
fluidsynth -is /storage/roms/bios/sc/SC-55.sf2
MIDI_OUTPUT=$(cat /proc/asound/seq/clients | grep "Port 0 : \"S") | cut -d'"' -f2)
;;
timidity)
timidity -iA --module 1 &
MIDI_OUTPUT=TiMidity port 0
mt32d)
mt32d -o 1 -i 24 -f /roms/bios &
MIDI_OUTPUT=Standard
esac
sed -ie "s|midi_output *= *\".*\"|midi_output = \"${MIDI_OUTPUT}\"|" ${RA_CFG}
}
# Example
set_midi_source timidity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment