MIDI output
Basic support for MIDI output is provided.
Synth.midioutput — Functionmidioutput(name::AbstractString = "") :: PortMidiDestIdentifies 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.
Synth.send — Functionsend(dev::MIDIDest, msg::MIDIMsg)Sends the MIDIMsg to the device immediately.
Synth.noteon — Functionnoteon(chan::Int, note::Int, vel::Int; port=:midi) :: MIDIMsg
noteon(chan::Int, note::Int, vel::AbstractFloat; port=:midi) :: MIDIMsgConstructs 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
Synth.noteoff — Functionnoteoff(chan::Int, note::Int, vel::Int = 0; port=:midi) :: MIDIMsgConstructs a NoteOff message. See also noteon
Synth.progchange — Functionprogchange(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.
Synth.ctrlchange — Functionctrlchange(chan::Int, control::Int, val::Intl; port=:midi) :: MIDIMsg
ctrlchange(chan::Int, control::Int, val::AbstractFloat; port=:midi) :: MIDIMsgChanges 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.
Synth.keypressure — Functionkeypressure(chan::Int, note::Int, pressure::Int; port=:midi) :: MIDIMsg
keypressure(chan::Int, note::Int, pressure::AbstractFloat; port=:midi) :: MIDIMsgThe 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.
Synth.aftertouch — Functionaftertouch(chan::Int, note::Int, pressure::Int; port=:midi) :: MIDIMsg
aftertouch(chan::Int, note::Int, pressure::AbstractFloat; port=:midi) :: MIDIMsgThe 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.
Synth.pitchbend — Functionpitchbend(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.
Synth.midinop — Constantmidinop :: MIDIMsgA constant MIDIMsg that represents a "no-op" or "nothing to be sent out".
Synth.ismidinop — Functionismidinop(m::MIDIMsg) :: BoolReturns true if the given message is a midinop.