Raw midi to Timidity on RPi

Status
Not open for further replies.
I have Timidity on RPi 3 B
I would like to send raw midi from Ruby
to Timidity.
I.E. 2 or 3 byte midi-messages
I have had success using 'system'
calls to Alsa🙁 c note on-off )

system"amidi -p hw:1,0 -S'90 3C 7F'"
system"amidi -p hw:1,0 -S'B0 7B 0'"

But for some reason the amidi is very (too) slow.
The Timidity sheet mentions an address of:

/dev/snd/midiC1D0

I've been trying :

f=File.open"/dev/snd/midiC1D0","w"
f.write "90 3C 7F"
f.write "B0 7B 0"
end

But no sound 🙁
Any insights greatly appreciated .....
 
Hm, I do not see much difference from the output.rb example:

Code:
AlsaRawMIDI::Output.first.open do |output|
...
        output.puts(0x90, note + oct, 100) # note on
        sleep(duration)				     # wait
        output.puts(0x80, note + oct, 100) # note off
        sleep(duration)
...

In alsa the device files perform many functions, that is why you cannot just copy data to them (unlike e.g. the /dev/dsp files of OSS). You have to use appropriate fnctl system calls. That is what the alsa-lib does in snd_rawmidi_open and snd_rawmidi_write API calls and those that alsa-ruby library wraps to provide simple access in ruby.

But do whatever you wish, your fight.
 
Status
Not open for further replies.