[PD] Getting Sysex output to work on Linux

Martin Peach martin.peach at sympatico.ca
Tue May 27 05:33:11 CEST 2008


PSPunch wrote:
> Martin,
> 
> 
>> I'm looking at the source code in svn, assuming you use [midiout] to 
>> send sysex.
>> The midiout object has one method, for floats : midiout_float(), in 
>> x_midi.c, line 681.
>> It just calls outmidi_byte() in s_midi.c, line 239. If Pd was compiled 
>> with USEAPI_ALSA defined, then outmidi_byte calls sys_alsa_putmidibyte() 
>> in s_midi_alsa.c line 234, otherwise it calls sys_putmidibyte() in 
>> s_midi_oss.c line 182.
> 
> Do you mean that theoretically, Pd + ALSA MIDI should be working?
> hmmm...

Well it looks like it should but I just tried with a scope on the cable 
and got messages using [noteout] but nothing using [midiout] with alsa 
midi and jack. I tried sending bytes singly and in comma-separated 
messages as well as just lists. Nothing comes out.

> 
> 
> According to IOhannes,
> 
>> the problem is rather, that ALSA sequencer does not support MIDI in a
>> way Pd would like it, mainly: no raw midi.
> 

Yes, it looks like the ALSA function  being called expects a complete 
sysex message but instead it's getting one byte at a time. I guess Pd 
should buffer the message until it gets an F7 (End of Exclusive) and 
then send the whole thing as one packet. Not too difficult except for 
anticipating what the the maximum message size is going to be. Maybe a 
[sysexout] object that takes lists of bytes (and inserts the F0 and F7) 
is in order...

> 
> Also I think one of the recent posts which I cannot locate now,
> mentioned that it was just a matter of Pd using a function in ALSA API
> other than what is used at the moment.
>

Well I think it's better to send a complete sysex packet, otherwise it 
could be trashed by a noteout or similar that occurs before the F7 goes 
out. Really Pd should buffer the packet and only then send it to ALSA.

Martin




More information about the Pd-list mailing list