Module Duplex.Applications.Keyboard

A replacement of the standard Renoise keyboard, supporting MIDI and OSC.

View the README.md (github)

Functions

__init (VarArg) Constructor method
trigger (note_on, instr_idx, pitch, velocity, grid_index) Trigger notes using the internal voice manager (OSC server)
all_notes_off () stop all playing voices
inside_note_range (pitch) Test whether a given pitch is inside the specified note-range
get_nth_note (idx) Retrieve the number of semitones for the note in the current scale
restrict_pitch_to_scale (pitch) Restrict pitches to the ones allowed by the scale (for example, when playing E in natural minor it becomes D#)
_maintain_held_notes (voice_count, instr_idx, grid_index, velocity) Call this function immediately after triggering or releasing notes it will keep a record of notes triggered with the "hold" option
voicemgr_callback () Invoked by our voice manager
on_scale_change () Rebuild & retrigger (held) notes when changing the scale ...
send_midi (msg) send MIDI message using the internal OSC server
start_app () inherited from Application
stop_app () inherited from Application
on_idle () inherited from Application
_build_app () inherited from Application
obtain_octave () called when application is first started
obtain_track () called when application is first started
obtain_instr () called when application is first started
obtain_volume () called when application is first started
set_grid_layout (val) setgridlayout() - choose between available layout classes
set_octave (val, skip_option) set_octave() - sets the current octave
set_track (val, skip_option) switch to the selected track, optionally update options
set_instr (instr_idx, skip_option) switch to the selected instrument, optionally update options
set_upper_boundary (pitch) set the upper note on the keyboard
set_lower_boundary (pitch) set the lower note on the keyboard
set_boundaries () update the upper/lower boundaries of the virtual keyboard
set_volume (val, skip_option) set_octave() - sets the current volume
update_octave_controls () update display of octave controls
update_track_controls () update display of track controls
update_instr_controls () update display of instrument controls
update_cycle_controls () update display of layout cycler
update_volume_controls () update display of volume controls
cache_grid () preprocess/cache the grid
get_instrument_index () obtain the current instrument this method should ALWAYS be able to produce an instrument (fall back on the currently selected instrument if none was matched) return int,bool
get_track_index () obtain the current track this method should ALWAYS be able to produce a valid track index (fall back on the currently selected track if none was matched) return int
on_new_document () inherited from Application
_attach_to_song () attach notifier to the song, handle changes
attach_to_instrument () attach notifiers to selected instrument (watch for swapped keyzones, keyzone note-ranges)
_remove_notifiers (observables) brute force method for removing observables

Tables

self._controls the various UIComponents

Fields

self.curr_octave number, octave
self.curr_volume number, volume
self.curr_track number, track index
self.curr_instr number, instrument index
self.scale_mode string, instrument scale - e.g.
self.scale_key number, instrument key
self.lower_note number, lower note
self.upper_note number, upper note
self.grid_w number, grid width
self.grid_h number, grid height
self.voice_mgr voice manager
self._key_args control-map parameters
self._instr_observables instrument observables
self.held_notes table of currently playing, hold-mode triggered notes
self.pressed_buttons table of pressed buttons


Functions

__init (VarArg)
Constructor method

Parameters:

  • VarArg )

See also:

trigger (note_on, instr_idx, pitch, velocity, grid_index)
Trigger notes using the internal voice manager (OSC server)

Parameters:

  • note_on (bool), whether to send note-on/off
  • instr_idx (int)
  • pitch (int) 0-120
  • velocity (int) 0-127
  • grid_index (bool), when triggered from grid (optional)

Returns:

  1. true when note was triggered
  2. instr_idx the target instrument
all_notes_off ()
stop all playing voices
inside_note_range (pitch)
Test whether a given pitch is inside the specified note-range

Parameters:

  • pitch (int) note pitch
get_nth_note (idx)
Retrieve the number of semitones for the note in the current scale

Parameters:

  • idx (int)
restrict_pitch_to_scale (pitch)
Restrict pitches to the ones allowed by the scale (for example, when playing E in natural minor it becomes D#)

Parameters:

  • pitch
_maintain_held_notes (voice_count, instr_idx, grid_index, velocity)
Call this function immediately after triggering or releasing notes it will keep a record of notes triggered with the "hold" option

Parameters:

  • voice_count (int) the number of voices prior to the trigger/release
  • instr_idx (int)
  • grid_index (int, optional) remove only notes triggered by this button
  • velocity (int)
voicemgr_callback ()
Invoked by our voice manager
on_scale_change ()
Rebuild & retrigger (held) notes when changing the scale ...
send_midi (msg)
send MIDI message using the internal OSC server

Parameters:

  • msg (table) MIDI message with three bytes
start_app ()
inherited from Application

Returns:

    bool or nil

See also:

stop_app ()
inherited from Application

See also:

on_idle ()
inherited from Application

See also:

_build_app ()
inherited from Application

Returns:

    bool

See also:

obtain_octave ()
called when application is first started
obtain_track ()
called when application is first started
obtain_instr ()
called when application is first started
obtain_volume ()
called when application is first started
set_grid_layout (val)
setgridlayout() - choose between available layout classes

Parameters:

  • val (int), the index of the layout (as listed in options)

Returns:

    bool, false when initialization of class failed
set_octave (val, skip_option)
set_octave() - sets the current octave

Parameters:

  • val (int), between 0 and 8
  • skip_option (bool) set this to skip setting option
set_track (val, skip_option)
switch to the selected track, optionally update options

Parameters:

  • val (int), track index
  • skip_option (bool) set this to skip setting option
set_instr (instr_idx, skip_option)
switch to the selected instrument, optionally update options

Parameters:

  • instr_idx (int)
  • skip_option (bool) set this to skip setting option
set_upper_boundary (pitch)
set the upper note on the keyboard

Parameters:

  • pitch (int) note pitch
set_lower_boundary (pitch)
set the lower note on the keyboard

Parameters:

  • pitch (int) note pitch
set_boundaries ()
update the upper/lower boundaries of the virtual keyboard
set_volume (val, skip_option)
set_octave() - sets the current volume

Parameters:

  • val (int), between 0 and 127
  • skip_option (bool) set this to skip setting option
update_octave_controls ()
update display of octave controls
update_track_controls ()
update display of track controls
update_instr_controls ()
update display of instrument controls
update_cycle_controls ()
update display of layout cycler
update_volume_controls ()
update display of volume controls
cache_grid ()
preprocess/cache the grid

See also:

get_instrument_index ()
obtain the current instrument this method should ALWAYS be able to produce an instrument (fall back on the currently selected instrument if none was matched) return int,bool
get_track_index ()
obtain the current track this method should ALWAYS be able to produce a valid track index (fall back on the currently selected track if none was matched) return int
on_new_document ()
inherited from Application

See also:

_attach_to_song ()
attach notifier to the song, handle changes
attach_to_instrument ()
attach notifiers to selected instrument (watch for swapped keyzones, keyzone note-ranges)
_remove_notifiers (observables)
brute force method for removing observables

Parameters:

  • observables
    • list of observables

Tables

self._controls
the various UIComponents

Fields

self.curr_octave
number, octave
self.curr_volume
number, volume
self.curr_track
number, track index
self.curr_instr
number, instrument index
self.scale_mode
string, instrument scale - e.g. "Harmonic Minor")
self.scale_key
number, instrument key
self.lower_note
number, lower note
self.upper_note
number, upper note
self.grid_w
number, grid width
self.grid_h
number, grid height
self.voice_mgr
voice manager
self._key_args
control-map parameters
self._instr_observables
instrument observables
self.held_notes
table of currently playing, hold-mode triggered notes
self.pressed_buttons
table of pressed buttons
generated by LDoc 1.4.2