Recorder
struct Recorder¶
A struct for storing a buffer and recording audio into it.
Traits: AnyType, Copyable, ImplicitlyDestructible, Movable, Representable
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, MutExternalOrigin], num_frames: Int, sample_rate: Float64)
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | A pointer to the MMMWorld instance. |
| num_frames | Int |
— | 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
fn replace_buffer Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| new_buf | SIMDBuffer |
— | The new buffer to replace the existing buffer with. |
struct Recorder . fn zero_buffer¶
Utility function to set all samples in the buffer to zero. Can be useful to clear the buffer for a new recording without having to create a new Recorder instance.
fn zero_buffer Signature
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
fn write Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The SIMD input to write to the buffer. |
| index | Int |
— | 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.
Params:
loop: Whether to loop the write head back to the beginning of the buffer when it reaches the end. Default is True.
fn write_next Signature
fn write_next Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| loop | Bool |
True |
— |
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
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.26.1.0