Module xSample
Class containing methods for working with renoise.Sample objects .
Functions
__init (vararg) | Constructor |
get_display_name (sample, sample_idx) | Static methods |
set_loop_all (sample, loop_mode) | set sample loop to entire range, optionally set loop mode (else OFF) |
is_fully_looped (sample) | true when loop spans the entire range |
set_loop_pos (sample, start_pos, end_pos) | set sample loop - fit to range, allow end before start (flip) |
set_loop_to_selection (sample, loop_mode) | match sample loop with buffer selection |
clear_loop (sample) | clear loop (set to off, with full range) |
get_sample_buffer (sample) | obtain the sample buffer if defined and not empty |
convert_sample (instr_idx, sample_idx, args, callback) | convert sample: change bit-depth, perform channel operations, crop etc. |
get_name_tokens (str) | extract tokens from a sample name |
get_buffer_frame_by_notepos (sample, trigger_pos, end_pos, ignore_sxx) | obtain the buffer frame from a particular position in the song |
get_transposed_frame (note_value, frame) | transpose the number of frames |
get_transposed_note (sample, played_note) | obtain the transposed note. |
get_lines_spanned (sample, note_value, frames) | obtain the number of lines spanned when playing the sample at the provided pitch NB: the method assumes the current BPM/LPB values |
get_beatsynced_factor (sample) | obtain the relative playback speed of a beat-synced sample, e.g. |
get_beatsynced_note (sample) |
Tables
SAMPLE_CONVERT | SAMPLE_CONVERT: misc. |
Functions
- __init (vararg)
-
Constructor an xSample instance can be used as a 'virtual' sample, containing some (but not all)
properties that can be specified for a real sample ..
Parameters:
- vararg or renoise.Sample)
- get_display_name (sample, sample_idx)
-
Static methods get sample name, as it appears in the sample-list (untitled samples included)
Parameters:
- sample (renoise.Sample)
- sample_idx (number)
Returns:
-
string
- set_loop_all (sample, loop_mode)
-
set sample loop to entire range, optionally set loop mode (else OFF)
Parameters:
- sample (renoise.Sample)
- loop_mode ] (renoise.Sample.LOOPMODEX)
- is_fully_looped (sample)
-
true when loop spans the entire range
Parameters:
- sample
Returns:
-
boolean or nil when no buffer
- set_loop_pos (sample, start_pos, end_pos)
-
set sample loop - fit to range, allow end before start (flip)
Parameters:
- sample (renoise.Sample)
- start_pos (int)
- end_pos (int)
- set_loop_to_selection (sample, loop_mode)
-
match sample loop with buffer selection
Parameters:
- sample (renoise.Sample)
- loop_mode ] (renoise.Sample.LOOPMODEX)
- clear_loop (sample)
-
clear loop (set to off, with full range)
Parameters:
- sample
- get_sample_buffer (sample)
-
obtain the sample buffer if defined and not empty
Parameters:
- sample (renoise.Sample)
Returns:
-
renoise.SampleBuffer or nil
- convert_sample (instr_idx, sample_idx, args, callback)
-
convert sample: change bit-depth, perform channel operations, crop etc.
Parameters:
- instr_idx (int)
- sample_idx (int)
- args (table) bitdepth (xSampleBuffer.BITDEPTH) channelaction (xSample.SAMPLECONVERT) range (table) optional, {startframe,endframe}
- callback (function) return resulting sample
- get_name_tokens (str)
-
extract tokens from a sample name
Parameters:
- str , e.g. "VST: Synth1 VST (Honky Piano)0x7FC-5"
Returns:
-
table, {
sample_name = string ("Recorded sample 01"), plugin_type = string ("VST" or "AU"), plugin_name = string ("Synth1 VST"), preset_name = string ("Honky Piano"), velocity = string ("0x7F"), note = string ("C-5")
}
- get_buffer_frame_by_notepos (sample, trigger_pos, end_pos, ignore_sxx)
-
obtain the buffer frame from a particular position in the song
Parameters:
- sample (renoise.Sample)
- trigger_pos (xCursorPos), triggering position + note/pitch/delay/offset
- end_pos (xCursorPos), the end position
- ignore_sxx ] (boolean), handle special case with sliced instruments, where Sxx is used on the root sample for triggering individual slices
Returns:
-
table{
frame (number)
notecol (renoise.NoteColumn)
} or false,error (string) when failed
- get_transposed_frame (note_value, frame)
-
transpose the number of frames
Parameters:
- note_value
- frame
- get_transposed_note (sample, played_note)
-
obtain the transposed note. Final pitch of the played sample is:
playednote - mapping.basenote + sample.transpose + sample.finetune
Parameters:
- sample (Renoise.Sample)
- played_note (number)
Returns:
-
number (natural number = pitch, fraction = finetune)
- get_lines_spanned (sample, note_value, frames)
-
obtain the number of lines spanned when playing the sample at the provided pitch
NB: the method assumes the current BPM/LPB values
Parameters:
- sample (Renoise.Sample)
- note_value (number)
- frames ] (number), force to specific #frames (otherwise, use buffer length)
Returns:
-
number
- get_beatsynced_factor (sample)
-
obtain the relative playback speed of a beat-synced sample, e.g. "0.5" for half tempo
NB: the method assumes the current BPM/LPB values
Parameters:
- sample
Returns:
-
number (pitch, with possible fraction) or nil when not beat-synced
- get_beatsynced_note (sample)
-
Parameters:
- sample (Renoise.Sample)
Returns:
-
number (pitch, with possible fraction) or nil when not beat-synced