Oversampling
struct Oversampling¶
A struct that collects times_oversampling samples and then downsamples them using a low-pass filter. Add a sample for each oversampling iteration with add_sample(), then get the downsampled output with get_sample().
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
Oversampling Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
Number of channels for the oversampling buffer. |
| times_oversampling | Int |
0 |
The oversampling factor (e.g., 2 for 2x oversampling). |
Oversampling Functions¶
struct Oversampling . fn init¶
Args: world: Pointer to the MMMWorld instance.
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | — |
fn init Returns
: Self
Static Method
This is a static method.
struct Oversampling . fn add_sample¶
Add a sample to the oversampling buffer.
fn add_sample Signature
fn add_sample Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| sample | SIMD |
— | The sample to add to the buffer. |
struct Oversampling . fn get_sample¶
Get the next sample from a filled oversampling buffer.
fn get_sample Signature
fn get_sample Returns
: SIMD
struct Upsampler¶
A struct that upsamples the input signal by the specified factor using a low-pass filter.
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
Upsampler Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
Number of channels for the upsampler. |
| times_oversampling | Int |
1 |
The oversampling factor (e.g., 2 for 2x oversampling). |
Upsampler Functions¶
struct Upsampler . fn init¶
Args: world: Pointer to the MMMWorld instance.
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | — |
fn init Returns
: Self
Static Method
This is a static method.
struct Upsampler . fn next¶
Process one sample through the upsampler. Pass in the same sample times_oversampling times, once for each oversampling iteration. The algorithm will use the first sample given and fill the buffer with zeroes for the subsequent samples.
fn next Signature
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input signal to process. |
| i | Int |
— | The iterator for the oversampling loop. Should range from 0 to (times_oversampling - 1). |
fn next Returns
: SIMD
The next sample of the upsampled output.
struct OS_LPF¶
A simple 2nd-order low-pass filter for oversampling applications. Does not allow changing cutoff frequency on the fly to avoid that calculation each sample.
Traits: AnyType, Copyable, Movable, UnknownDestructibility
OS_LPF Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
Number of channels for the filter. |
OS_LPF Functions¶
struct OS_LPF . fn init¶
Args: world: Pointer to the MMMWorld instance.
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | — |
fn init Returns
: Self
Static Method
This is a static method.
struct OS_LPF . fn set_sample_rate¶
Set the sample rate for the filter.
fn set_sample_rate Signature
fn set_sample_rate Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| sr | Float64 |
— | The sample rate in Hz. |
struct OS_LPF . fn set_cutoff¶
Set the cutoff frequency for the low-pass filter.
fn set_cutoff Signature
fn set_cutoff Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| fc | Float64 |
— | The cutoff frequency in Hz. |
struct OS_LPF . fn next¶
Process one sample through the 2nd-order low-pass filter.
fn next Signature
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| x | SIMD |
— | The input signal to process. |
fn next Returns
: SIMD
struct OS_LPF4¶
A 4th-order low-pass filter for oversampling applications, implemented as two cascaded 2nd-order sections.
Traits: AnyType, Copyable, Movable, UnknownDestructibility
OS_LPF4 Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
Number of channels for the filter with fixed cutoff frequency. |
OS_LPF4 Functions¶
struct OS_LPF4 . fn init¶
Args: world: Pointer to the MMMWorld instance.
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | — |
fn init Returns
: Self
Static Method
This is a static method.
struct OS_LPF4 . fn set_sample_rate¶
fn set_sample_rate Signature
fn set_sample_rate Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| sr | Float64 |
— | — |
struct OS_LPF4 . fn set_cutoff¶
fn set_cutoff Signature
fn set_cutoff Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| fc | Float64 |
— | — |
struct OS_LPF4 . fn next¶
Process one sample through the 4th-order low-pass filter with fixed cutoff frequency.
fn next Signature
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| x | SIMD |
— | The input signal to process. |
fn next Returns
: SIMD
Documentation generated with mojo doc from Mojo version 0.25.6.1