Context and experiments
I have a virtual MIDI device, as card #1, named VirMIDI. There are associated ALSA sequencer clients (not raw MIDI), as Virtual Raw MIDI 1-0 to Virtual Raw MIDI 1-3. There are device nodes /dev/snd/midiC1D0 to /dev/snd/midiC1D3.
A software MIDI keyboard is connected to Virtual Raw MIDI 1-0 and a sound‑font synthesizer is connect to hw:VirMIDI,0.
When I play the software keyboard, there are sounds (just to check it's OK).
I can cat the device node: if I do cat /dev/snd/midiC1D0 >data.bin and play the software keyboard, the file data.bin is filled with raw MIDI events and the synthesizer play sounds (both it and cat receives the events).
However, if I later do cat data.bin >/dev/snd/midiC1D0 nothing occurs: no errors and also no sounds, the synthesizer receives no MIDI events.
It looks like it works with read access only, although writing does not trigger an error and just seems to do nothing.
If ever this matters, although not an access to the device node proper, amidi -p hw:1,0 -s data.bin does nothing neither, while amidi -p hw:1,0 -r data.bin behaves as expected.
Question
How to write to a MIDI device node like /dev/snd/midiCnDn, with expected effects, the same way one can read from the same MIDI device node? Or is it to be used for reading only?