MidiOutput class public functions

MidiPerform ~MidiPerform beat
getAmp
getMaxAmp
getTempoMethod
getTempo
channelCollapse
check
getBeatFraction
getBeatLocation
pause
play
read
rewind
setAmp
setMaxAmp
setBeatLocation
setTempoMethod
setTempo
MidiOutput
~MidiOutput
cont
off
pc
play
pw
recordStart
recordStop
reset
send
silence
sustain

Functions inherited from MidiOutPort
close
closeAll
getName
getNumPorts
getPort
getPortStatus
open
rawsend
setPort

Common MIDI Commands for playing synthesizers:
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.

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.

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.

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

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






Send comments/errors on this page to craig@ccrma.stanford.edu