Module xPhrase
Static methods for dealing with renoise.Phrase objects .
TODO turn tonumber/string conversions into standard cLib methods percentage: cNumber.stringtopercentage / percentagetostring
Functions
replace_sample_index (phrase, idx_from, idx_to) | replace sample indices in the provided phrase |
get_line_from_cursor (phrase, trigger_pos, cursor_pos, line_offset, notecol) | Resolve the "internal" line number in a phrase from two external positions |
note_is_keymapped (note, instr) | check if note is referring to keymapped phrase |
clear_foreign_commands (phrase) | remove commands that does not belong in a phrase |
stringify (phrase) | create a string representation of the phrase |
apply_to_track (options) | write phrase to (part of) the indicated pattern-track |
export_preset (folder, instr_idx, phrase_idx, overwrite, prefix) | export a single phrase, create destination if it doesn't exist |
get_preset_filepath (folder, phrase, phrase_idx) | generate a valid filename (for exporting phrase presets) |
get_raw_preset_name (str) | get the basic preset name, without prefix and file extension e.g. |
set_property (phrase, key, val) | set a property of the phrase (using DOC_PROPS to validate input type/range etc.) |
Functions
- replace_sample_index (phrase, idx_from, idx_to)
-
replace sample indices in the provided phrase
Parameters:
- phrase (renoise.InstrumentPhrase)
- idx_from (int)
- idx_to (int)
- get_line_from_cursor (phrase, trigger_pos, cursor_pos, line_offset, notecol)
-
Resolve the "internal" line number in a phrase from two external positions
Parameters:
- phrase (renoise.InstrumentPhrase)
- trigger_pos (xCursorPos) the position where the note got triggered
- cursor_pos (SongPos/alike) the position that we want to resolve
- line_offset ] (number) optional line offset
- notecol ] (renoise.NoteColumn) triggering note - if undefined, resolve from trigger_pos
Returns:
- number or nil if failed
- string, error message when failed
- note_is_keymapped (note, instr)
-
check if note is referring to keymapped phrase
Parameters:
- note (int)
- instr (renoise.Instrument) or table containing 'note_range'
Returns:
-
bool
- clear_foreign_commands (phrase)
-
remove commands that does not belong in a phrase
Parameters:
- phrase (renoise.InstrumentPhrase)
- stringify (phrase)
-
create a string representation of the phrase
Parameters:
- phrase renoise.InstrumentPhrase
Returns:
-
string
- apply_to_track (options)
-
write phrase to (part of) the indicated pattern-track
Parameters:
- options (table)
- export_preset (folder, instr_idx, phrase_idx, overwrite, prefix)
-
export a single phrase, create destination if it doesn't exist
Parameters:
- folder
- instr_idx
- phrase_idx
- overwrite
- prefix
Returns:
- bool, true when export was succesfull
- xPhrase.ERROR, when an error was encountered
- get_preset_filepath (folder, phrase, phrase_idx)
-
generate a valid filename (for exporting phrase presets)
Parameters:
- folder (string)
- phrase (renoise.InstrumentPhrase)
- phrase_idx (number), add prefix to filename [optional]
Returns:
-
string
- get_raw_preset_name (str)
-
get the basic preset name, without prefix and file extension
e.g. "140Eander patroon.xrnz" becomes "ander patroon"
Parameters:
- str
- set_property (phrase, key, val)
-
set a property of the phrase
(using DOC_PROPS to validate input type/range etc.)
Parameters:
- phrase
- key
- val
Returns:
-
value (boolean,string,number)