program change always selects gunshot sound

Bug #1153531 reported by Paddy Strebel on 2013-03-11
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ttyMIDI
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_action_to_serial_port()
but could not find the reason for the problem above.

case SND_SEQ_EVENT_KEYPRESS:
bytes[0] = 0x90 + ev->data.control.channel;

// 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.

kecajtop (kecajtop) wrote :

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

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers