MIDI output

Basic support for MIDI output is provided.

Synth.midioutputFunction
midioutput(name::AbstractString = "") :: PortMidiDest

Identifies a MIDI output device with the given name as a substring and opens a stream to write data to it. You can call Base.close on the resultant PortMidiDest to close the stream.

Throws PortMidiDestDeviceNotFoundError if such a device does not exist.

source
Synth.sendFunction
send(dev::MIDIDest, msg::MIDIMsg)

Sends the MIDIMsg to the device immediately.

source
Synth.noteonFunction
noteon(chan::Int, note::Int, vel::Int; port=:midi) :: MIDIMsg
noteon(chan::Int, note::Int, vel::AbstractFloat; port=:midi) :: MIDIMsg

Constructs a NoteOn message. The AbstractFloat version will take a velocity value in the range 0.0 to 1.0 and convert it to the MIDI range. Note that for sustained instruments like violin, you'll have to also send a noteoff at an appropriate time or else the voices will accumulate and result in your system being unable to keep up.

See also noteoff

source
Synth.noteoffFunction
noteoff(chan::Int, note::Int, vel::Int = 0; port=:midi) :: MIDIMsg

Constructs a NoteOff message. See also noteon

source
Synth.progchangeFunction
progchange(chan::Int, pgm::Int; port=:midi)

Send a "program change" for the given channel. See General MIDI if you're using a GM compatible synthesizer.

source
Synth.ctrlchangeFunction
ctrlchange(chan::Int, control::Int, val::Intl; port=:midi) :: MIDIMsg
ctrlchange(chan::Int, control::Int, val::AbstractFloat; port=:midi) :: MIDIMsg

Changes the value associated with the given control number. The AbstractFloat value is in the range 0.0-1.0 and will be rescaled to the MIDI range 0-127.

source
Synth.keypressureFunction
keypressure(chan::Int, note::Int, pressure::Int; port=:midi) :: MIDIMsg
keypressure(chan::Int, note::Int, pressure::AbstractFloat; port=:midi) :: MIDIMsg

The key pressure control after a note is turned on, before the note has conceptually ended. See also aftertouch. The AbstractFloat version will rescale the pressure value from the 0.0-1.0 range to the MIDI range of 0-127.

source
Synth.aftertouchFunction
aftertouch(chan::Int, note::Int, pressure::Int; port=:midi) :: MIDIMsg
aftertouch(chan::Int, note::Int, pressure::AbstractFloat; port=:midi) :: MIDIMsg

The key pressure control after a note has conceptually ended. See also aftertouch. The AbstractFloat version will rescale the pressure value from the 0.0-1.0 range to the MIDI range of 0-127.

source
Synth.pitchbendFunction
pitchbend(chan::Int, signedPB::Int; port=:midi)
pitchbend(chan::Int, signedPB::AbstractFloat; port=:midi)

Sends a 14-bit pitch bend value on the given channel. The sensitivity of this value will depend on the instrument. The AbstractFloat version will rescale (i.e. multiply) by 127 to construct a signed 14-bit value. So values < 1.0 will correspond to microtonal pitch bends.

source
Synth.midinopConstant
midinop :: MIDIMsg

A constant MIDIMsg that represents a "no-op" or "nothing to be sent out".

source