Filters
struct Lag¶
A lag processor that smooths input values over time based on a specified lag time in seconds.
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
Lag Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
Number of SIMD channels to process in parallel. |
Lag Functions¶
struct Lag . fn init¶
Initialize the lag processor with given lag time in seconds.
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | Pointer to the MMMWorld. |
| lag | SIMD |
0.02 |
SIMD vector specifying lag time in seconds for each channel. |
fn init Returns
: Self
Static Method
This is a static method.
struct Lag . fn next¶
Process one sample through the lag processor.
fn next Signature
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| in_samp | SIMD |
— | Input SIMD vector values. |
fn next Returns
: SIMD
Output values after applying the lag.
struct Lag . fn set_lag_time¶
Set a new lag time in seconds for each channel.
fn set_lag_time Signature
fn set_lag_time Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| lag | SIMD |
— | SIMD vector specifying new lag time in seconds for each channel. |
struct LagN¶
SIMD parallelization of Lag.
This convenience class creates a List of N Lag structs, then auto SIMD parallelizes the list so that the filters are processed efficiently in parallel.
Traits: AnyType, Copyable, Movable, UnknownDestructibility
LagN Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| lag | Float64 |
0.02 |
— |
| num_chans | Int |
1 |
— |
LagN Functions¶
struct LagN . fn init¶
Initialize the LagN struct.
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | Pointer to the MMMWorld. |
| lag_times | List |
— | List of lag times in seconds for each channel. |
fn init Returns
: Self
Static Method
This is a static method.
struct LagN . fn next¶
Process one sample through the LagN processor.
fn next Signature
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| in_list | List |
— | List of input values for each channel. |
| out_list | List |
— | List to store output values for each channel. |
struct SVF¶
A State Variable Filter struct.
To use the different modes, see the mode-specific methods.
Implementation from Andrew Simper. Translated from Oleg Nesterov's Faust implementation.
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
SVF Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
Number of SIMD channels to process in parallel. |
SVF Functions¶
struct SVF . fn init¶
Initialize the SVF.
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | Pointer to the MMMWorld. |
fn init Returns
: Self
Static Method
This is a static method.
struct SVF . fn reset¶
struct SVF . fn lpf¶
SVF lowpass filter.
fn lpf Signature
lpf(mut self, input: SIMD[DType.float64, num_chans], frequency: SIMD[DType.float64, num_chans], q: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn lpf Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input signal to process. |
| frequency | SIMD |
— | The cutoff frequency of the lowpass filter. |
| q | SIMD |
— | The resonance (Q factor) of the filter. |
fn lpf Returns
: SIMD
The next SIMD sample of the filtered output.
struct SVF . fn bpf¶
SVF bandpass filter.
fn bpf Signature
bpf(mut self, input: SIMD[DType.float64, num_chans], frequency: SIMD[DType.float64, num_chans], q: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn bpf Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input signal to process. |
| frequency | SIMD |
— | The center frequency of the bandpass filter. |
| q | SIMD |
— | The resonance (Q factor) of the filter. |
fn bpf Returns
: SIMD
The next sample of the filtered output.
struct SVF . fn hpf¶
SVF highpass filter.
fn hpf Signature
hpf(mut self, input: SIMD[DType.float64, num_chans], frequency: SIMD[DType.float64, num_chans], q: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn hpf Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input signal to process. |
| frequency | SIMD |
— | The cutoff frequency of the highpass filter. |
| q | SIMD |
— | The resonance (Q factor) of the filter. |
fn hpf Returns
: SIMD
The next sample of the filtered output.
struct SVF . fn notch¶
SVF notch filter.
fn notch Signature
notch(mut self, input: SIMD[DType.float64, num_chans], frequency: SIMD[DType.float64, num_chans], q: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn notch Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input signal to process. |
| frequency | SIMD |
— | The center frequency of the notch filter. |
| q | SIMD |
— | The resonance (Q factor) of the filter. |
fn notch Returns
: SIMD
The next sample of the filtered output.
struct SVF . fn peak¶
SVF peak filter.
fn peak Signature
peak(mut self, input: SIMD[DType.float64, num_chans], frequency: SIMD[DType.float64, num_chans], q: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn peak Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input signal to process. |
| frequency | SIMD |
— | The center frequency of the peak filter. |
| q | SIMD |
— | The resonance (Q factor) of the filter. |
fn peak Returns
: SIMD
The next sample of the filtered output.
struct SVF . fn allpass¶
SVF allpass filter.
fn allpass Signature
allpass(mut self, input: SIMD[DType.float64, num_chans], frequency: SIMD[DType.float64, num_chans], q: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn allpass Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input signal to process. |
| frequency | SIMD |
— | The center frequency of the allpass filter. |
| q | SIMD |
— | The resonance (Q factor) of the filter. |
fn allpass Returns
: SIMD
The next sample of the filtered output.
struct SVF . fn bell¶
SVF bell filter (parametric EQ).
fn bell Signature
bell(mut self, input: SIMD[DType.float64, num_chans], frequency: SIMD[DType.float64, num_chans], q: SIMD[DType.float64, num_chans], gain_db: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn bell Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input signal to process. |
| frequency | SIMD |
— | The center frequency of the bell filter. |
| q | SIMD |
— | The resonance (Q factor) of the filter. |
| gain_db | SIMD |
— | The gain in decibels for the bell filter. |
fn bell Returns
: SIMD
The next sample of the filtered output.
struct SVF . fn lowshelf¶
SVF low shelf filter.
fn lowshelf Signature
lowshelf(mut self, input: SIMD[DType.float64, num_chans], frequency: SIMD[DType.float64, num_chans], q: SIMD[DType.float64, num_chans], gain_db: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn lowshelf Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input signal to process. |
| frequency | SIMD |
— | The cutoff frequency of the low shelf filter. |
| q | SIMD |
— | The resonance (Q factor) of the filter. |
| gain_db | SIMD |
— | The gain in decibels for the low shelf filter. |
fn lowshelf Returns
: SIMD
The next sample of the filtered output.
struct SVF . fn highshelf¶
SVF high shelf filter.
fn highshelf Signature
highshelf(mut self, input: SIMD[DType.float64, num_chans], frequency: SIMD[DType.float64, num_chans], q: SIMD[DType.float64, num_chans], gain_db: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn highshelf Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input signal to process. |
| frequency | SIMD |
— | The cutoff frequency of the high shelf filter. |
| q | SIMD |
— | The resonance (Q factor) of the filter. |
| gain_db | SIMD |
— | The gain in decibels for the high shelf filter. |
fn highshelf Returns
: SIMD
The next sample of the filtered output.
struct lpf_LR4¶
A 4th-order Linkwitz-Riley lowpass filter.
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
lpf_LR4 Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
Number of SIMD channels to process in parallel. |
lpf_LR4 Functions¶
struct lpf_LR4 . fn init¶
Initialize the 4th-order Linkwitz-Riley lowpass filter.
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | Pointer to the MMMWorld. |
fn init Returns
: Self
Static Method
This is a static method.
struct lpf_LR4 . fn next¶
A single sample through the 4th order Linkwitz-Riley lowpass filter.
fn next Signature
next(mut self, input: SIMD[DType.float64, num_chans], frequency: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input sample to process. |
| frequency | SIMD |
— | The cutoff frequency of the lowpass filter. |
fn next Returns
: SIMD
The next sample of the filtered output.
struct OnePole¶
One-pole IIR filter that can be configured as lowpass or highpass.
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
OnePole Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
Number of channels to process in parallel. |
OnePole Functions¶
struct OnePole . fn init¶
Initialize the one-pole filter.
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | — |
fn init Returns
: Self
Static Method
This is a static method.
struct OnePole . fn lpf¶
Process one sample through the one-pole lowpass filter with a given cutoff frequency.
fn lpf Signature
lpf(mut self, input: SIMD[DType.float64, num_chans], cutoff_hz: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn lpf Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input signal to process. |
| cutoff_hz | SIMD |
— | The cutoff frequency of the lowpass filter. |
fn lpf Returns
: SIMD
The next sample of the filtered output.
struct OnePole . fn hpf¶
Process one sample through the one-pole highpass filter with a given cutoff frequency.
fn hpf Signature
hpf(mut self, input: SIMD[DType.float64, num_chans], cutoff_hz: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn hpf Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input signal to process. |
| cutoff_hz | SIMD |
— | The cutoff frequency of the highpass filter. |
fn hpf Returns
: SIMD
The next sample of the filtered output.
struct DCTrap¶
DC Trap filter.
Implementation from Digital Sound Generation by Beat Frei. The cutoff frequency of the highpass filter is fixed to 5 Hz.
Traits: AnyType, Copyable, Movable, UnknownDestructibility
DCTrap Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
Number of channels to process in parallel. |
DCTrap Functions¶
struct DCTrap . fn init¶
Initialize the DC blocker filter.
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | Pointer to the MMMWorld. |
fn init Returns
: Self
Static Method
This is a static method.
struct DCTrap . fn next¶
Process one sample through the DC blocker filter.
fn next Signature
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input signal to process. |
fn next Returns
: SIMD
The next sample of the filtered output.
struct VAOnePole¶
One-pole filter based on the Virtual Analog design by Vadim Zavalishin in "The Art of VA Filter Design".
This implementation supports both lowpass and highpass modes.
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
VAOnePole Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
Number of channels to process in parallel. |
VAOnePole Functions¶
struct VAOnePole . fn init¶
Initialize the VAOnePole filter.
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | Pointer to the MMMWorld. |
fn init Returns
: Self
Static Method
This is a static method.
struct VAOnePole . fn lpf¶
Process one sample through the VA one-pole lowpass filter.
fn lpf Signature
lpf(mut self, input: SIMD[DType.float64, num_chans], freq: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn lpf Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input signal to process. |
| freq | SIMD |
— | The cutoff frequency of the lowpass filter. |
fn lpf Returns
: SIMD
The next sample of the filtered output.
struct VAOnePole . fn hpf¶
Process one sample through the VA one-pole highpass filter.
fn hpf Signature
hpf(mut self, input: SIMD[DType.float64, num_chans], freq: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn hpf Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input signal to process. |
| freq | SIMD |
— | The cutoff frequency of the highpass filter. |
fn hpf Returns
: SIMD
The next sample of the filtered output.
struct VAMoogLadder¶
Virtual Analog Moog Ladder Filter.
Implementation based on the Virtual Analog design by Vadim Zavalishin in "The Art of VA Filter Design"
This implementation supports 4-pole lowpass filtering with optional oversampling.
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
VAMoogLadder Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
Number of channels to process in parallel. |
| os_index | Int |
0 |
oversampling factor as a power of two (0 = no oversampling, 1 = 2x, 2 = 4x, etc). |
VAMoogLadder Functions¶
struct VAMoogLadder . fn init¶
Initialize the VAMoogLadder filter.
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | Pointer to the MMMWorld. |
fn init Returns
: Self
Static Method
This is a static method.
struct VAMoogLadder . fn next¶
Process one sample through the Moog Ladder lowpass filter.
fn next Signature
next(mut self, sig: SIMD[DType.float64, num_chans], freq: SIMD[DType.float64, num_chans] = 100, q_val: SIMD[DType.float64, num_chans] = 0.5) -> SIMD[DType.float64, num_chans]
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| sig | SIMD |
— | The input signal to process. |
| freq | SIMD |
100 |
The cutoff frequency of the lowpass filter. |
| q_val | SIMD |
0.5 |
The resonance (Q factor) of the filter. |
fn next Returns
: SIMD
The next sample of the filtered output.
struct Reson¶
Resonant filter with lowpass, highpass, and bandpass modes.
A translation of Julius Smith's Faust implementation of tf2s (virtual analog) resonant filters. Copyright (C) 2003-2019 by Julius O. Smith III
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
Reson Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| num_chans | Int |
1 |
Number of SIMD channels to process in parallel. |
Reson Functions¶
struct Reson . fn init¶
Initialize the Reson filter.
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | Pointer to the MMMWorld. |
fn init Returns
: Self
Static Method
This is a static method.
struct Reson . fn lpf¶
Process input through a resonant lowpass filter.
fn lpf Signature
lpf(mut self: Reson[num_chans], input: SIMD[DType.float64, num_chans], freq: SIMD[DType.float64, num_chans], q: SIMD[DType.float64, num_chans], gain: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn lpf Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input signal to process. |
| freq | SIMD |
— | The cutoff frequency of the lowpass filter. |
| q | SIMD |
— | The resonance (Q factor) of the filter. |
| gain | SIMD |
— | The output gain (clipped to 0.0-1.0 range). |
fn lpf Returns
: SIMD
The next sample of the filtered output.
struct Reson . fn hpf¶
Process input through a resonant highpass filter.
fn hpf Signature
hpf(mut self: Reson[num_chans], input: SIMD[DType.float64, num_chans], freq: SIMD[DType.float64, num_chans], q: SIMD[DType.float64, num_chans], gain: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn hpf Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input signal to process. |
| freq | SIMD |
— | The cutoff frequency of the highpass filter. |
| q | SIMD |
— | The resonance (Q factor) of the filter. |
| gain | SIMD |
— | The output gain (clipped to 0.0-1.0 range). |
fn hpf Returns
: SIMD
The next sample of the filtered output.
struct Reson . fn bpf¶
Process input through a resonant bandpass filter.
fn bpf Signature
bpf(mut self: Reson[num_chans], input: SIMD[DType.float64, num_chans], freq: SIMD[DType.float64, num_chans], q: SIMD[DType.float64, num_chans], gain: SIMD[DType.float64, num_chans]) -> SIMD[DType.float64, num_chans]
fn bpf Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD |
— | The input signal to process. |
| freq | SIMD |
— | The center frequency of the bandpass filter. |
| q | SIMD |
— | The resonance (Q factor) of the filter. |
| gain | SIMD |
— | The output gain (clipped to 0.0-1.0 range). |
fn bpf Returns
: SIMD
The next sample of the filtered output.
Documentation generated with mojo doc from Mojo version 0.25.6.1