Module Duplex.OscVoiceMgr

The OscVoiceMgr is a class for handling internally triggered notes, keeping track of the active voices and their context

The purpose is to keep track of active voices, and their context: how the note got triggered: which device/application/instrument/pitch etc.

Some of the problems that a voice-manager can solve:

  • Notes are getting stuck when a keyboard octave is "virtually transposed", as the released key will transmit a different pitch than the pressed one. Solution: simply tell the voice-manager that your application's base octave has been changed with this & that many semitones.
  • When the same note is triggered multiple times, once any key is released, the remaining voices are also stopped. Solution: Trigger notes with the keep_until_all_released flag, and the note is kept alive until all pressed notes are released

Changes

0.99.4

- Support for trigger options (hold/mono modes)
- Register_callback(), makes apps able to receive notifications

0.98.15

- First release

Functions

__init () Initialize the OscVoiceMgr class
trigger (app, instr_idx, track_idx, pitch, velocity, keep, is_midi, channel) This is the main trigger function
release (app, instr_idx, track_idx, pitch, velocity, is_midi, channel, force) The main release function.
_was_osc_triggered (str_app, pitch, channel) If OSC triggered this note, return true
_was_midi_triggered (str_app, pitch, channel) If MIDI triggered this note, return true
_trigger_note (app, instr_idx, track_idx, pitch, velocity, is_midi, channel) Trigger a note note: also used for turning off notes using "hold mode"
_release_note (app, instr_idx, track_idx, pitch, velocity, is_midi, channel) Release a given note.
_get_pitch_offset () Return the pitch offset, a value which is used to "counter-transpose" the transposition amount which Renoise automatically assign to MIDI-notes (the value of which based on the current octave).
_get_app_name (app) Return a unique name for any running process/application (can be called as static method)
note_is_active (instr_idx, pitch) Check if a particular instrument-note is still playing, somewhere...
_notify_applications (evt, note, idx) When voices are added or removed, notify the application
transpose (app, semitones) When an application transpose it's control surface, any triggered note would need to be "de-transposed" once it's released - this function will apply the amount of transpose to the currently held notes (the ones that match the application as their originating_app)
remove_all_voices () remove all active voices
remove_voices (app, instr_idx) remove active voices from a given application
purge_voices (app, instr_idx) purge voices from provided application
register_callback (app, func) Remove application from active voices (release, then remove)

Fields

self.app (Duplex.Application) the application that triggered this note
self.originating_app (string) a string for identifying the application
self.keep_until_all_released (bool) decide whether a released key should wait for all other pressed keys before it is allowed to release (set this to false if you're triggering notes with a pad controller that doesn't send release notes)
self.temp_transpose (int) the temporary transpose of the application
self.is_held (bool) whether or not the key is held
self.pitch (int) pitch
self.velocity (int) velocity
self.is_midi (bool) true when MIDI, false means OSC
self.channel (int) for midi, but also helps to differentiate
(when looking for osc-triggered notes)
self.instr_idx (int) the Renoise instrument index
self.track_idx (int) the Renoise track index


Functions

__init ()
Initialize the OscVoiceMgr class
trigger (app, instr_idx, track_idx, pitch, velocity, keep, is_midi, channel)
This is the main trigger function

Parameters:

  • app (Duplex.Application) the calling application
  • instr_idx (int) the Renoise instrument index
  • track_idx (int) the Renoise track index
  • pitch (int) 0-120
  • velocity (int) 0-127
  • keep (bool) if true, keep all notes until release
  • is_midi (bool) to distinguish between OSC and MIDI notes
  • channel (int) the MIDI channel, 1-16 (not used!!)
release (app, instr_idx, track_idx, pitch, velocity, is_midi, channel, force)
The main release function. Will ensure that the right notes are released, even when the keyboard has been transposed since the notes were triggered

Parameters:

  • app (Duplex.Application) the calling application
  • instr_idx (int) the Renoise instrument index
  • track_idx (int) the Renoise track index
  • pitch (int) 0-120
  • velocity (int) 0-127
  • is_midi (bool) to distinguish between OSC and MIDI notes
  • channel (int) the MIDI channel, 1-16
  • force (bool) skip the check for hold mode

Returns:

    int, the amount of temp-transpose detected (in semitones)

See also:

_was_osc_triggered (str_app, pitch, channel)
If OSC triggered this note, return true

Parameters:

  • str_app (Duplex.Application), the originating application
  • pitch (int) 0-120
  • channel (int) the MIDI channel, 1-16

Returns:

    bool
_was_midi_triggered (str_app, pitch, channel)
If MIDI triggered this note, return true

Parameters:

  • str_app (Duplex.Application), the originating application
  • pitch (int) 0-120
  • channel (int) the MIDI channel, 1-16

Returns:

    bool
_trigger_note (app, instr_idx, track_idx, pitch, velocity, is_midi, channel)
Trigger a note note: also used for turning off notes using "hold mode"

Parameters:

  • app
  • instr_idx
  • track_idx
  • pitch
  • velocity
  • is_midi
  • channel
_release_note (app, instr_idx, track_idx, pitch, velocity, is_midi, channel)
Release a given note. We do not release notes directly, this method is called by the main release() method when it has been determined that a note should be released

Parameters:

  • app (Duplex.Application), the originating application
  • instr_idx (int) the Renoise instrument index
  • track_idx (int) the Renoise track index
  • pitch (int) 0-120
  • velocity (int) 0-127
  • is_midi (bool) to distinguish between OSC and MIDI notes
  • channel (int) the MIDI channel, 1-16

See also:

_get_pitch_offset ()
Return the pitch offset, a value which is used to "counter-transpose" the transposition amount which Renoise automatically assign to MIDI-notes (the value of which based on the current octave).

Returns:

    int, number of semitones
_get_app_name (app)
Return a unique name for any running process/application (can be called as static method)

Parameters:

Returns:

    string, e.g. "Launchpad_MyMixer"
note_is_active (instr_idx, pitch)
Check if a particular instrument-note is still playing, somewhere...

Parameters:

  • instr_idx (int) instrument index
  • pitch (int) note pitch

Returns:

    bool
_notify_applications (evt, note, idx)
When voices are added or removed, notify the application

Parameters:

  • evt
  • note
  • idx
transpose (app, semitones)
When an application transpose it's control surface, any triggered note would need to be "de-transposed" once it's released - this function will apply the amount of transpose to the currently held notes (the ones that match the application as their originating_app)

Parameters:

remove_all_voices ()
remove all active voices
remove_voices (app, instr_idx)
remove active voices from a given application

Parameters:

purge_voices (app, instr_idx)
purge voices from provided application

Parameters:

  • app (Duplex.Application)
  • instr_idx (int, optional) only remove voices from this instrument
register_callback (app, func)
Remove application from active voices (release, then remove)

Parameters:

Fields

self.app
(Duplex.Application) the application that triggered this note
self.originating_app
(string) a string for identifying the application
self.keep_until_all_released
(bool) decide whether a released key should wait for all other pressed keys before it is allowed to release (set this to false if you're triggering notes with a pad controller that doesn't send release notes)
self.temp_transpose
(int) the temporary transpose of the application
self.is_held
(bool) whether or not the key is held
self.pitch
(int) pitch
self.velocity
(int) velocity
self.is_midi
(bool) true when MIDI, false means OSC
self.channel
(int) for midi, but also helps to differentiate
(when looking for osc-triggered notes)
self.instr_idx
(int) the Renoise instrument index
self.track_idx
(int) the Renoise track index
generated by LDoc 1.4.2