Module Duplex.Applications.StepSequencer
A step sequencer for grid/pad-based controllers
View the README.md (github)
Functions
__init (VarArg) | Constructor method |
start_app () | Inherited from Application |
stop_app () | Inherited from Application |
_build_app () | Inherited from Application |
_build_line () | Line (up/down scrolling) |
_build_track () | Track or column (sideways scrolling) |
_build_grid () | Construct user interface |
_build_level () | Construct user interface |
_build_levelslider () | Construct user interface |
_build_levelsteps () | Construct user interface |
_build_transpose () | Build transpose buttons |
on_idle () | Inherited from Application |
_update_track_count () | Update track navigator on new song, and when tracks have been changed |
_update_position () | If the playback position is inside visible range of the sequencer, update the position indicator. |
_should_update_page () | Check if we should switch the active page/range inside the pattern |
get_pos () | Get the current position (edit-pos when stopped, playpos when playing) |
set_page (idx) | Set the current edit page |
jump_to_top () | Jump to topmost page |
jump_to_bottom () | Jump to bottommost page |
jump_to_prev_lines () | Jump to previous page |
jump_to_next_lines () | Jump to next page |
post_jump_update () | Update display after a jump |
_draw_position (line_pos) | Display a line-position within the sequencer [GRIDMODEMULTIPLE] show position inside the level-strip [GRIDMODESINGLE] show position inside the matrix |
_update_line_count () | Update the range of the line navigator |
_update_line_buttons () | Update the display (line buttons) |
_update_grid () | Update the display (main grid) |
_track_line_changes (linepos) | Decide if we need to update the display when the pattern editor has changed note: this method might be called hundreds of times when doing edits like cutting all notes from a pattern, so we need it to be really simple |
_songpos_is_visible (pos) | Check if a given line is within the visible range |
_track_is_visible (rns_track_idx) | Check if a given track is within the visible range |
_follow_track () | When following the active track in Renoise, we call this method (note: track following is limited to sequencer tracks) |
_get_sequencer_track_index (rns_track_idx) | Figure out the sequencer track index (filter out non-sequencer-tracks) |
_get_actual_track_index (seq_track_idx) | Figure out the actual track index when providing a sequencer-track index |
_update_selected_column () | When following the active track in Renoise, we call this method (track following is limited to sequencer tracks) |
_get_track_page (seq_track_idx) | Figure out the active "track page" based on the sequencer-track index |
_get_track_page_width () | Get the currently set track-page width |
_get_orientation () | Get the orientation of the main grid return ORIENTATION |
_attach_to_song () | Add notifiers to relevant parts of the song |
_attach_to_pattern (new_song, patt_idx) | Add notifiers to the pattern |
_attach_alias_notifiers (new_song, patt_idx) | Monitor the current pattern for changes to it's aliases |
_attach_line_notifiers (new_song, patt_idx) | Attach line notifiers to pattern check for existing notifiers first, and remove those then add pattern notifiers to pattern (including aliased slots) |
remove_line_notifiers (new_song) | Remove currently attached line notifiers |
on_new_document () | Inherited from Application |
_process_grid_event (x, y, state, btn) | STEP SEQUENCER FUNCTIONS |
_obtain_instrument_by_name (name) | Obtain instrument by name (track<>instrument synchronization) |
_copy_grid_button (lx, ly, btn) | Find and copy a note in the pattern (when button is held) |
get_notecolumn (track_idx, line_idx) | Function to safely obtain a note-column |
_draw_volume_slider (volume) | Update display of volume slider |
_draw_volume_steps (volume) | Update display of volume slider |
_draw_level_slider (volume) | Update the level slider |
_write_note () | Check if it should be possible to write not pattern |
_play_note () | Check if note should be triggered |
_set_note (notecol, note, instrument, volume) | Write properties into provided note column |
_clear_note (notecol) | Clear properties for note column |
_draw_grid_button (button, notecol, current_track) | Assign color to button, based on note properties |
_volume_palette (vol, max) | Figure out the color for a given volume level |
_set_basenote (note_value) | Set basenote for new notes |
_transpose_basenote (steps) | Transpose existing basenote by given amount |
_remove_notifiers (new_song, observables) | Detach all previously attached notifiers first but don't even try to detach when a new song arrived. |
_walk_held_keys (callback, toggle_exempt) | Apply a function to all held grid buttons, optionally adding them all to toggle_exempt table. |
Tables
self._keys_down | track held grid keys |
self._toggle_exempt | don't toggle off if pressing multiple on / transposing / etc |
Fields
self._base_note | default note/volume |
self._track_count | default note-grid size |
self._edit_page | the currently editing "page" |
self._track_offset | the track offset (0-#sequencer-tracks) |
self._follow_player | boolean, true when song follow is enabled |
self._start_tracking | boolean, set when switching from "not follow" to "follow" |
self._current_pattern_index | remember the current pattern index here |
self._current_line_index | remember the current line index |
self._current_column_index | remember the current column in track |
self._line_notifiers | collect patterns indices with line_notifiers |
self._alias_notifiers | collect references to pattern-alias notifier methods |
Functions
- __init (VarArg)
-
Constructor method
Parameters:
- VarArg )
See also:
- start_app ()
-
Inherited from Application
Returns:
-
bool or nil
See also:
- stop_app ()
-
Inherited from Application
See also:
- _build_app ()
-
Inherited from Application
Returns:
-
bool
See also:
- _build_line ()
- Line (up/down scrolling)
- _build_track ()
- Track or column (sideways scrolling)
- _build_grid ()
- Construct user interface
- _build_level ()
- Construct user interface
- _build_levelslider ()
- Construct user interface
- _build_levelsteps ()
- Construct user interface
- _build_transpose ()
- Build transpose buttons
- on_idle ()
-
Inherited from Application
See also:
- _update_track_count ()
- Update track navigator on new song, and when tracks have been changed
- _update_position ()
- If the playback position is inside visible range of the sequencer, update the position indicator. Else, if follow mode is active, display the current page
- _should_update_page ()
- Check if we should switch the active page/range inside the pattern
- get_pos ()
-
Get the current position (edit-pos when stopped, playpos when playing)
Returns:
-
SongPos
- set_page (idx)
-
Set the current edit page
Parameters:
- idx (int)
- jump_to_top ()
- Jump to topmost page
- jump_to_bottom ()
- Jump to bottommost page
- jump_to_prev_lines ()
- Jump to previous page
- jump_to_next_lines ()
- Jump to next page
- post_jump_update ()
- Update display after a jump
- _draw_position (line_pos)
-
Display a line-position within the sequencer
[GRIDMODEMULTIPLE] show position inside the level-strip
[GRIDMODESINGLE] show position inside the matrix
Parameters:
- line_pos (number), current playback line (0 to clear)
- _update_line_count ()
- Update the range of the line navigator
- _update_line_buttons ()
- Update the display (line buttons)
- _update_grid ()
- Update the display (main grid)
- _track_line_changes (linepos)
-
Decide if we need to update the display when the pattern editor has changed
note: this method might be called hundreds of times when doing edits like
cutting all notes from a pattern, so we need it to be really simple
Parameters:
- linepos , table{pattern:number,track:number,line:number}
- _songpos_is_visible (pos)
-
Check if a given line is within the visible range
Parameters:
- pos , renoise.SongPos or table{sequence:number,line:number}
Returns:
-
boolean
- _track_is_visible (rns_track_idx)
-
Check if a given track is within the visible range
Parameters:
- rns_track_idx (int)
Returns:
-
boolean
- _follow_track ()
- When following the active track in Renoise, we call this method (note: track following is limited to sequencer tracks)
- _get_sequencer_track_index (rns_track_idx)
-
Figure out the sequencer track index (filter out non-sequencer-tracks)
Parameters:
- rns_track_idx , number
Returns:
-
number or nil
- _get_actual_track_index (seq_track_idx)
-
Figure out the actual track index when providing a sequencer-track index
Parameters:
- seq_track_idx , number
Returns:
-
number or nil
- _update_selected_column ()
- When following the active track in Renoise, we call this method (track following is limited to sequencer tracks)
- _get_track_page (seq_track_idx)
-
Figure out the active "track page" based on the sequencer-track index
Parameters:
- seq_track_idx , number return integer (0-number of pages)
- _get_track_page_width ()
-
Get the currently set track-page width
Returns:
-
int
- _get_orientation ()
- Get the orientation of the main grid return ORIENTATION
- _attach_to_song ()
- Add notifiers to relevant parts of the song
- _attach_to_pattern (new_song, patt_idx)
-
Add notifiers to the pattern
Parameters:
- new_song
- patt_idx
- _attach_alias_notifiers (new_song, patt_idx)
-
Monitor the current pattern for changes to it's aliases
Parameters:
- new_song
- patt_idx
- _attach_line_notifiers (new_song, patt_idx)
-
Attach line notifiers to pattern
check for existing notifiers first, and remove those
then add pattern notifiers to pattern (including aliased slots)
Parameters:
- new_song
- patt_idx
- remove_line_notifiers (new_song)
-
Remove currently attached line notifiers
Parameters:
- new_song
- on_new_document ()
-
Inherited from Application
See also:
- _process_grid_event (x, y, state, btn)
-
STEP SEQUENCER FUNCTIONS Handle when button in main grid is pressed
Parameters:
- x , number
- y , number
- state , boolean
- btn (UIButton)
- _obtain_instrument_by_name (name)
-
Obtain instrument by name (track<>instrument synchronization)
Parameters:
- name
Returns:
-
int, instrument index
- _copy_grid_button (lx, ly, btn)
-
Find and copy a note in the pattern (when button is held)
Parameters:
- lx (int)
- ly (int)
- btn (Duplex.UIButton)
Returns:
-
true when copying was done
- get_notecolumn (track_idx, line_idx)
-
Function to safely obtain a note-column
Parameters:
- track_idx (number)
- line_idx (number)
Returns:
-
renoise.NoteColumn or nil
- _draw_volume_slider (volume)
-
Update display of volume slider
Parameters:
- volume (int), between 0-127
- _draw_volume_steps (volume)
-
Update display of volume slider
Parameters:
- volume (int), between 0-127
- _draw_level_slider (volume)
-
Update the level slider
Parameters:
- volume (int), between 0-127
- _write_note ()
-
Check if it should be possible to write not pattern
Returns:
-
boolean
- _play_note ()
-
Check if note should be triggered
Returns:
-
boolean
- _set_note (notecol, note, instrument, volume)
-
Write properties into provided note column
Parameters:
- notecol (NoteColumn)
- note (int) note pitch
- instrument (int) instrument number
- volume (int) note velocity
- _clear_note (notecol)
-
Clear properties for note column
Parameters:
- notecol (NoteColumn)
- _draw_grid_button (button, notecol, current_track)
-
Assign color to button, based on note properties
Parameters:
- button , UIButton
- notecol , renoise.NoteColumn or nil
- current_track , boolean
- _volume_palette (vol, max)
-
Figure out the color for a given volume level
Parameters:
- vol (int), between 0-127
- max (int), 127
Returns:
-
table{int,int,int}
- _set_basenote (note_value)
-
Set basenote for new notes
Parameters:
- note_value (int) note pitch
- _transpose_basenote (steps)
-
Transpose existing basenote by given amount
Parameters:
- steps (int) relative amount to add
- _remove_notifiers (new_song, observables)
-
Detach all previously attached notifiers first
but don't even try to detach when a new song arrived. old observables
will no longer be alive then...
Parameters:
- new_song (bool), true to leave existing notifiers alone
- observables
- list of observables
- _walk_held_keys (callback, toggle_exempt)
-
Apply a function to all held grid buttons, optionally adding them
all to toggle_exempt table.
Parameters:
- callback (function), the callback function
- toggle_exempt (bool), do not toggle off
Returns:
-
the number of held keys
Tables
- self._keys_down
- track held grid keys
- self._toggle_exempt
- don't toggle off if pressing multiple on / transposing / etc
Fields
- self._base_note
- default note/volume
- self._track_count
- default note-grid size
- self._edit_page
- the currently editing "page"
- self._track_offset
- the track offset (0-#sequencer-tracks)
- self._follow_player
- boolean, true when song follow is enabled
- self._start_tracking
- boolean, set when switching from "not follow" to "follow"
- self._current_pattern_index
- remember the current pattern index here
- self._current_line_index
- remember the current line index
- self._current_column_index
- remember the current column in track
- self._line_notifiers
- collect patterns indices with line_notifiers
- self._alias_notifiers
- collect references to pattern-alias notifier methods