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 .....
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 .....
I think you are supposed to use the alsa-lib rawmidi funtions, e.g. git.alsa-project.org Git - alsa-lib.git/blob - test/rawmidi.c
In ruby e.g. GitHub - arirusso/alsa-rawmidi: Realtime MIDI IO with Ruby for Linux ?
In ruby e.g. GitHub - arirusso/alsa-rawmidi: Realtime MIDI IO with Ruby for Linux ?
Thank You,
If it takes that much complication I'll forget it.
It is so simple in Windows with Basic........
If it takes that much complication I'll forget it.
It is so simple in Windows with Basic........
Not to me .....Well, using that ready-made ruby library seems pretty simple to me...
It seems to me this should work:
f=File.open"/dev/snd/midiC1D0","w"
f.write "90 3C 7F"
f.write "B0 7B 0"
end
But then I'm old and old fashioned 🙂
Maybe I'll try DosBox
Hm, I do not see much difference from the output.rb example:
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.
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.
Did you actually look at that github readme?
I assume you are a ruby programmer if you asked specifically about ruby. I am not.
I assume you are a ruby programmer if you asked specifically about ruby. I am not.
I looked but it's beyond me.Did you actually look at that github readme?
I assume you are a ruby programmer if you asked specifically about ruby. I am not.
I only mentioned Ruby because I use Sonic-Pi which uses it.
BASIC is the only language I'm at all familiar with.
Well, I am afraid you will have to learn another language if you want to play with alsa on linux RPi. E.g. python is pretty simple to start with and of course there is a python-midi library GitHub - vishnubob/python-midi: Python MIDI library. Or ruby, java, etc.
- Status
- Not open for further replies.
- Home
- Source & Line
- PC Based
- Raw midi to Timidity on RPi