Skip to content

Reverbs & Delay FX

Structs

struct Freeverb

A custom implementation of the Freeverb reverb algorithm. Based on Romain Michon's Faust implementation (https://github.com/grame-cncm/faustlibraries/blob/master/reverbs.lib), thus is licensed under LGPL.

Traits: AnyType, Copyable, ImplicitlyDestructible, Movable

Freeverb Parameters

Name Type Default Description
num_chans Int 1 Size of the SIMD vector - defaults to 1.

Freeverb Functions

struct Freeverb . fn init

Initialize the Freeverb struct.

fn init Signature

__init__(out self, world: UnsafePointer[MMMWorld, MutExternalOrigin])

fn init Arguments

Name Type Default Description
world UnsafePointer[MMMWorld, MutExternalOrigin] A pointer to the MMMWorld instance.

fn init Returns : Self

Static Method

This is a static method.

struct Freeverb . fn next

Process one sample through the freeverb.

fn next Signature

next(mut self, input: SIMD[DType.float64, num_chans], room_size: SIMD[DType.float64, num_chans] = 0, lp_comb_lpfreq: SIMD[DType.float64, num_chans] = 1000, added_space: 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.
room_size SIMD[DType.float64, num_chans] 0 The size of the reverb room (0-1).
lp_comb_lpfreq SIMD[DType.float64, num_chans] 1000 The cutoff frequency of the low-pass filter (in Hz).
added_space SIMD[DType.float64, num_chans] 0 The amount of added space (0-1).

fn next Returns : SIMD[DType.float64, num_chans] The processed output sample.

struct DattorroReverb

Dattorro reverb algorithm created by Jon Dattorro in his classic paper "Effect Design Part 1: Reverberator and Other Filters".

Traits: AnyType, Copyable, ImplicitlyDestructible, Movable

DattorroReverb Parameters

Name Type Default Description
interp Int Interp.none The interpolation method to use for the delay lines which are not modulated. Default is none because that is what is used in the original Dattorro paper.

DattorroReverb Functions

struct DattorroReverb . fn init

Initialize the DattorroReverb struct.

fn init Signature

__init__(out self, world: UnsafePointer[MMMWorld, MutExternalOrigin], pre_delay_time: Float64 = 0.02, decay: Float64 = 0.29999999999999999, input_diffusion1: Float64 = 0.75, input_diffusion2: Float64 = 0.625, decay_diffusion1: Float64 = 0.69999999999999996, decay_diffusion2: Float64 = 0.5, bandwidth: Float64 = 0.99950000000000006, damping: Float64 = 5.0000000000000001E-4)

fn init Arguments

Name Type Default Description
world UnsafePointer[MMMWorld, MutExternalOrigin] A pointer to the MMMWorld instance.
pre_delay_time Float64 0.02 The time of the pre-delay in seconds. 0-0.5 seconds.
decay Float64 0.29999999999999999 The decay factor of the reverb (0-1). Larger values will create a longer reverb tail.
input_diffusion1 Float64 0.75 The feedback coefficient for the first two allpass filters in the early reflection stage (0-1).
input_diffusion2 Float64 0.625 The feedback coefficient for the second two allpass filters in the early reflection stage (0-1).
decay_diffusion1 Float64 0.69999999999999996 The feedback coefficient for two allpass filters in the tank (0-1).
decay_diffusion2 Float64 0.5 The feedback coefficient for two allpass filters in the tank (0-1).
bandwidth Float64 0.99950000000000006 The bandwidth of the low-pass filters in the tank (0-1, where 1 is no filtering).
damping Float64 5.0000000000000001E-4 The damping factor of the reverb (0-1, where 0 is no damping).

fn init Returns : Self

Static Method

This is a static method.

struct DattorroReverb . fn set_all

Set all the main parameters of the reverb at once.

fn set_all Signature

set_all(mut self, pre_delay_time: Float64, decay: Float64, input_diffusion1: Float64, input_diffusion2: Float64, decay_diffusion1: Float64, decay_diffusion2: Float64, bandwidth: Float64, damping: Float64)

fn set_all Arguments

Name Type Default Description
pre_delay_time Float64 The time of the pre-delay in seconds. 0-0.5 seconds.
decay Float64 The decay factor of the reverb (0-1).
input_diffusion1 Float64 The diffusion amount for the first two allpass filters in the early reflection stage (0-1).
input_diffusion2 Float64 The diffusion amount for the second two allpass filters in the early reflection stage (0-1).
decay_diffusion1 Float64 The diffusion amount for the first allpass filter in the feedback loop (0-1).
decay_diffusion2 Float64 The diffusion amount for the second allpass filter in the feedback loop (0-1).
bandwidth Float64 The bandwidth of the low-pass filters in the feedback loop (0-1, where 1 is no filtering).
damping Float64 The damping factor of the reverb (0-1, where 0 is no damping).

struct DattorroReverb . fn next

fn next Signature

next(mut self, input: SIMD[DType.float64, 2]) -> SIMD[DType.float64, 2]

fn next Arguments

Name Type Default Description
input SIMD[DType.float64, 2]

fn next Returns : SIMD[DType.float64, 2]

struct Phaser

A phaser effect implemented as a series of allpass filters, with the center frequencies modulated by an LFO.

Traits: AnyType, Copyable, ImplicitlyDestructible, Movable

Phaser Parameters

Name Type Default Description
num_chans Int 1 The number of audio channels to process (e.g. 1 for mono, 2 for stereo).
stages Int 8 The number of allpass filter stages to use in the phaser. More stages will create a more pronounced phasing effect. Usually between 4 and 12..

Phaser Functions

struct Phaser . fn init

Initialize the phaser effect.

fn init Signature

__init__(out self, world: UnsafePointer[MMMWorld, MutExternalOrigin])

fn init Arguments

Name Type Default Description
world UnsafePointer[MMMWorld, MutExternalOrigin] The World instance.

fn init Returns : Self

Static Method

This is a static method.

struct Phaser . fn next

Process the input audio through the phaser effect.

fn next Signature

next(mut self, input: SIMD[DType.float64, num_chans], center_freq: Float64 = 1000, Q: Float64 = 0.69999999999999996, lfo_freq: Float64 = 0.69999999999999996, lfo_octaves: Float64 = 1, freq_offset: Float64 = 0, mix: Float64 = 0.5) -> SIMD[DType.float64, num_chans]

fn next Arguments

Name Type Default Description
input SIMD[DType.float64, num_chans] The input audio signal to process, as an MFloat vector with length equal to num_chans.
center_freq Float64 1000 The base center frequency for the allpass filters, in Hz. This is the frequency around which the phasing effect will occur.
Q Float64 0.69999999999999996 The resonance of the allpass filters.
lfo_freq Float64 0.69999999999999996 The frequency of the LFO that modulates the center frequencies of the allpass filters, in Hz.
lfo_octaves Float64 1 The number of octaves above and below the base center frequency that the LFO will modulate. For example, if center_freq is 1000 Hz and lfo_octaves is 1, then the LFO will modulate between 500 Hz and 2000 Hz.
freq_offset Float64 0 A fixed frequency offset applied to each subsequent allpass stage. For example, if freq_offset is 0.1 and center_freq is 1000 Hz, then the first stage will be centered at 1000 Hz, the second at 1100 Hz, the third at 1200 Hz, etc.
mix Float64 0.5 The wet/dry mix of the effect. A value of 0 means only the original signal (dry), while a value of 1 means only the processed signal (wet). Values in between blend the two signals together.

fn next Returns : SIMD[DType.float64, num_chans]

struct Flanger

A flanger effect implemented as a single comb filter with the delay time modulated by an LFO.

Traits: AnyType, Copyable, ImplicitlyDestructible, Movable

Flanger Parameters

Name Type Default Description
num_chans Int 1 The number of audio channels to process (e.g. 1 for mono, 2 for stereo).
interp Int Interp.lagrange4 The interpolation method to use for the delay line.

Flanger Functions

struct Flanger . fn init

fn init Signature

__init__(out self, world: UnsafePointer[MMMWorld, MutExternalOrigin])

fn init Arguments

Name Type Default Description
world UnsafePointer[MMMWorld, MutExternalOrigin]

fn init Returns : Self

Static Method

This is a static method.

struct Flanger . fn next

Process the input audio through the flanger effect.

fn next Signature

next(mut self, input: SIMD[DType.float64, num_chans], center_freq: Float64, feedback_coef: Float64, lfo_freq: Float64, lfo_octaves: Float64, mix: Float64) -> SIMD[DType.float64, num_chans]

fn next Arguments

Name Type Default Description
input SIMD[DType.float64, num_chans] The input audio signal to process, as an MFloat vector with length equal to num_chans.
center_freq Float64 The base delay time for the comb filter, in milliseconds. This is the delay time around which the flanging effect will occur.
feedback_coef Float64 The feedback coefficient for the comb filter (0-1). Higher values will create a more pronounced flanging effect, but can also lead to self-oscillation if set too high.
lfo_freq Float64 The frequency of the LFO that modulates the delay time of the comb filter, in Hz.
lfo_octaves Float64 The number of octaves above and below the base center frequency that the LFO will modulate. For example, if center_freq is 1000 Hz and lfo_octaves is 1, then the LFO will modulate between 500 Hz and 2000 Hz.
mix Float64 The wet/dry mix of the effect. A value of 0 means only the original signal (dry), while a value of 1 means only the processed signal (wet). Values in between blend the two signals together.

fn next Returns : SIMD[DType.float64, num_chans]


Documentation generated with mojo doc from Mojo version 1.0.0b1