renoise.SampleBuffer

NOTE: All properties are invalid when no sample data is present, 'has_sample_data' returns false:

Constants

Channel

{
    CHANNEL_LEFT: integer = 1,
    CHANNEL_RIGHT: integer = 2,
    CHANNEL_LEFT_AND_RIGHT: integer = 3,
}

Properties

has_sample_data : boolean

READ-ONLY Check this before accessing properties

read_only : boolean

READ-ONLY True, when the sample buffer can only be read, but not be modified. true for sample aliases of sliced samples. To modify such sample buffers, modify the sliced master sample buffer instead.

sample_rate : integer

READ-ONLY The current sample rate in Hz, like 44100.

bit_depth : integer

READ-ONLY The current bit depth, like 32, 16, 8.

number_of_channels : integer

READ-ONLY The integer of sample channels (1 or 2)

number_of_frames : integer

READ-ONLY The sample frame count (integer of samples per channel)

display_start : integer

Range: (1 - number_of_frames)

display_start_observable : renoise.Document.Observable

Track changes to document properties or general states by attaching listener functions to it.

display_length : integer

Range: (1 - number_of_frames)

display_length_observable : renoise.Document.Observable

Track changes to document properties or general states by attaching listener functions to it.

display_range : integer[]

Range: (1 - number_of_frames)

display_range_observable : renoise.Document.Observable

Track changes to document properties or general states by attaching listener functions to it.

vertical_zoom_factor : number

Range(0.0-1.0)

vertical_zoom_factor_observable : renoise.Document.Observable

Track changes to document properties or general states by attaching listener functions to it.

selection_start : integer

Range: (1 - number_of_frames)

selection_start_observable : renoise.Document.Observable

Track changes to document properties or general states by attaching listener functions to it.

selection_end : integer

Range: (1 - number_of_frames)

selection_end_observable : renoise.Document.Observable

Track changes to document properties or general states by attaching listener functions to it.

selection_range : integer[]

Range: (1 - number_of_frames)

selection_range_observable : renoise.Document.Observable

Track changes to document properties or general states by attaching listener functions to it.

selected_channel : renoise.SampleBuffer.Channel

The selected channel.

selected_channel_observable : renoise.Document.Observable

Track changes to document properties or general states by attaching listener functions to it.


Functions

create_sample_data(self, sample_rate : integer, bit_depth : integer, num_channels : integer, num_frames : integer)

->success : boolean

Create new sample data with the given rate, bit-depth, channel and frame count. Will trash existing sample data. Initial buffer is all zero. Will only return false when memory allocation fails (you're running out of memory). All other errors are fired as usual.

delete_sample_data(self)

Delete existing sample data.

sample_data(self, channel_index : integer, frame_index : integer)

->values : number[]

Read access to samples in a sample data buffer.

set_sample_data(self, channel_index : integer, frame_index : integer, sample_value : integer)

Write access to samples in a sample data buffer. New samples values must be within [-1, 1] and will be clipped automatically. Sample buffers may be read-only (see property 'read_only'). Attempts to write on such buffers will result into errors. IMPORTANT: before modifying buffers, call 'prepare_sample_data_changes'. When you are done, call 'finalize_sample_data_changes' to generate undo/redo data for your changes and update sample overview caches!

prepare_sample_data_changes(self)

To be called once BEFORE sample data gets manipulated via 'set_sample_data'. This will prepare undo/redo data for the whole sample. See also 'finalize_sample_data_changes'.

finalize_sample_data_changes(self)

To be called once AFTER the sample data is manipulated via 'set_sample_data'. This will create undo/redo data for the whole sample, and also update the sample view caches for the sample. The reason this isn't automatically invoked is to avoid performance overhead when changing sample data 'sample by sample'. Don't forget to call this after any data changes, or changes may not be visible in the GUI and can not be un/redone!

load_from(self, filename : string)

->success : boolean

Load sample data from a file. Files can be any audio format Renoise supports. Possible errors are shown to the user, otherwise success is returned.

save_as(self, filename : string, format : SampleBuffer.ExportType)

->success : boolean

Export sample data to a file. Possible errors are shown to the user, otherwise success is returned.

format:
    | "wav"
    | "flac"

Local Aliases

SampleBuffer.ExportType

"flac" | "wav"

SampleBuffer.ExportType:
    | "wav"
    | "flac"