Delays
trait Tapable¶
Tapable Required Methods¶
trait Tapable . fn init¶
Create a new instance of the value by copying an existing one.
Signature
Arguments
- copy:
_Self- The value to copy. Returns
Type: _Self
Create a new instance of the value by moving the value of another.
Signature
Arguments
- move:
_Self- The value to move. Returns
Type: _Self
struct Delay¶
A variable delay line with interpolation.
Traits: AnyType, Copyable, ImplicitlyDeletable, Movable, PolyReset, Tapable
Delay Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
Size of the SIMD vector - defaults to 1. |
| interp | Interp |
Interp.linear |
The interpolation method to use. See the struct Interp for interpolation options. |
Delay Functions¶
struct Delay . fn init¶
Initialize the Delay line.
fn init Signature
def __init__(out self, world: UnsafePointer[MMMWorld, MutUntrackedOrigin], max_delay_time: Float64 = 1)
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer[MMMWorld, MutUntrackedOrigin] |
— | A pointer to the MMMWorld. |
| max_delay_time | Float64 |
1 |
The maximum delay time in seconds. The internal buffer will be allocated to accommodate this delay. |
fn init Returns
: Self
Static Method
This is a static method.
struct Delay . fn init¶
Initialize the Delay line.
fn init Signature
def __init__(out self, world: UnsafePointer[MMMWorld, MutUntrackedOrigin], max_delay_samples: Int = 1024)
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer[MMMWorld, MutUntrackedOrigin] |
— | A pointer to the MMMWorld. |
| max_delay_samples | Int |
1024 |
The maximum delay time in samples. The internal buffer will be allocated to accommodate this delay. |
fn init Returns
: Self
Static Method
This is a static method.
struct Delay . fn tap¶
fn tap Signature
fn tap Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| N | Int |
— | — |
fn tap Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| delay_samps | SIMD[DType.int, N] |
— | — |
fn tap Returns
: SIMD[DType.float64, num_chans]
struct Delay . fn tap¶
fn tap Signature
fn tap Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| N | Int |
— | — |
fn tap Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| delay_time | SIMD[DType.float64, N] |
— | — |
fn tap Returns
: SIMD[DType.float64, num_chans]
struct Delay . fn read¶
Reads into the delay line at an exact sample delay and no interpolation.
fn read Signature
fn read Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| N | Int |
— | Size of the delay_samps SIMD vector. |
fn read Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| delay_samps | SIMD[DType.int, N] |
— | The amount of delay to apply (in samples). |
fn read Returns
: SIMD[DType.float64, num_chans]
A single sample read from the delay buffer with no interpolation. Use a float lookup for fractional delay with interpolation.
struct Delay . fn read¶
Reads into the delay line.
fn read Signature
def read[N: Int](mut self, var delay_time: SIMD[DType.float64, N]) -> SIMD[DType.float64, num_chans]
fn read Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| N | Int |
— | Size of the delay_time SIMD vector. |
fn read Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| delay_time | SIMD[DType.float64, N] |
— | The amount of delay to apply (in seconds). |
fn read Returns
: SIMD[DType.float64, num_chans]
A single sample read from the delay buffer.
struct Delay . fn write¶
Writes a single sample into the delay line.
fn write Signature
fn write Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD[DType.float64, num_chans] |
— | The input sample to store in the delay buffer. |
struct Delay . fn next¶
Process one sample through the delay line, first reading from the delay then writing into it. This version uses an integer lookup into the delay line and no interpolation.
fn next Signature
def next[N: Int](mut self, input: SIMD[DType.float64, num_chans], delay_samps: SIMD[DType.int, N]) -> SIMD[DType.float64, num_chans]
fn next Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| N | Int |
— | Number of channels. |
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD[DType.float64, num_chans] |
— | The input sample to process. |
| delay_samps | SIMD[DType.int, N] |
— | The amount of delay to apply (in samples). |
fn next Returns
: SIMD[DType.float64, num_chans]
The processed output sample.
struct Delay . fn next¶
Process one sample through the delay line, first reading from the delay then writing into it.
fn next Signature
def next[N: Int](mut self, input: SIMD[DType.float64, num_chans], var delay_time: SIMD[DType.float64, N]) -> SIMD[DType.float64, num_chans]
fn next Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| N | Int |
— | Number of channels. |
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD[DType.float64, num_chans] |
— | The input sample to process. |
| delay_time | SIMD[DType.float64, N] |
— | The amount of delay to apply (in seconds). |
fn next Returns
: SIMD[DType.float64, num_chans]
The processed output sample.
struct Delay . fn reset¶
Reset the delay line to its initial state. This will clear the internal buffer and reset the write head.
fn reset Signature
struct Delay . fn get_phase¶
Calculate the fractional index in the delay buffer for the given delay time.
fn get_phase Signature
fn get_phase Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| delay_time | Float64 |
— | The delay time in seconds. |
fn get_phase Returns
: Float64
The fractional index in the delay buffer.
struct Comb¶
A simple comb filter using a delay line with feedback.
Traits: AnyType, Copyable, ImplicitlyDeletable, Movable, PolyReset, Tapable
Comb Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
Size of the SIMD vector. |
| interp | Interp |
Interp.quad |
The interpolation method to use. See the struct Interp for interpolation options. |
Comb Functions¶
struct Comb . fn init¶
Initialize the Comb filter.
fn init Signature
def __init__(out self, world: UnsafePointer[MMMWorld, MutUntrackedOrigin], max_delay_time: Float64 = 1)
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer[MMMWorld, MutUntrackedOrigin] |
— | A pointer to the MMMWorld. |
| max_delay_time | Float64 |
1 |
The maximum delay time in seconds. The internal buffer will be allocated to accommodate this delay. |
fn init Returns
: Self
Static Method
This is a static method.
struct Comb . fn tap¶
fn tap Signature
fn tap Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| delay_samps | SIMD[DType.int, num_chans] |
— | — |
fn tap Returns
: SIMD[DType.float64, num_chans]
struct Comb . fn tap¶
fn tap Signature
fn tap Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| delay_time | SIMD[DType.float64, num_chans] |
— | — |
fn tap Returns
: SIMD[DType.float64, num_chans]
struct Comb . fn reset¶
Reset the Comb filter to its initial state. This will clear the internal buffer and reset the feedback.
fn reset Signature
struct Comb . fn next¶
Process one sample through the comb filter.
fn next Signature
def next(mut self, input: SIMD[DType.float64, num_chans], delay_time: SIMD[DType.float64, num_chans] = 0, feedback: SIMD[DType.float64, num_chans] = 0) -> SIMD[DType.float64, num_chans]
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD[DType.float64, num_chans] |
— | The input sample to process. |
| delay_time | SIMD[DType.float64, num_chans] |
0 |
The amount of delay to apply (in seconds). |
| feedback | SIMD[DType.float64, num_chans] |
0 |
The amount of feedback to apply (-1.0 to 1.0). |
fn next Returns
: SIMD[DType.float64, num_chans]
The delayed output sample.
struct Comb . fn next_decaytime¶
Process one sample through the comb filter with decay time calculation.
fn next_decaytime Signature
def next_decaytime(mut self, input: SIMD[DType.float64, num_chans], delay_time: SIMD[DType.float64, num_chans], decay_time: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn next_decaytime Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD[DType.float64, num_chans] |
— | The input sample to process. |
| delay_time | SIMD[DType.float64, num_chans] |
— | The amount of delay to apply (in seconds). |
| decay_time | SIMD[DType.float64, num_chans] |
— | The desired decay time (time to -60dB). Feedback is calculated internally. |
fn next_decaytime Returns
: SIMD[DType.float64, num_chans]
The delayed output sample.
struct LP_Comb¶
A simple comb filter with an integrated one-pole low-pass filter.
Traits: AnyType, Copyable, ImplicitlyDeletable, Movable, PolyReset, Tapable
LP_Comb Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
Size of the SIMD vector - defaults to 1. |
| interp | Interp |
Interp.linear |
The interpolation method to use. See the struct Interp for interpolation options. |
LP_Comb Functions¶
struct LP_Comb . fn init¶
Initialize the LP_Comb filter.
fn init Signature
def __init__(out self, world: UnsafePointer[MMMWorld, MutUntrackedOrigin], max_delay_time: Float64 = 1)
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer[MMMWorld, MutUntrackedOrigin] |
— | A pointer to the MMMWorld. |
| max_delay_time | Float64 |
1 |
The maximum delay time in seconds. The internal buffer will be allocated to accommodate this delay. |
fn init Returns
: Self
Static Method
This is a static method.
struct LP_Comb . fn tap¶
fn tap Signature
fn tap Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| delay_samps | SIMD[DType.int, num_chans] |
— | — |
fn tap Returns
: SIMD[DType.float64, num_chans]
struct LP_Comb . fn tap¶
fn tap Signature
fn tap Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| delay_time | SIMD[DType.float64, num_chans] |
— | — |
fn tap Returns
: SIMD[DType.float64, num_chans]
struct LP_Comb . fn next¶
Process one sample through the comb filter.
fn next Signature
def next(mut self, input: SIMD[DType.float64, num_chans], delay_time: SIMD[DType.float64, num_chans] = 0, feedback: SIMD[DType.float64, num_chans] = 0, lp_freq: SIMD[DType.float64, num_chans] = 0) -> SIMD[DType.float64, num_chans]
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD[DType.float64, num_chans] |
— | The input sample to process. |
| delay_time | SIMD[DType.float64, num_chans] |
0 |
The amount of delay to apply (in seconds). |
| feedback | SIMD[DType.float64, num_chans] |
0 |
The amount of feedback to apply (-1.0 to 1.0). |
| lp_freq | SIMD[DType.float64, num_chans] |
0 |
The cutoff frequency of the OnePole filter in the feedback loop. |
fn next Returns
: SIMD[DType.float64, num_chans]
The processed output sample.
struct LP_Comb . fn reset¶
Reset the LP_Comb filter to its initial state. This will clear the internal buffer and reset the feedback.
fn reset Signature
struct Allpass¶
A simple allpass filter using a delay line with feedback.
Traits: AnyType, Copyable, ImplicitlyDeletable, Movable, PolyReset, Tapable
Allpass Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
Size of the SIMD vector. |
| interp | Interp |
Interp.linear |
The interpolation method to use. See the struct Interp for interpolation options. |
Allpass Functions¶
struct Allpass . fn init¶
Initialize the Allpass filter.
fn init Signature
def __init__(out self, world: UnsafePointer[MMMWorld, MutUntrackedOrigin], max_delay_time: Float64 = 1)
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer[MMMWorld, MutUntrackedOrigin] |
— | A pointer to the MMMWorld. |
| max_delay_time | Float64 |
1 |
The maximum delay time in seconds. The internal buffer will be allocated to accommodate this delay. |
fn init Returns
: Self
Static Method
This is a static method.
struct Allpass . fn tap¶
fn tap Signature
fn tap Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| delay_samps | SIMD[DType.int, num_chans] |
— | — |
fn tap Returns
: SIMD[DType.float64, num_chans]
struct Allpass . fn tap¶
fn tap Signature
fn tap Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| delay_time | SIMD[DType.float64, num_chans] |
— | — |
fn tap Returns
: SIMD[DType.float64, num_chans]
struct Allpass . fn next¶
Process one sample through the allpass filter. Uses a direct-form 1 structure.
fn next Signature
def next(mut self, input: SIMD[DType.float64, num_chans], delay_time: SIMD[DType.float64, num_chans] = 0, feedback_coef: SIMD[DType.float64, num_chans] = 0) -> SIMD[DType.float64, num_chans]
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD[DType.float64, num_chans] |
— | The input sample to process. |
| delay_time | SIMD[DType.float64, num_chans] |
0 |
The amount of delay to apply (in seconds). |
| feedback_coef | SIMD[DType.float64, num_chans] |
0 |
The feedback coefficient (-1.0 to 1.0). |
fn next Returns
: SIMD[DType.float64, num_chans]
The delayed/filtered output sample.
struct Allpass . fn next_df2¶
Process one sample through the allpass filter using a direct-form 2 structure.
fn next_df2 Signature
def next_df2(mut self, input: SIMD[DType.float64, num_chans], delay_time: SIMD[DType.float64, num_chans] = 0, feedback_coef: SIMD[DType.float64, num_chans] = 0) -> SIMD[DType.float64, num_chans]
fn next_df2 Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD[DType.float64, num_chans] |
— | The input sample to process. |
| delay_time | SIMD[DType.float64, num_chans] |
0 |
The amount of delay to apply (in seconds). |
| feedback_coef | SIMD[DType.float64, num_chans] |
0 |
The feedback coefficient. |
fn next_df2 Returns
: SIMD[DType.float64, num_chans]
The delayed and phase-rotated output sample.
struct Allpass . fn next_decaytime¶
Process one sample through the allpass filter with decay time calculation.
fn next_decaytime Signature
def next_decaytime(mut self, input: SIMD[DType.float64, num_chans], delay_time: SIMD[DType.float64, num_chans], decay_time: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn next_decaytime Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD[DType.float64, num_chans] |
— | The input sample to process. |
| delay_time | SIMD[DType.float64, num_chans] |
— | The amount of delay to apply (in seconds). |
| decay_time | SIMD[DType.float64, num_chans] |
— | The desired decay time (time to -60dB). |
fn next_decaytime Returns
: SIMD[DType.float64, num_chans]
The delayed output sample with feedback derived from decay time.
struct Allpass . fn reset¶
Reset the allpass filter to its initial state. This will clear the internal buffer.
fn reset Signature
struct FB_Delay¶
A feedback delay structured like a Comb filter, but with possible feedback coefficient above 1 due to an integrated tanh function.
By default, Anti-aliasing is disabled and no oversampling is applied, but this can be changed by setting the ADAA_dist and ov_samp template parameters.
Traits: AnyType, Copyable, ImplicitlyDeletable, Movable, PolyReset, Tapable
FB_Delay Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
Size of the SIMD vector. |
| interp | Interp |
Interp.lagrange4 |
The interpolation method to use. See the struct Interp for interpolation options. |
| ADAA_dist | Bool |
False |
Whether to apply ADAA distortion to the feedback signal instead of standard tanh. |
| ov_samp | TimesOversampling |
TimesOversampling.none |
The TimesOversampling for ADAA distortion. |
FB_Delay Functions¶
struct FB_Delay . fn init¶
Initialize the FB_Delay.
fn init Signature
def __init__(out self, world: UnsafePointer[MMMWorld, MutUntrackedOrigin], max_delay_time: Float64 = 1)
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer[MMMWorld, MutUntrackedOrigin] |
— | A pointer to the MMMWorld. |
| max_delay_time | Float64 |
1 |
The maximum delay time in seconds. The internal buffer will be allocated to accommodate this delay. |
fn init Returns
: Self
Static Method
This is a static method.
struct FB_Delay . fn tap¶
fn tap Signature
fn tap Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| delay_samps | SIMD[DType.int, num_chans] |
— | — |
fn tap Returns
: SIMD[DType.float64, num_chans]
struct FB_Delay . fn tap¶
fn tap Signature
fn tap Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| delay_time | SIMD[DType.float64, num_chans] |
— | — |
fn tap Returns
: SIMD[DType.float64, num_chans]
struct FB_Delay . fn reset¶
Reset the FB_Delay to its initial state. This will clear the internal buffer and reset the feedback.
fn reset Signature
struct FB_Delay . fn next¶
Process one sample or SIMD vector through the feedback delay.
fn next Signature
def next(mut self, input: SIMD[DType.float64, num_chans], delay_time: SIMD[DType.float64, num_chans], feedback: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD[DType.float64, num_chans] |
— | The input sample to process. |
| delay_time | SIMD[DType.float64, num_chans] |
— | The amount of delay to apply (in seconds). |
| feedback | SIMD[DType.float64, num_chans] |
— | The amount of feedback to apply (0.0 to 1.0). |
fn next Returns
: SIMD[DType.float64, num_chans]
The processed output sample or SIMD vector.
(Functions that are not associated with a Struct)
fn calc_feedback¶
Calculate the feedback coefficient for a Comb filter or Allpass line based on desired delay time and decay time.
Signature
def calc_feedback[num_chans: Int = 1](delaytime: SIMD[DType.float64, num_chans], decaytime: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
Parameters
| Name | Type | Description |
|---|---|---|
| num_chans | Int |
Number of channels. |
Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| delaytime | SIMD[DType.float64, num_chans] |
— | The delay time in seconds. |
| decaytime | SIMD[DType.float64, num_chans] |
— | The decay time in seconds (time to -60dB). |
Returns
Type: SIMD[DType.float64, num_chans]
The feedback coefficient for the requested delay and decay times.
Documentation generated with mojo doc from Mojo version 1.0.0b2