Description of the MidiOutput class public functions
MidiOutput class public functions
MidiPerform
~MidiPerform
beat
getAmp
getMaxAmp
getTempoMethod
getTempo
channelCollapse
check
getBeatFraction
getBeatLocation
pause
play
read
rewind
setAmp
setMaxAmp
setBeatLocation
setTempoMethod
setTempo
Functions inherited from MidiOutPort
- Common MIDI Commands for playing synthesizers:
-
- play turn on/off a MIDI note.
- off send note off command.
- pc Patch Change: change the timbre on
a channel.
- cont send a continuous controller command.
- sustain send sustain on/off message.
- pw Pitch Wheel: change the pitch of notes
on a channel.
- send send a MIDI command to the MIDI
instrument from the computer.
- sustain turn sustain pedal on/off.
- Maintenance Commands:
-
- MidiOutput();
- Calls MidiOutPort().
- MidiOutput(int aPort, int openAuto = 1);
- Opens MIDI port aPort automatically if openAuto ==
1. If the port is already open, will not try to reopen it.
- void ~MidiOutput();
- Does nothing.
- void cont(int channel, int controller, int value);
- Sends the value for the MIDI continuous controller
command (0xb0) on the specified MIDI channel. Here is
a list of continuous controllers.
- channel: MIDI channel [0..15]
- controller: MIDI continuous controller number [0..127]
- value: MIDI data [0..127]
- void off(int channel);
- Sends a note off command using midi command 0x80 with the
specified key number and release velocity. Note that the most
common way of turning off a note is to send the note-on command
(0x90) with an attack velocity of 0 (see the play
function.
- channel: MIDI channel [0..15]
- keyno: MIDI key number [0..127] (middle C = 60)
- value: release velocity [0..127]
- void pc(int channel, int timbre);
- Sends a MIDI patch change which changes the timbre on
the specified channel. If you want to change
to a timbre greater than 127, then check how your synthesizer
does this. Usually, timbres are organized into banks, and
you specify first which bank with the
continuous controller #0.
- void play(int channel, int keyno, int velocity = 0);
- Sends a note on or note off on the specified channel. If
velocity parameter is missing, then a note off command
is sent.
- channel: MIDI channel [0..15]
- keyno: MIDI key number [0..127] (middle C = 60)
- value: attack velocity [0..127] (note off = 0)
- void pw(int channel, int mostByte, int leastByte);
void pw(int channel, int tuningData);
- Sends pitch wheel information on the specified MIDI channel.
For the three parameter version, the mostByte = coarse
tuning values 0..127 which are the most significant 7 bits of
a tuning value, and the fine tuning values (leastByte)
0..127 are the least significant 7 bits of a tuning value.
For the two parameter version, tuningData is a 14 bit number.
- void pw(int channel, double tuningData);
- Converts a number in the range from -1.0 to +1.0
into a 14 byte number which is sent out with the pitch wheel command.
- void recordStart(char* filename, int format = 0);
- Starts recording MIDI output to the file filename
according to the specified format which defaults to
ascii. MIDI output sent through the send command
are recorded, which output send through the rawsend
command are not recorded. If the file already exists, the
file will be overwritten. The defined formats are:
- 0 ascii format
- 1 binary format
- 2 Standard MIDI file format, type 0
Here is a description of the formats
for recording MIDI output.
- void recordStop(void);
- Stops recording MIDI output to the file specified with recordStart.
- void reset(void);
- sends the MIDI command 0xFF which
should force the MIDI devices on the other side of the
MIDI cable (which is connected to the port of the MidiOutput
object) into their power-on reset condition, clear running
status, turn off any sounding notes, set Local Control on, and
otherwise clean up the state of things.
- void send(int byte, int flush);
- Sends MIDI data from the computer to a synthesizer. If not
recording, then just calls rawsend . If recording,
bytes are stored in an output buffer until the buffer
is supposed to be flushed. Then the time since the previous
flush is calculated and recorded, as well as all the bytes
in the output buffer.
- byte: an 8-bit MIDI value to be sent out.
- flush: 0=store byte in output buffer, 1=send
output buffer data to MIDI I/O as well as current byte.
- void silence(int channel = -1);
- silence MIDI data from the computer to a synthesizer. If channel
== -1, then send note off commands on all channels, otherwise send
only on specified channel.
- void sustain(int channel, int status);
- Turns on/off the continuous controller 0x40 (sustain).
Turn on sustain with sustain(1). Turn off sustain
with sustain(0).
Same as off=cont(channel, 0x40, 0), or on=cont(channel, 0x40,
127).
- channel: MIDI channel [0..15]
- status: on/off switch, [0..1] 0=off, 1=on
Send comments/errors on this page to
craig@ccrma.stanford.edu