program change always selects gunshot sound
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ttyMIDI |
Invalid
|
Undecided
|
Unassigned |
Bug Description
I have an external midi sound module at /dev/ttyACM0 and use ttymidi
to play midi files. Currently this does not work well: a program change
is always doubled with a second program change with parameter 127.
As a result all midi files sound like a shooting game.
ttymidi -v -s /dev/ttyACM0 &
aplaymidi -p 128:1 rhapsody.mid
Debug output: (Looped MIDI_OUT to MIDI_IN)
Alsa 0xc0 Program change 001 001 4294967295
Serial 0xc0 Program change 000 001
Serial 0xc0 Program change 000 127
While searching for the bug I stumbled over two bugs in
write_midi_
but could not find the reason for the problem above.
case SND_SEQ_
bytes[0] = 0x90 + ev->data.
// should be 0xA0 not 0x90
bytes[0] = bytes[1] = 0; bytes[2] = 0xFF;
// initialisation should be inside do-loop
I've also tried hairless-midiserial which works,
but I would prefer a command line tool.
Hi!
It worked for me, so you have to change code in this way:
case SND_SEQ_ EVENT_PGMCHANGE :
bytes[ 0] = 0xC0 + ev->data. control. channel;
bytes[ 1] = ev->data. control. param;
bytes[ 2] = ev->data. control. value;
if (!arguments.silent && arguments.verbose)
printf( "Alsa 0x%x Program change >> %03u %03u %03u\n", bytes[0]&0xF0, bytes[0]&0xF, bytes[1],bytes[2]);
break;
Regards
Kecajtop