Module xSampleBuffer

Static methods for working with renoise.SampleBuffer objects .

About

This class contains a selection of processing functions that can be used for * getting statistics (number of actual bits, channels used, etc.) * inserting/resizing sample data (primitive stretching) * shifting/rotating sample data * adjusting amplitude

The class is designed to work as standalone, or in combination with xSampleBufferOperation If used standalone, you need to create a temporary sample and apply changes to the buffer before replacing the original sample.

How to use

TODO...

Functions

__init (vararg) Constructor
select_all (buffer) Selections
get_selection_range (buffer) get the size of the selected range (1 - #numberofframes)
right_is_selected (buffer) check if right channel is selected
left_is_selected (buffer) check if left channel is selected
selection_toggle_right (buffer) toggle right channel, but never remove selection
selection_toggle_left (buffer) toggle left channel, but never remove selection
mod_fn_shaped (fn) Processing
copy_fn_fn (buffer, rough, sel_start, sel_end) return the function that return the selected sample data (source: modulation.lua)
wave2tbl (...) == Copy to table == -- Use with 'cWaveform.table2fn'
get_bit_depth (buffer) Analysis
bits_to_xbits (num_bits) convert any bit-depth to a valid xSample representation
get_channel_info (buffer) check if sample buffer has duplicate channel data, is hard-panned or silent, etc.
detect_leading_trailing_silence (buffer, channels, threshold) check if the sample buffer contains leading or trailing silence
is_silent (buffer, channels) check if the indicated sample buffer is silent
set_buffer_selection (buffer, sel_start, sel_end) select region in waveform editor (clamp to valid range)
get_offset_indices (num_frames) Sample Offsets (0x0S Effect) & Position
get_nearest_offset (num_frames, offset, reverse) check for gaps, return first viable offset
get_next_offset (num_frames, offset) return next viable offset
get_previous_offset (num_frames, offset) return previous viable offset
get_offset_by_frame (buffer, frame) get a "OS" offset by position in buffer (NB: this method does not support/detect the Amiga/FT2 compatibility mode)
get_frame_by_offset (buffer, offset) get a "OS" offset by position in buffer (NB: this method does not support/detect the Amiga/FT2 compatibility mode)
get_frame_by_line (buffer, line, lpb, bpm) get a buffer position by "line"
get_frame_by_beat (buffer, beat, lpb, bpm) get a buffer position by "beat"
get_beat_by_frame (buffer, frame, bpm) get a line by position in buffer
get_line_by_frame (buffer, frame, lpb, bpm) get a beat by position in buffer
parse_processing_args (...) parse processing arguments, provide buffer defaults if undefined note: range is derived from current selection in buffer
create_wave_fn (...) Processing methods
extend (...) extend sample length (pad with silent frames)
sweep_ins (...) insert data in selected channel(s)
ins_in_all_ch (...) insert data in all channels
ins_in_one_ch (...) insert data in a single channel
get_frame_generator_fn (fn, ch, mod_fn, buffer, sel_start, range, sel_channel) return function that can generate frames note: only generate data for the selected channel(s)
empty_smple (...) silence entire sample
trim (...) trim: delete samples outside selection
sync_del (...) delete from selected channel(s) while preserving length
del_in_all_ch (...) delete from all channels (see sync_del)
del_in_one_ch (...) delete from single channel (see sync_del)
phase_shift (...) shift/rotate the specified region
set_fade (...)


Functions

__init (vararg)
Constructor create a 'virtual' sample-buffer object, unbound from Renoise

Parameters:

  • vararg or renoise.SampleBuffer)
select_all (buffer)
Selections select everything

Parameters:

  • buffer
get_selection_range (buffer)
get the size of the selected range (1 - #numberofframes)

Parameters:

  • buffer (renoise.SampleBuffer)

Returns:

    number
right_is_selected (buffer)
check if right channel is selected

Parameters:

  • buffer

Returns:

    boolean
left_is_selected (buffer)
check if left channel is selected

Parameters:

  • buffer

Returns:

    boolean
selection_toggle_right (buffer)
toggle right channel, but never remove selection

Parameters:

  • buffer
selection_toggle_left (buffer)
toggle left channel, but never remove selection

Parameters:

  • buffer
mod_fn_shaped (fn)
Processing making up the function for modulating

Parameters:

  • fn (function)

Returns:

    function
copy_fn_fn (buffer, rough, sel_start, sel_end)
return the function that return the selected sample data (source: modulation.lua)

Parameters:

  • buffer (renoise.SampleBuffer)
  • rough (boolean)
  • sel_start (number)
  • sel_end (number)
wave2tbl (...)
== Copy to table == -- Use with 'cWaveform.table2fn'

Parameters:

  • ...
get_bit_depth (buffer)
Analysis credit goes to dblue

Parameters:

  • buffer (renoise.SampleBuffer)

Returns:

    int (0 when no sample data)
bits_to_xbits (num_bits)
convert any bit-depth to a valid xSample representation

Parameters:

  • num_bits (int)

Returns:

    int (xSampleBuffer.BIT_DEPTH)
get_channel_info (buffer)
check if sample buffer has duplicate channel data, is hard-panned or silent, etc.

Parameters:

  • buffer (renoise.SampleBuffer)

Returns:

    enum (xSampleBuffer.SAMPLE_[...])
detect_leading_trailing_silence (buffer, channels, threshold)
check if the sample buffer contains leading or trailing silence

Parameters:

  • buffer (renoise.SampleBuffer)
  • channels (xSampleBuffer.SAMPLE_CHANNELS)
  • threshold ] (number), values below this level is considered silence (default is 0)

Returns:

    table startframe endframe
is_silent (buffer, channels)
check if the indicated sample buffer is silent

Parameters:

  • buffer (renoise.SampleBuffer)
  • channels (xSampleBuffer.SAMPLE_CHANNELS)

Returns:

    bool (or nil if no data)
set_buffer_selection (buffer, sel_start, sel_end)
select region in waveform editor (clamp to valid range)

Parameters:

  • buffer (renoise.SampleBuffer)
  • sel_start (int)
  • sel_end (int)

Returns:

    boolean, string (when failed to select)
get_offset_indices (num_frames)
Sample Offsets (0x0S Effect) & Position with small buffer sizes, not all offsets are valid this method returns the "missing" and "filled" ones as separate tables

Parameters:

  • num_frames

Returns:

    table, values between 0x00 - 0xFF
get_nearest_offset (num_frames, offset, reverse)
check for gaps, return first viable offset

Parameters:

  • num_frames (number)
  • offset (number), between 0x00 and 0xFF
  • reverse (boolean), match in reverse

Returns:

    number
get_next_offset (num_frames, offset)
return next viable offset

Parameters:

  • num_frames (number)
  • offset (number), between 0x00 and 0xFF

Returns:

    number
get_previous_offset (num_frames, offset)
return previous viable offset

Parameters:

  • num_frames (number)
  • offset (number), between 0x00 and 0xFF

Returns:

    number
get_offset_by_frame (buffer, frame)
get a "OS" offset by position in buffer (NB: this method does not support/detect the Amiga/FT2 compatibility mode)

Parameters:

  • buffer (renoise.SampleBuffer)
  • frame (number)

Returns:

    number or nil if out of bounds
get_frame_by_offset (buffer, offset)
get a "OS" offset by position in buffer (NB: this method does not support/detect the Amiga/FT2 compatibility mode)

Parameters:

  • buffer (renoise.SampleBuffer)
  • offset (number), between 0x00 and 0xFF

Returns:

    number or nil if out of bounds
get_frame_by_line (buffer, line, lpb, bpm)
get a buffer position by "line"

Parameters:

  • buffer (renoise.SampleBuffer)
  • line (number) supports fractional values
  • lpb (number) will use song LPB if not defined
  • bpm (number) will use song BPM if not defined

Returns:

    number or nil if out of bounds/no buffer
get_frame_by_beat (buffer, beat, lpb, bpm)
get a buffer position by "beat"

Parameters:

  • buffer (renoise.SampleBuffer)
  • beat (number) supports fractional values
  • lpb (number) will use song LPB if not defined
  • bpm (number) will use song BPM if not defined

Returns:

    number or nil if out of bounds
get_beat_by_frame (buffer, frame, bpm)
get a line by position in buffer

Parameters:

  • buffer (renoise.SampleBuffer)
  • frame (number)
  • bpm (number) will use song BPM if not defined

Returns:

    number or nil if out of bounds
get_line_by_frame (buffer, frame, lpb, bpm)
get a beat by position in buffer

Parameters:

  • buffer (renoise.SampleBuffer)
  • frame (number)
  • lpb (number) will use song LPB if not defined
  • bpm (number) will use song BPM if not defined

Returns:

    number or nil if out of bounds
parse_processing_args (...)
parse processing arguments, provide buffer defaults if undefined note: range is derived from current selection in buffer

Parameters:

  • ... numberofframes (number) numberofchannels (number) selectedchannel (number) selectionstart (number) selection_end (number)

Returns:

    table
create_wave_fn (...)
Processing methods create waveform from waveform/modulator function

Parameters:

  • ... (see parseprocessingargs)
extend (...)
extend sample length (pad with silent frames)

Parameters:

  • ... (see parseprocessingargs)
sweep_ins (...)
insert data in selected channel(s)

Parameters:

  • ... (see parseprocessingargs)
ins_in_all_ch (...)
insert data in all channels

Parameters:

  • ... (see parseprocessingargs)
ins_in_one_ch (...)
insert data in a single channel

Parameters:

  • ... (see parseprocessingargs)
get_frame_generator_fn (fn, ch, mod_fn, buffer, sel_start, range, sel_channel)
return function that can generate frames note: only generate data for the selected channel(s)

Parameters:

  • fn (function)
  • ch (number)
  • mod_fn (function), modulating frequency
  • buffer (renoise.SampleBuffer)
  • sel_start (number)
  • range (number)
  • sel_channel (number)

Returns:

    function
empty_smple (...)
silence entire sample

Parameters:

  • ... (see parseprocessingargs)
trim (...)
trim: delete samples outside selection

Parameters:

  • ... (see parseprocessingargs)
sync_del (...)
delete from selected channel(s) while preserving length

Parameters:

  • ... (see parseprocessingargs)
del_in_all_ch (...)
delete from all channels (see sync_del)

Parameters:

  • ... (see parseprocessingargs)
del_in_one_ch (...)
delete from single channel (see sync_del)

Parameters:

  • ... (see parseprocessingargs)
phase_shift (...)
shift/rotate the specified region

Parameters:

  • ... (see parseprocessingargs)

Returns:

    function
set_fade (...)

Parameters:

  • ... (see parseprocessingargs)
generated by LDoc 1.4.2