Skip to content

Recorder

Structs

struct Recorder

A struct for storing a buffer and recording audio into it.

Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility

Recorder Parameters

Name Type Default Description
num_chans Int 1 The number of channels in the buffer. Default is 1 (mono).

Recorder Functions

struct Recorder . fn init

Initialize the Recorder struct.

fn init Signature

__init__(out self, world: UnsafePointer[MMMWorld], num_frames: Int64, sample_rate: Float64)

fn init Arguments

Name Type Default Description
world UnsafePointer A pointer to the MMMWorld instance.
num_frames Int64 The number of frames in the empty buffer to be recorded to.
sample_rate Float64 The sample rate of the empty buffer.

fn init Returns : Self

Static Method

This is a static method.

struct Recorder . fn replace_buffer

Replace the internal buffer with a new buffer. The new buffer must have the same number of channels as the existing buffer. Write head is reset to 0.

fn replace_buffer Signature

replace_buffer(mut self, new_buf: Buffer)

fn replace_buffer Arguments

Name Type Default Description
new_buf Buffer The new buffer to replace the existing buffer with.

struct Recorder . fn write

Write SIMD input to buffer at specified index. Used internally by write_next and write_previous, which will be more appropriate for most use cases.

fn write Signature

write(mut self, input: SIMD[DType.float64, num_chans], index: Int64)

fn write Arguments

Name Type Default Description
input SIMD The SIMD input to write to the buffer.
index Int64 The index in the buffer to write the input to.

struct Recorder . fn write_next

Write SIMD input to buffer at current write head and advance write head forward. This is the correct option in most use cases.

fn write_next Signature

write_next(mut self, value: SIMD[DType.float64, num_chans])

fn write_next Arguments

Name Type Default Description
value SIMD The SIMD input to write to the buffer.

struct Recorder . fn write_previous

Write SIMD input to buffer at current write head and move write head backward. This is useful for things like delay lines, which write backwards through a buffer so they can interpolate forwards.

fn write_previous Signature

write_previous(mut self, value: SIMD[DType.float64, num_chans])

fn write_previous Arguments

Name Type Default Description
value SIMD The SIMD input to write to the buffer.

Documentation generated with mojo doc from Mojo version 0.25.6.1