Skip to content

Distortion

Structs

struct Latch

A simple latch that holds the last input sample when a trigger is received.

Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility

Latch Parameters

Name Type Default Description
num_chans Int 1 The number of channels for SIMD operations.

Latch Functions

struct Latch . fn init

Initialize the Latch.

fn init Signature

__init__(out self)

fn init Returns : Self

Static Method

This is a static method.

struct Latch . fn next

Process the input sample and trigger, returning the latched output sample.

fn next Signature

next(mut self, in_samp: SIMD[DType.float64, num_chans], trig: SIMD[DType.bool, num_chans]) -> SIMD[DType.float64, num_chans]

fn next Arguments

Name Type Default Description
in_samp SIMD The input sample to be latched.
trig SIMD A boolean trigger signal. When switching from false to true, the latch updates its output to the current input sample.

fn next Returns : SIMD

struct SoftClipAD

Anti-Derivative Anti-Aliasing soft-clipping function.

This struct provides first order anti-aliased soft clip function using the Anti-Derivative Anti-Aliasing (ADAA) with optional Oversampling. See Practical Considerations for Antiderivative Anti-Aliasing (Chowdhury) for more details on how this works.

Traits: AnyType, Copyable, Movable, UnknownDestructibility

SoftClipAD Parameters

Name Type Default Description
num_chans Int 1 The number of channels for SIMD operations.
os_index Int 0 The oversampling index (0 = no oversampling, 1 = 2x, 2 = 4x, 3 = 8x, 4 = 16x).
degree Int 3 The degree of the soft clipping polynomial (must be odd).

SoftClipAD Functions

struct SoftClipAD . fn init

fn init Signature

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

fn init Arguments

Name Type Default Description
world UnsafePointer

fn init Returns : Self

Static Method

This is a static method.

struct SoftClipAD . fn next

First-order anti-aliased hard_clip. Computes the first-order anti-aliased hard_clip of x. If the os_index is greater than 0, oversampling is applied to the processing.

fn next Signature

next(mut self, x: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]

fn next Arguments

Name Type Default Description
x SIMD The input sample.

fn next Returns : SIMD The anti-aliased soft_clip of x.

struct HardClipAD

Anti-Derivative Anti-Aliasing hard-clipping function.

This struct provides a first order anti-aliased version of the hard_clip function using the Anti-Derivative Anti-Aliasing (ADAA) with optional Oversampling. See Practical Considerations for Antiderivative Anti-Aliasing (Chowdhury) for more details on how this works.

Traits: AnyType, Copyable, Movable, UnknownDestructibility

HardClipAD Parameters

Name Type Default Description
num_chans Int 1 The number of channels for SIMD operations.
os_index Int 0 The oversampling index (0 = no oversampling, 1 = 2x, 2 = 4x, 3 = 8x, 4 = 16x).

HardClipAD Functions

struct HardClipAD . fn init

Initialize the HardClipAD.

fn init Signature

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

fn init Arguments

Name Type Default Description
world UnsafePointer A pointer to the MMMWorld.

fn init Returns : Self

Static Method

This is a static method.

struct HardClipAD . fn next

First-order anti-aliased hard_clip. Computes the first-order anti-aliased hard_clip of x. If the os_index is greater than 0, oversampling is applied to the processing.

fn next Signature

next(mut self, x: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]

fn next Arguments

Name Type Default Description
x SIMD The input sample.

fn next Returns : SIMD The anti-aliased hard_clip of x.

struct TanhAD

Anti-Derivative Anti-Aliasing first order tanh function.

This struct provides a first order anti-aliased version of the tanh function using the Anti-Derivative Anti-Aliasing (ADAA) method with optional Oversampling. See Practical Considerations for Antiderivative Anti-Aliasing (Chowdhury) for more details on how this works.

Traits: AnyType, Copyable, Movable, UnknownDestructibility

TanhAD Parameters

Name Type Default Description
num_chans Int 1 The number of channels for SIMD operations.
os_index Int 0 The oversampling index (0 = no oversampling, 1 = 2x, 2 = 4x, etc.).

TanhAD Functions

struct TanhAD . fn init

Initialize the TanhAD.

fn init Signature

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

fn init Arguments

Name Type Default Description
world UnsafePointer A pointer to the MMMWorld.

fn init Returns : Self

Static Method

This is a static method.

struct TanhAD . fn next

First-order anti-aliased hard_clip. Computes the first-order anti-aliased hard_clip of x using the ADAA method. If the os_index is greater than 0, oversampling is applied to the processing.

fn next Signature

next(mut self, x: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]

fn next Arguments

Name Type Default Description
x SIMD The input sample.

fn next Returns : SIMD The anti-aliased hard_clip of x.

struct BuchlaWavefolder

Buchla 259 style Wavefolder.

Buchla 259 style wavefolder implementation with Anti-Derivative Anti-Aliasing (ADAA) and Oversampling. Derived from Virual Analog Buchla 259e Wavefolderby Esqueda, etc. The ADAA technique is based on Practical Considerations for Antiderivative Anti-Aliasing (Chowdhury).

Traits: AnyType, Copyable, Movable, UnknownDestructibility

BuchlaWavefolder Parameters

Name Type Default Description
num_chans Int 1 The number of channels for SIMD operations.
os_index Int 1 The oversampling index (0 = no oversampling, 1 = 2x, 2 = 4x, etc.).

BuchlaWavefolder Functions

struct BuchlaWavefolder . fn init

Initialize the BuchlaWavefolder.

fn init Signature

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

fn init Arguments

Name Type Default Description
world UnsafePointer A pointer to the MMMWorld.

fn init Returns : Self

Static Method

This is a static method.

struct BuchlaWavefolder . fn next

First-order anti-aliased BuchlaWavefolder. Computes the first-order anti-aliased BuchlaWavefolder. If the os_index is greater than 0, oversampling is applied to the processing.

fn next Signature

next(mut self, x: SIMD[DType.float64, num_chans], amp: Float64) -> SIMD[DType.float64, num_chans]

fn next Arguments

Name Type Default Description
x SIMD The input sample.
amp Float64 The amplitude/gain control.

fn next Returns : SIMD The anti-aliased hard_clip of x.

Functions

(Functions that are not associated with a Struct)

fn bitcrusher

Simple bitcrusher function that reduces the bit depth of the input signal.

Signature

bitcrusher[num_chans: Int](in_samp: SIMD[DType.float64, num_chans], bits: Int64) -> SIMD[DType.float64, num_chans]

Parameters

Name Type Description
num_chans Int The number of channels for SIMD operations.

Arguments

Name Type Default Description
in_samp SIMD The input sample to be bitcrushed.
bits Int64 The number of bits to reduce the signal to.

Returns

Type: SIMD

fn hard_clip

Signature

hard_clip[num_chans: Int](x: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]

Parameters

Name Type Description
num_chans Int

Arguments

Name Type Default Description
x SIMD

Returns

Type: SIMD

fn buchla_wavefolder

Buchla waveshaper.

Buchla waveshaper implementation as a function. Derived from Virual Analog Buchla 259e Wavefolderby Esqueda, etc. See the BuchlaWavefolder struct for an ADAA version with oversampling.

Signature

buchla_wavefolder[num_chans: Int](input: SIMD[DType.float64, num_chans], var amp: Float64) -> SIMD[DType.float64, num_chans]

Parameters

Name Type Description
num_chans Int The number of channels for SIMD operations.

Arguments

Name Type Default Description
input SIMD Signal in - between 0 and +/-40.
amp Float64 Amplitude/gain control (1 to 40).

Returns

Type: SIMD Waveshaped output signal.


Documentation generated with mojo doc from Mojo version 0.25.6.1