Module Duplex.Applications.Keyboard
A replacement of the standard Renoise keyboard, supporting for MIDI and OSC.
Inheritance: Duplex.Application > Duplex.Application.Keyboard
Features
- Integrate with standard MIDI Keyboard or Pad/Grid controller
- Produce keyboard splits and customize the behaviour
- Route specific splits to specific instruments and/or tracks
In more details
The Keyboard application can be used as a standard keyboard (visulized as black & white keys in the virtual control surface), or as individually-mapped keys/pads, suitable for grid and pad controllers.
When you are using the application in the standard keyboard mode, it might receive pitch bend and channel pressure information from the device, which can then be A) ignored, B) broadcast as MIDI (unchanged), C) or routed internally to any MIDI CC message (this in turn means that you can easily use the native MIDI mapping in Renoise to map the pitch bend to any parameter)
In grid mode, the Keyboard application is able to visualize the currently selected instrument's keyzone/sample mappings in realtime. This makes it a lot easier to see exactly where each sound is located, and even works as you are moving mappings around, or transposing the keyboard (octave up/down). Also, all of the UISlider mappings (volume, octave, pitch bend, etc.) support grid mode, as their mappings can be mapped to buttons just as easily as they can be mapped to a physical slider or fader.
Furthermore, since we are using internally-triggered notes we have the ability to trigger notes inside a specific track, using a specific instrument. The default setting is identical to the standard behaviour in Renoise, and simply uses the currently selected track/instrument. But it's possible to select any track or instrument using the options "Active track/instr.", choosing any number between 1-64 (a planned feature is to "lock" the track or instrument by assigning a special name to it, something which has not made it into this initial release).
Finally, you can stack multiple Keyboard applications to control/trigger multiple instruments with a single master keyboard. The "MIDI-Keyboard" device comes with a configuration that demonstrate this ("Stacked Keys"), in which three instrument are triggered, each with different velocity settings.
Prerequisites
The Keyboard application will not work unless you have enabled the internal OSC server in Renoise (Renoise prefereces -> OSC settings). It should be set to "UPD" protocol, and use the same port as specified in Duplex/Globals.lua (by default, this is set to the same value as Renoise, "8000").
Discuss
Tool discussion is located on the Renoise forum
Changes
0.99.4
- Support for Renoise 3 trigger options (hold/mono modes)
- Custom grid layouts (harmonic, isomorphic layout and piano emulation)
0.99.2
- Adapted to UIKey changes
- New mapping: mod_wheel
0.98.32
- TWEAK: velocity now is set to an explicit value, or synced to Renoise keyboard
velocity will output a fixed velocity (previously it was relative to messages)
0.98.16
- Display message on how to enable OSC server (first time only)
0.98.15
- New option: “Keyboard Mode”, choose which notes (if any) to trigger
0.98
- First release
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 | octave |
self.curr_volume | volume |
self.curr_track | track index |
self.curr_instr | instrument index |
self.scale_mode | instrument scale |
self.scale_key | instrument scale |
self.lower_note | lower note |
self.upper_note | upper note |
self.grid_w | grid width |
self.grid_h | 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:
- true when note was triggered
- 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
- observables
Tables
Fields
- self.curr_octave
- octave
- self.curr_volume
- volume
- self.curr_track
- track index
- self.curr_instr
- instrument index
- self.scale_mode
- instrument scale
- self.scale_key
- instrument scale
- self.lower_note
- lower note
- self.upper_note
- upper note
- self.grid_w
- grid width
- self.grid_h
- 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