Specifications

32 Using Pure Data
which takes a note-number and velocity, and a duration (in milliseconds) as its
third argument. After the duration has ex pired it auto matically adds a note-off.
If more than one physical MIDI por t is enabled then
noteout
sends channels 1 to
16 to port 1 and channels 17 to 32 to port 2 etc.
Continuous controllers
Two MIDI input/output objects are provided to receive and send continuous
controllers,
ctlin
and
ctlout
. Their three connections provide, or let you set, the
controller value, co ntroller number and MIDI channel. They can be instantia ted
with arguments, so
ctlin 10 1
picks up controller 10 (pan position) on MIDI
channel 1.
MIDI to Frequency
Two numerical c onversion utilities are provided to convert between MIDI note
numbers and Hz. To get from MIDI to Hz use
mtof
. To convert a frequency in
Hz to a MIDI note number use
ftom
.
Other MIDI objects
For pitchbend, program changes, system exclusive, aftertouch and other MIDI
functions you may use any of the objects summarised in Tbl. 3.23. System
exclusive messages may be sent by hand crafting raw MIDI bytes a nd outputting
via the
midiout
object. Most follow the inlet and outlet template of
notein
and
noteout
having a cha nnel as the last argument, except for
midiin
and
sysexin
which
receive omni (all channels) data.
MIDI in object MIDI out object
Object Function Object Function
notein
Get note data
noteout
Send note data.
bendin
Get pitchbend data
63 to +64
bendout
Send pitchbend data
64 to +64.
pgmin
Get program changes.
pgmout
Send program changes.
ctlin
Get continuous con-
troller messages.
ctlout
Send continuous con-
troller messages.
touchin
Get channel aftertouch
data.
touchout
Send channel after-
touch data.
polytouchin
Polyphonic touch data
in
polytouchout
Polyphonic touch out-
put
polytouchin
Send polyphonic after-
touch.
polytouchin
Get polyphonic af ter-
touch.
midiin
Get unformatted raw
MIDI
midiout
Send raw MIDI to de-
vice.
sysexin
Get system exclusive
data
No output
counterpart
Use
midiout
object
fig 3.23: List of MIDI objects