Raw Midi to Timidity

Discussion of all things Raspberry Pi / Raspberry Pi 2 related

Moderators: MattKingUSA, khz

Post Reply
hitsware
Established Member
Posts: 15
Joined: Thu Jul 26, 2012 2:46 pm

Raw Midi to Timidity

Post by hitsware »

I want to send raw midi to Timidity from scripts written in Basic.
I have gotten as far as being able to get sound with (from the terminal) amidi -p HW:1,0 -S'midimsg'
From Basic I can do:
SYSTEM " amidi -p HW:1,0 -S'midimsg' "
and get sound............... BUT
I need an address I can send bytes to the way the Windows software synth works
I.E... midimessage byte1 byte2 byte3
Perhaps something like:
OPEN " /dev/snd/C1D0 "
DO
WRITEBYTE( midibyte )
I think I just need the right /dev/????
and the right aconnect numbers ????
Any help greatly appreciated ..............
hitsware
Established Member
Posts: 15
Joined: Thu Jul 26, 2012 2:46 pm

Re: Raw Midi to Timidity

Post by hitsware »

##################### MIDIPI #######################
# Got It ! ......... Using Sonic Pi
# Assumes Timidity installed
# Works on RPi .... Maybe other LinuxMachines ?
# In terminal type 'timidity -iA'
# Leave terminal open

system"sudo modprobe snd-virmidi snd_index=0"#Alsa
system"aconnect 20:0 128:0" #Connect

scale=[48,50,52,53,55,57,59,60] #MidiScale

a=144.to_s(16) #Convert
c=127.to_s(16) #MidiData
d=0.to_s(16) #to hex

for i in 0..7 #PlayScale
b=scale.to_s(16)
system"amidi -p hw:1,0 -S'#{a}#{b}#{c}'"
system"amidi -p hw:1,0 -S'#{a}#{b}#{d}'"
sleep 1
end
Post Reply