[PD] length in midifile

Martin Peach martin.peach at sympatico.ca
Mon Apr 26 06:55:50 CEST 2010

PF wrote:
> i'm no expert in midi, but i want to send midi notes (and durations)
> from a .mid file to a synth of mine.
> i see the midifile help has a bunch of stuff for noteOn and noteOff
> events, but it's confusing to me. if anyone can clarify a bit i'd
> really appreciate that.

[midifile] outputs lists made up of midi messages, the first item in the
list is always a status byte, a number between 128 and 255.
So something like:

[route 144]

will route note-ons on channel 1 to the midi output device, because the
status byte for note on is 144.

[route 144]
[unpack 0 0]
|         |

will give you the note number and velocity.
This works if the file is a single track. For multi-track you might also 
  want to select a track with the [track n( message.
Usually the duration of a note is determined when the note-off message 
is sent. There is a status 128 for note-off but usually note-on with 
velocity 0 is used instead.

If there are controllers in the file you can add a [route 176] and send 
them to [ctlout].


More information about the Pd-list mailing list