Skip to content

Noise

Structs

struct WhiteNoise

Generate white noise samples.

Traits: AnyType, Copyable, ImplicitlyDestructible, Movable

WhiteNoise Parameters

Name Type Default Description
num_chans Int 1 Number of SIMD channels.

WhiteNoise Functions

struct WhiteNoise . fn init

Initialize the WhiteNoise struct.

fn init Signature

__init__(out self)

fn init Returns : Self

Static Method

This is a static method.

struct WhiteNoise . fn next

Generate the next white noise sample.

fn next Signature

next(self, gain: SIMD[DType.float64, num_chans] = 1) -> SIMD[DType.float64, num_chans]

fn next Arguments

Name Type Default Description
gain SIMD 1 Amplitude scaling factor.

fn next Returns : SIMD A random value between -gain and gain.

struct PinkNoise

Generate pink noise samples.

Uses the Voss-McCartney algorithm.

Traits: AnyType, Copyable, ImplicitlyDestructible, Movable

PinkNoise Parameters

Name Type Default Description
num_chans Int 1 Number of SIMD channels.

PinkNoise Functions

struct PinkNoise . fn init

Initialize the PinkNoise struct.

fn init Signature

__init__(out self)

fn init Returns : Self

Static Method

This is a static method.

struct PinkNoise . fn next

Generate the next pink noise sample.

fn next Signature

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

fn next Arguments

Name Type Default Description
gain SIMD 1 Amplitude scaling factor.

fn next Returns : SIMD The next pink noise sample scaled by gain.

struct BrownNoise

Generate brown noise samples.

Traits: AnyType, Copyable, ImplicitlyDestructible, Movable

BrownNoise Parameters

Name Type Default Description
num_chans Int 1 Number of SIMD channels.

BrownNoise Functions

struct BrownNoise . fn init

Initialize the BrownNoise struct.

fn init Signature

__init__(out self)

fn init Returns : Self

Static Method

This is a static method.

struct BrownNoise . fn next

Generate the next brown noise sample.

fn next Signature

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

fn next Arguments

Name Type Default Description
gain SIMD 1 Amplitude scaling factor.

fn next Returns : SIMD The next brown noise sample scaled by gain.

struct TExpRand

Generate exponentially distributed random value upon receiving a trigger.

Traits: AnyType, Copyable, ImplicitlyDestructible, Movable

TExpRand Parameters

Name Type Default Description
num_chans Int 1 Number of SIMD channels.

TExpRand Functions

struct TExpRand . fn init

Initialize the TExpRand struct.

fn init Signature

__init__(out self)

fn init Returns : Self

Static Method

This is a static method.

struct TExpRand . fn next

Output the exponentially distributed random value. The value is repeated until a new trigger is received, at which point a new value is generated. And that new value is repeated until the next trigger, and so on.

fn next Signature

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

fn next Arguments

Name Type Default Description
min SIMD Minimum value for the random value.
max SIMD Maximum value for the random value.
trig SIMD Trigger to generate a new value.

fn next Returns : SIMD The exponentially distributed random value.

struct TRand

Generate uniformly distributed random value upon receiving a trigger.

Traits: AnyType, Copyable, ImplicitlyDestructible, Movable

TRand Parameters

Name Type Default Description
num_chans Int 1 Number of SIMD channels.

TRand Functions

struct TRand . fn init

Initialize the TRand struct.

fn init Signature

__init__(out self)

fn init Returns : Self

Static Method

This is a static method.

struct TRand . fn next

Output uniformly distributed random value. The value is repeated until a new trigger is received, at which point a new value is generated. And that new value is repeated until the next trigger, and so on.

fn next Signature

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

fn next Arguments

Name Type Default Description
min SIMD Minimum value for the random value.
max SIMD Maximum value for the random value.
trig SIMD Trigger to generate a new value.

fn next Returns : SIMD The uniformly distributed random value.

struct LFSRNoise

Generate noise using a Linear Feedback Shift Register (LFSR).

Based on Josiah Sytsma's LFSR implementation.

Traits: AnyType, Copyable, ImplicitlyDestructible, Movable

LFSRNoise Parameters

Name Type Default Description
num_chans Int 1 Number of SIMD channels.

LFSRNoise Functions

struct LFSRNoise . fn init

fn init Signature

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

fn init Arguments

Name Type Default Description
world UnsafePointer

fn init Returns : Self

Static Method

This is a static method.

struct LFSRNoise . fn next

Generate the next LFSR noise sample.

fn next Signature

next(mut self, freq: SIMD[DType.float64, num_chans] = 1, width: SIMD[DType.index, num_chans] = 15, trig: Bool = False) -> SIMD[DType.float64, num_chans]

fn next Arguments

Name Type Default Description
freq SIMD 1 Frequency at which to step the LFSR in Hz.
width SIMD 15 Width of the LFSR in bits (3-32).
trig Bool False Trigger signal to reset state when switching from False to True.

fn next Returns : SIMD The next LFSR noise sample.


Documentation generated with mojo doc from Mojo version 0.26.1.0