![]() |
uvi-script
Musical event scripting with Lua
|
Classes | |
| class | Event |
| Event types. More... | |
| class | MidiEvent |
| A Midi Event. More... | |
| class | MidiSequence |
| A Midi sequence that represent a midi file. More... | |
Functions | |
| void | postMidiEvent (MidiEvent e) |
| send a MidiEvent directly to the script engine event queue. | |
| function | enable_rpn_as_cc (value) |
| lets the script receive RPN as plain CC. | |
| function | enable_nrpn_as_cc (value) |
| lets the script receive NRPN as plain CC. | |
| function | enable_data_entry_as_cc (value) |
| lets the script receive 'data entry' as plain CC. | |
| function | controlChange (cc, val, ch, inp) |
| sends a ControlChange event. | |
| function | programChange (val, ch, inp) |
| sends a ProgramChange event. | |
| function | pitchBend (b, ch, inp) |
| sends a PitchBend event. | |
| function | afterTouch (v, ch, inp) |
| sends an AfterTouch event. | |
| function | polyAfterTouch (v, n, ch, inp) |
| sends a PolyAfterTouch event. | |
MIDI event generation, file handling, and event structures.
Provides helper functions for generating outgoing MIDI events, classes for loading and manipulating MIDI files, and functions to post raw MIDI events to the engine.
Event Generation Helpers:
Key Classes:
MIDI File Operations:
Raw Event Posting:
| function afterTouch | ( | v | , |
| ch | , | ||
| inp | ) |
sends an AfterTouch event.
| v | MIDI AfterTouch value in [0;127], out of range values are clipped |
| ch | (optional) MIDI channel in [1;16], nil or 0 for all channels |
| inp | (optional) MIDI input in [1;4], nil or 0 for all inputs |
| function controlChange | ( | cc | , |
| val | , | ||
| ch | , | ||
| inp | ) |
sends a ControlChange event.
| cc | MIDI Control Change number in [0;127] |
| val | MIDI Control Change value in [0;127], out of range values are clipped |
| ch | (optional) MIDI channel in [1;16], nil or 0 for all channels |
| inp | (optional) MIDI input in [1;4], nil or 0 for all inputs |
| function enable_data_entry_as_cc | ( | value | ) |
lets the script receive 'data entry' as plain CC.
By default CC 6 and CC 38 (data entry MSB, LSB) are consumed before the script sees them: they never reach onController()/onEvent(), getCC() or the script output. Once enabled they are delivered like any other CC and the MSB, LSB midi state machine is left to the script author
| value | true to receive them, any other value restores the default filtering |
| function enable_nrpn_as_cc | ( | value | ) |
lets the script receive NRPN as plain CC.
By default CC 98 and CC 99 (NRPN LSB, MSB) are consumed before the script sees them: they never reach onController()/onEvent(), getCC() or the script output. Once enabled they are delivered like any other CC and the MSB, LSB midi state machine is left to the script author
| value | true to receive them, any other value restores the default filtering |
| function enable_rpn_as_cc | ( | value | ) |
lets the script receive RPN as plain CC.
By default CC 100 and CC 101 (RPN LSB, MSB) are consumed before the script sees them: they never reach onController()/onEvent(), getCC() or the script output. Once enabled they are delivered like any other CC and the MSB, LSB midi state machine is left to the script author
| value | true to receive them, any other value restores the default filtering |
| function pitchBend | ( | b | , |
| ch | , | ||
| inp | ) |
sends a PitchBend event.
| b | PitchBend value in [-1;1], out of range values are clipped |
| ch | (optional) MIDI channel in [1;16], nil or 0 for all channels |
| inp | (optional) MIDI input in [1;4], nil or 0 for all inputs |
| function polyAfterTouch | ( | v | , |
| n | , | ||
| ch | , | ||
| inp | ) |
sends a PolyAfterTouch event.
| v | MIDI AfterTouch value in [0;127], out of range values are clipped |
| n | MIDI note number in [0;127] |
| ch | (optional) MIDI channel in [1;16], nil or 0 for all channels |
| inp | (optional) MIDI input in [1;4], nil or 0 for all inputs |
| void postMidiEvent | ( | MidiEvent | e | ) |
send a MidiEvent directly to the script engine event queue.
MidiEvent are posted as-is to the event queue in order to make midi file playing easy. i.e. they don't have voiceId If you need more advanced events processing, you should use playNote() and releaseVoice() and keep track yourself of which note triggered each voiceId.
timestamp is ignored: the event is posted at the current time of the calling thread. To schedule events from a MidiSequence, wait() until each event is due (converting ticks with the sequence's division) and post it then.| e | MIDI event to be sent |
| function programChange | ( | val | , |
| ch | , | ||
| inp | ) |
sends a ProgramChange event.
| val | MIDI Program Change value in [0;127], out of range values are clipped |
| ch | (optional) MIDI channel in [1;16], nil or 0 for all channels |
| inp | (optional) MIDI input in [1;4], nil or 0 for all inputs |