Skip to content

Delays

Traits

trait Tapable

Structs

struct Delay

A variable delay line with interpolation.

Traits: AnyType, Copyable, ImplicitlyDestructible, Movable, Tapable

Delay Parameters

Name Type Default Description
num_chans Int 1 Size of the SIMD vector - defaults to 1.
interp Int 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

__init__(out self, world: UnsafePointer[MMMWorld, MutExternalOrigin], max_delay_time: Float64 = 1)

fn init Arguments

Name Type Default Description
world UnsafePointer 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

__init__(out self, world: UnsafePointer[MMMWorld, MutExternalOrigin], max_delay_samples: Int = 1024)

fn init Arguments

Name Type Default Description
world UnsafePointer 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

tap[N: Int](mut self, var delay_samps: SIMD[DType.index, N]) -> SIMD[DType.float64, num_chans]

fn tap Parameters

Name Type Default Description
N Int

fn tap Arguments

Name Type Default Description
delay_samps SIMD

fn tap Returns : SIMD

struct Delay . fn tap

fn tap Signature

tap[N: Int](mut self, var delay_time: SIMD[DType.float64, N]) -> SIMD[DType.float64, num_chans]

fn tap Parameters

Name Type Default Description
N Int

fn tap Arguments

Name Type Default Description
delay_time SIMD

fn tap Returns : SIMD

struct Delay . fn read

Reads into the delay line at an exact sample delay and no interpolation.

fn read Signature

read[N: Int](mut self, var delay_samps: SIMD[DType.index, N]) -> SIMD[DType.float64, num_chans]

fn read Parameters

Name Type Default Description
N Int

fn read Arguments

Name Type Default Description
delay_samps SIMD The amount of delay to apply (in samples).

fn read Returns : SIMD 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

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

fn read Arguments

Name Type Default Description
delay_time SIMD The amount of delay to apply (in seconds).

fn read Returns : SIMD A single sample read from the delay buffer.

struct Delay . fn write

Writes a single sampleinto the delay line.

fn write Signature

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

fn write Arguments

Name Type Default Description
input SIMD

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

next[N: Int](mut self, input: SIMD[DType.float64, num_chans], delay_samps: SIMD[DType.index, N]) -> SIMD[DType.float64, num_chans]

fn next Parameters

Name Type Default Description
N Int

fn next Arguments

Name Type Default Description
input SIMD The input sample to process.
delay_samps SIMD The amount of delay to apply (in samples).

fn next Returns : SIMD 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

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

fn next Arguments

Name Type Default Description
input SIMD The input sample to process.
delay_time SIMD The amount of delay to apply (in seconds).

fn next Returns : SIMD The processed output sample.

struct Delay . fn zero

Utility function to reset the delay line buffer to zero. Can be useful to avoid unwanted noise when changing delay times or for testing.

fn zero Signature

zero(mut self)

struct Delay . fn get_f_idx

Calculate the fractional index in the delay buffer for the given delay time.

fn get_f_idx Signature

get_f_idx(self, delay_time: Float64) -> Float64

fn get_f_idx Arguments

Name Type Default Description
delay_time Float64 The delay time in seconds.

fn get_f_idx Returns : Float64 The fractional index in the delay buffer.

struct Comb

A simple comb filter using a delay line with feedback.

Traits: AnyType, Copyable, ImplicitlyDestructible, Movable, Tapable

Comb Parameters

Name Type Default Description
num_chans Int 1 Size of the SIMD vector.
interp Int 2 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

__init__(out self, world: UnsafePointer[MMMWorld, MutExternalOrigin], max_delay_time: Float64 = 1)

fn init Arguments

Name Type Default Description
world UnsafePointer 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

tap(mut self, delay_samps: SIMD[DType.index, num_chans]) -> SIMD[DType.float64, num_chans]

fn tap Arguments

Name Type Default Description
delay_samps SIMD

fn tap Returns : SIMD

struct Comb . fn tap

fn tap Signature

tap(mut self, delay_time: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]

fn tap Arguments

Name Type Default Description
delay_time SIMD

fn tap Returns : SIMD

struct Comb . fn next

Process one sample through the comb filter.

fn next Signature

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 The input sample to process.
delay_time SIMD 0 The amount of delay to apply (in seconds).
feedback SIMD 0 The amount of feedback to apply (-1.0 to 1.0).

fn next Returns : SIMD The delayed output sample.

struct Comb . fn next_decaytime

Process one sample through the comb filter with decay time calculation.

fn next_decaytime Signature

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 The input sample to process.
delay_time SIMD The amount of delay to apply (in seconds).
decay_time SIMD The desired decay time (time to -60dB). Feedback is calculated internally.

fn next_decaytime Returns : SIMD The delayed output sample.

struct LP_Comb

A simple comb filter with an integrated one-pole low-pass filter.

Traits: AnyType, Copyable, ImplicitlyDestructible, Movable, Tapable

LP_Comb Parameters

Name Type Default Description
num_chans Int 1 Size of the SIMD vector - defaults to 1.
interp Int 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

__init__(out self, world: UnsafePointer[MMMWorld, MutExternalOrigin], max_delay_time: Float64 = 1)

fn init Arguments

Name Type Default Description
world UnsafePointer 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

tap(mut self, delay_samps: SIMD[DType.index, num_chans]) -> SIMD[DType.float64, num_chans]

fn tap Arguments

Name Type Default Description
delay_samps SIMD

fn tap Returns : SIMD

struct LP_Comb . fn tap

fn tap Signature

tap(mut self, delay_time: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]

fn tap Arguments

Name Type Default Description
delay_time SIMD

fn tap Returns : SIMD

struct LP_Comb . fn next

Process one sample through the comb filter.

fn next Signature

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 The input sample to process.
delay_time SIMD 0 The amount of delay to apply (in seconds).
feedback SIMD 0 The amount of feedback to apply (-1.0 to 1.0).
lp_freq SIMD 0 The cutoff frequency of the OnePole filter in the feedback loop.

fn next Returns : SIMD The processed output sample.

struct Allpass

A simple allpass filter using a delay line with feedback.

Traits: AnyType, Copyable, ImplicitlyDestructible, Movable, Tapable

Allpass Parameters

Name Type Default Description
num_chans Int 1 Size of the SIMD vector.
interp Int 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

__init__(out self, world: UnsafePointer[MMMWorld, MutExternalOrigin], max_delay_time: Float64 = 1)

fn init Arguments

Name Type Default Description
world UnsafePointer 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

tap(mut self, delay_samps: SIMD[DType.index, num_chans]) -> SIMD[DType.float64, num_chans]

fn tap Arguments

Name Type Default Description
delay_samps SIMD

fn tap Returns : SIMD

struct Allpass . fn tap

fn tap Signature

tap(mut self, delay_time: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]

fn tap Arguments

Name Type Default Description
delay_time SIMD

fn tap Returns : SIMD

struct Allpass . fn next

Process one sample through the allpass filter. Uses a direct-form 1 structure.

fn next Signature

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 The input sample to process.
delay_time SIMD 0 The amount of delay to apply (in seconds).
feedback_coef SIMD 0 The feedback coefficient (-1.0 to 1.0).

fn next Returns : SIMD 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

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
delay_time SIMD 0
feedback_coef SIMD 0

fn next_df2 Returns : SIMD

struct Allpass . fn next_decaytime

Process one sample through the allpass filter with decay time calculation.

fn next_decaytime Signature

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 The input sample to process.
delay_time SIMD The amount of delay to apply (in seconds).
decay_time SIMD The desired decay time (time to -60dB).

fn next_decaytime Returns : SIMD

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-comptimeing is disabled and no oversampling is applied, but this can be changed by setting the ADAA_dist and os_index template parameters.

Traits: AnyType, Copyable, ImplicitlyDestructible, Movable, Tapable

FB_Delay Parameters

Name Type Default Description
num_chans Int 1 Size of the SIMD vector.
interp Int 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.
os_index Int 0 The oversampling index for ADAA distortion. 0 = no oversampling, 1 = 2x, 2 = 4x, 3 = 8x, 4 = 16x.

FB_Delay Functions

struct FB_Delay . fn init

Initialize the FB_Delay.

fn init Signature

__init__(out self, world: UnsafePointer[MMMWorld, MutExternalOrigin], max_delay_time: Float64 = 1)

fn init Arguments

Name Type Default Description
world UnsafePointer 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

tap(mut self, delay_samps: SIMD[DType.index, num_chans]) -> SIMD[DType.float64, num_chans]

fn tap Arguments

Name Type Default Description
delay_samps SIMD

fn tap Returns : SIMD

struct FB_Delay . fn tap

fn tap Signature

tap(mut self, delay_time: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]

fn tap Arguments

Name Type Default Description
delay_time SIMD

fn tap Returns : SIMD

struct FB_Delay . fn next

Process one sample or SIMD vector through the feedback delay.

fn next Signature

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 The input sample to process.
delay_time SIMD The amount of delay to apply (in seconds).
feedback SIMD The amount of feedback to apply (0.0 to 1.0).

fn next Returns : SIMD The processed output sample or SIMD vector.

Functions

(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

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 Size of the SIMD vector - defaults to 1.

Arguments

Name Type Default Description
delaytime SIMD The delay time in seconds.
decaytime SIMD The decay time in seconds (time to -60dB).

Returns

Type: SIMD


Documentation generated with mojo doc from Mojo version 0.26.1.0