struct Phasor¶
A phasor oscillator that generates a ramp waveform from 0.0 to 1.0. The phasor is the root of all oscillators in MMMAudio.
Params:
N: Number of channels (default is 1).
os_index: Oversampling index (0 = no oversampling, 1 = 2x, etc.; default is 0).
Args: world: Pointer to the MMMWorld instance.
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
Phasor Parameters
| Name | Type | Description |
|---|---|---|
| N | Int |
— |
| os_index | Int |
— |
Phasor Functions¶
struct Phasor . fn init¶
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | — |
fn init Returns
: Self
Static Method
This is a static method.
struct Phasor . fn increment_phase¶
fn increment_phase Signature
fn increment_phase Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| freq | SIMD |
— | — |
struct Phasor . fn next¶
fn next Signature
next(mut self: Phasor[N, os_index], freq: SIMD[DType.float64, N] = 100, phase_offset: SIMD[DType.float64, N] = 0, trig: SIMD[DType.bool, N] = False) -> SIMD[DType.float64, N]
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| freq | SIMD |
100 |
— |
| phase_offset | SIMD |
0 |
— |
| trig | SIMD |
False |
— |
fn next Returns
: SIMD
struct OscType¶
Traits: AnyType, UnknownDestructibility
struct Osc¶
**A wavetable oscillator capable of all standard waveforms. using linear, quadratic, or sinc interpolation and can also be set to use oversampling. **
While any combination is posible, best practice is with sinc interpolation, use an oversampling index of 0 (no oversampling), 1 (2x). with linear or quadratic interpolation, use an oversampling index of 0 (no oversampling), 1 (2x), 2 (4x), 3 (8x), or 4 (16x).
Params:
N: Number of channels (default is 1).
interp: Interpolation method (0 = linear, 1 = cubic, 2 = sinc; default is 0).
os_index: Oversampling index (0 = no oversampling, 1 = 2x, 2 = 4x, etc.; default is 0).
Args:
world: Pointer to the MMMWorld instance.
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
Osc Parameters
| Name | Type | Description |
|---|---|---|
| N | Int |
— |
| interp | Int |
— |
| os_index | Int |
— |
Osc Functions¶
struct Osc . fn init¶
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | — |
fn init Returns
: Self
Static Method
This is a static method.
struct Osc . fn next¶
Generate the next oscillator sample on a single waveform type. All inputs are SIMD types except trig, which is a scalar. This means that an oscillator can have N different instances, each with its own frequency, phase offset, and waveform type, but they will all share the same trigger signal. phase_offset: Phase offset in the range [0.0, 1.0] (default is 0.0).
trig: Trigger signal to reset the phase (default is 0.0).
osc_type: Type of waveform (0 = Sine, 1 = Saw, 2 = Square, 3 = Triangle, 4 = BandLimited Triangle, 5 = BandLimited Saw, 6 = BandLimited Square;
default is 0).
fn next Signature
next(mut self: Osc[N, interp, os_index], freq: SIMD[DType.float64, N] = 100, phase_offset: SIMD[DType.float64, N] = 0, trig: Bool = False, osc_type: SIMD[DType.int64, N] = 0) -> SIMD[DType.float64, N]
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| freq | SIMD |
100 |
Frequency of the oscillator in Hz (default is 100.0). |
| phase_offset | SIMD |
0 |
— |
| trig | Bool |
False |
— |
| osc_type | SIMD |
0 |
— |
fn next Returns
: SIMD
struct Osc . fn next_interp¶
Variable Wavetable Oscillator: Generate the next oscillator sample on a variable waveform where the output is interpolated between different waveform types. All inputs are SIMD types except trig and osc_types, which are scalar. This means that an oscillator can have N different instances, each with its own frequency, phase offset, and waveform type, but they will all share the same trigger signal and the same list of waveform types to interpolate between. phase_offset: Phase offset in the range [0.0, 1.0] (default is 0.0).
trig: Trigger signal to reset the phase (default is 0.0).
osc_types: List of waveform types to interpolate between (default is [0,4,5,6] - sine, triangle, saw, square).
trig: Trigger signal to reset the phase (default is 0.0). All waveforms will reset together.
osc_frac: Fractional index for wavetable interpolation. Values are between 0.0 and 1.0. 0.0 corresponds to the first waveform in the osc_types list, 1.0 corresponds to the last waveform in the osc_types list, and values in between interpolate linearly between all waveforms in the list.
fn next_interp Signature
next_interp(mut self: Osc[N, interp, os_index], freq: SIMD[DType.float64, N] = 100, phase_offset: SIMD[DType.float64, N] = 0, trig: Bool = False, osc_types: List[Int64] = List[Int64](0, 4, 5, 6, Tuple[]()), osc_frac: SIMD[DType.float64, N] = 0) -> SIMD[DType.float64, N]
fn next_interp Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| freq | SIMD |
100 |
Frequency of the oscillator in Hz (default is 100.0). |
| phase_offset | SIMD |
0 |
— |
| trig | Bool |
False |
— |
| osc_types | List |
List[Int64](0, 4, 5, 6, Tuple[]()) |
— |
| osc_frac | SIMD |
0 |
— |
fn next_interp Returns
: SIMD
struct Osc . fn next_interp¶
Variable Wavetable Oscillator: Generate the next oscillator sample on a variable waveform where the output is interpolated between different waveform types. All inputs are SIMD types except trig and osc_types, which are scalar. This means that an oscillator can have N different instances, each with its own frequency, phase offset, and waveform type, but they will all share the same trigger signal and the same list of waveform types to interpolate between.
fn next_interp Signature
next_interp(mut self: Osc[N, interp, os_index], ref buffer: Buffer, freq: SIMD[DType.float64, N] = 100, phase_offset: SIMD[DType.float64, N] = 0, trig: Bool = False, osc_frac: SIMD[DType.float64, N] = 0) -> SIMD[DType.float64, N]
fn next_interp Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| buffer | Buffer |
— | Reference to a Buffer containing the waveforms to interpolate between. |
| freq | SIMD |
100 |
Frequency of the oscillator in Hz (default is 100.0). |
| phase_offset | SIMD |
0 |
Phase offset in the range [0.0, 1.0] (default is 0.0). |
| trig | Bool |
False |
Trigger signal to reset the phase (default is 0.0). All waveforms will reset together. |
| osc_frac | SIMD |
0 |
Fractional index for wavetable interpolation. Values are between 0.0 and 1.0. 0.0 corresponds to the first waveform in the osc_types list, 1.0 corresponds to the last waveform in the osc_types list, and values in between interpolate linearly between all waveforms in the list. |
fn next_interp Returns
: SIMD
struct SinOsc¶
A sine wave oscillator.
This is a convenience struct as internally it uses Osc and indicates osc_type = 0
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
SinOsc Parameters
| Name | Type | Description |
|---|---|---|
| N | Int |
— |
| os_index | Int |
— |
SinOsc Functions¶
struct SinOsc . fn init¶
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | — |
fn init Returns
: Self
Static Method
This is a static method.
struct SinOsc . fn next¶
fn next Signature
next(mut self: SinOsc[N, os_index], freq: SIMD[DType.float64, N] = 100, phase_offset: SIMD[DType.float64, N] = 0, trig: Bool = False, interp: Int64 = 0) -> SIMD[DType.float64, N]
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| freq | SIMD |
100 |
— |
| phase_offset | SIMD |
0 |
— |
| trig | Bool |
False |
— |
| interp | Int64 |
0 |
— |
fn next Returns
: SIMD
struct LFSaw¶
A low-frequency sawtooth oscillator.
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
LFSaw Parameters
| Name | Type | Description |
|---|---|---|
| N | Int |
— |
| os_index | Int |
— |
LFSaw Functions¶
struct LFSaw . fn init¶
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | — |
fn init Returns
: Self
Static Method
This is a static method.
struct LFSaw . fn next¶
fn next Signature
next(mut self: LFSaw[N, os_index], freq: SIMD[DType.float64, N] = 100, phase_offset: SIMD[DType.float64, N] = 0, trig: Bool = False, interp: Int64 = 0) -> SIMD[DType.float64, N]
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| freq | SIMD |
100 |
— |
| phase_offset | SIMD |
0 |
— |
| trig | Bool |
False |
— |
| interp | Int64 |
0 |
— |
fn next Returns
: SIMD
struct LFSquare¶
A low-frequency square wave oscillator.
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
LFSquare Parameters
| Name | Type | Description |
|---|---|---|
| N | Int |
— |
| os_index | Int |
— |
LFSquare Functions¶
struct LFSquare . fn init¶
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | — |
fn init Returns
: Self
Static Method
This is a static method.
struct LFSquare . fn next¶
fn next Signature
next(mut self: LFSquare[N, os_index], freq: SIMD[DType.float64, N] = 100, phase_offset: SIMD[DType.float64, N] = 0, trig: Bool = False, interp: Int64 = 0) -> SIMD[DType.float64, N]
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| freq | SIMD |
100 |
— |
| phase_offset | SIMD |
0 |
— |
| trig | Bool |
False |
— |
| interp | Int64 |
0 |
— |
fn next Returns
: SIMD
struct LFTri¶
A low-frequency triangle wave oscillator.
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
LFTri Parameters
| Name | Type | Description |
|---|---|---|
| N | Int |
— |
| os_index | Int |
— |
LFTri Functions¶
struct LFTri . fn init¶
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | — |
fn init Returns
: Self
Static Method
This is a static method.
struct LFTri . fn next¶
fn next Signature
next(mut self: LFTri[N, os_index], freq: SIMD[DType.float64, N] = 100, phase_offset: SIMD[DType.float64, N] = 0, trig: Bool = False, interp: Int64 = 0) -> SIMD[DType.float64, N]
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| freq | SIMD |
100 |
— |
| phase_offset | SIMD |
0 |
— |
| trig | Bool |
False |
— |
| interp | Int64 |
0 |
— |
fn next Returns
: SIMD
struct Impulse¶
An oscillator that generates an impulse signal. Args: world: Pointer to the MMMWorld instance.
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
Impulse Parameters
| Name | Type | Description |
|---|---|---|
| N | Int |
— |
Impulse Functions¶
struct Impulse . fn init¶
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | — |
fn init Returns
: Self
Static Method
This is a static method.
struct Impulse . fn next¶
fn next Signature
next(mut self: Impulse[N], freq: SIMD[DType.float64, N] = 100, trig: SIMD[DType.bool, N] = SIMD[DType.bool, N](True)) -> SIMD[DType.float64, N]
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| freq | SIMD |
100 |
— |
| trig | SIMD |
SIMD[DType.bool, N](True) |
— |
fn next Returns
: SIMD
struct Impulse . fn next_bool¶
Generate the next impulse sample.
fn next_bool Signature
next_bool(mut self: Impulse[N], freq: SIMD[DType.float64, N] = 100, trig: SIMD[DType.bool, N] = SIMD[DType.bool, N](True)) -> SIMD[DType.bool, N]
fn next_bool Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| freq | SIMD |
100 |
— |
| trig | SIMD |
SIMD[DType.bool, N](True) |
— |
fn next_bool Returns
: SIMD
struct Impulse . fn get_phase¶
fn get_phase Signature
fn get_phase Returns
: SIMD
struct Dust¶
A low-frequency dust noise oscillator.
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
Dust Parameters
| Name | Type | Description |
|---|---|---|
| N | Int |
— |
Dust Functions¶
struct Dust . fn init¶
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | — |
fn init Returns
: Self
Static Method
This is a static method.
struct Dust . fn next¶
fn next Signature
next(mut self: Dust[N], low: SIMD[DType.float64, N] = 100, high: SIMD[DType.float64, N] = 2000, trig: SIMD[DType.bool, N] = True) -> SIMD[DType.float64, N]
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| low | SIMD |
100 |
— |
| high | SIMD |
2000 |
— |
| trig | SIMD |
True |
— |
fn next Returns
: SIMD
struct Dust . fn next_bool¶
Generate the next dust noise sample.
fn next_bool Signature
next_bool(mut self: Dust[N], low: SIMD[DType.float64, N] = 100, high: SIMD[DType.float64, N] = 2000, trig: SIMD[DType.bool, N] = True) -> SIMD[DType.bool, N]
fn next_bool Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| low | SIMD |
100 |
— |
| high | SIMD |
2000 |
— |
| trig | SIMD |
True |
— |
fn next_bool Returns
: SIMD
struct Dust . fn get_phase¶
fn get_phase Signature
fn get_phase Returns
: SIMD
struct LFNoise¶
Low-frequency noise oscillator.
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
LFNoise Parameters
| Name | Type | Description |
|---|---|---|
| N | Int |
— |
| interp | Int |
— |
LFNoise Functions¶
struct LFNoise . fn init¶
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | — |
fn init Returns
: Self
Static Method
This is a static method.
struct LFNoise . fn next¶
Generate the next low-frequency noise sample.
fn next Signature
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| freq | SIMD |
100 |
— |
fn next Returns
: SIMD
struct Sweep¶
Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility
Sweep Parameters
| Name | Type | Description |
|---|---|---|
| N | Int |
— |
| os_index | Int |
— |
Sweep Functions¶
struct Sweep . fn init¶
fn init Signature
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | — |
fn init Returns
: Self
Static Method
This is a static method.
struct Sweep . fn next¶
fn next Signature
next(mut self, freq: SIMD[DType.float64, N] = 100, trig: SIMD[DType.bool, N] = False) -> SIMD[DType.float64, N]
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| freq | SIMD |
100 |
— |
| trig | SIMD |
False |
— |
fn next Returns
: SIMD
Documentation generated with mojo doc from Mojo version 0.25.6.1