Skip to content
Structs

struct PlayBuf

Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility


PlayBuf Functions

struct PlayBuf . fn init

world: pointer to the MMMWorld instance. num_chans: number of channels in the buffer.

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 PlayBuf . fn next

Get the next sample from an audio buffer (Buffer).

fn next Signature

next[num_playback_chans: Int = 1](mut self, mut buffer: Buffer, start_chan: Int, rate: Float64, loop: Bool = True, trig: Bool = True, start_frame: Float64 = 0, num_frames: Float64 = -1) -> SIMD[DType.float64, num_playback_chans]

fn next Parameters

Name Type Description
num_playback_chans Int

fn next Arguments

Name Type Default Description
buffer Buffer The audio buffer to read from (Buffer struct).
start_chan Int
rate Float64 The playback rate. 1 is the normal speed of the buffer.
loop Bool True Whether to loop the buffer (default: True).
trig Bool True Trigger starts the synth at start_frame (default: 1.0).
start_frame Float64 0 The start frame for playback (default: 0) upon receiving a trigger.
num_frames Float64 -1 The end frame for playback (default: -1).

fn next Returns : SIMD

struct PlayBuf . fn get_win_phase

fn get_win_phase Signature

get_win_phase(mut self) -> Float64

fn get_win_phase Returns : Float64

struct Grain

Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility


Grain Functions

struct Grain . fn init

fn init Signature

__init__(out self, world: UnsafePointer[MMMWorld], num_chans: Int64 = 2)

fn init Arguments

Name Type Default Description
world UnsafePointer
num_chans Int64 2

fn init Returns : Self

Static Method

This is a static method.

struct Grain . fn next_pan2

fn next_pan2 Signature

next_pan2[num_playback_chans: Int = 1, win_num: Int = 0](mut self, mut buffer: Buffer, start_chan: Int, trig: Bool = False, rate: Float64 = 1, start_frame: Float64 = 0, duration: Float64 = 0, pan: Float64 = 0, gain: Float64 = 1) -> SIMD[DType.float64, 2]

fn next_pan2 Parameters

Name Type Description
num_playback_chans Int
win_num Int

fn next_pan2 Arguments

Name Type Default Description
buffer Buffer
start_chan Int
trig Bool False
rate Float64 1
start_frame Float64 0
duration Float64 0
pan Float64 0
gain Float64 1

fn next_pan2 Returns : SIMD

struct Grain . fn next_pan_az

fn next_pan_az Signature

next_pan_az[num_simd_chans: Int = 4, win_num: Int = 0](mut self, mut buffer: Buffer, start_chan: Int, trig: Bool = False, rate: Float64 = 1, start_frame: Float64 = 0, duration: Float64 = 0, num_speakers: Int = 4, pan: Float64 = 0, gain: Float64 = 1) -> SIMD[DType.float64, num_simd_chans]

fn next_pan_az Parameters

Name Type Description
num_simd_chans Int
win_num Int

fn next_pan_az Arguments

Name Type Default Description
buffer Buffer
start_chan Int
trig Bool False
rate Float64 1
start_frame Float64 0
duration Float64 0
num_speakers Int 4
pan Float64 0
gain Float64 1

fn next_pan_az Returns : SIMD

struct Grain . fn next

fn next Signature

next[num_playback_chans: Int = 1, win_num: Int = 0](mut self, mut buffer: Buffer, start_chan: Int, trig: Bool = False, rate: Float64 = 1, start_frame: Float64 = 0, duration: Float64 = 0, pan: Float64 = 0, gain: Float64 = 1) -> SIMD[DType.float64, num_playback_chans]

fn next Parameters

Name Type Description
num_playback_chans Int
win_num Int

fn next Arguments

Name Type Default Description
buffer Buffer
start_chan Int
trig Bool False
rate Float64 1
start_frame Float64 0
duration Float64 0
pan Float64 0
gain Float64 1

fn next Returns : SIMD

struct TGrains

Triggered granular synthesis. Each trigger starts a new grain.

Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility

TGrains Parameters

Name Type Description
max_grains Int

TGrains Functions

struct TGrains . 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 TGrains . fn next

Generate the next set of grains. Uses pan2 to pan to 2 channels. Depending on num_playback_chans, will either pan a mono signal out 2 channels or a stereo signal out 2 channels. Args:. buffer: Audio buffer containing the source sound. trig: Trigger signal (>0 to start a new grain). rate: Playback rate of the grains (1.0 = normal speed). start_frame: Starting frame position in the buffer. duration: Duration of each grain in seconds. pan: Panning position from -1.0 (left) to 1.0 (right). gain: Amplitude scaling factor for the grains.

fn next Signature

next[num_playback_chans: Int = 1](mut self, mut buffer: Buffer, buf_chan: Int = 0, trig: Bool = False, rate: Float64 = 1, start_frame: Float64 = 0, duration: Float64 = 0.10000000000000001, pan: Float64 = 0, gain: Float64 = 1) -> SIMD[DType.float64, 2]

fn next Parameters

Name Type Description
num_playback_chans Int Either 1 or 2, depending on whether you want to pan 1 channel of a buffer out 2 channels or 2 channels of the buffer with equal power panning.

fn next Arguments

Name Type Default Description
buffer Buffer
buf_chan Int 0
trig Bool False
rate Float64 1
start_frame Float64 0
duration Float64 0.10000000000000001
pan Float64 0
gain Float64 1

fn next Returns : SIMD List of output samples for all channels.

struct TGrains . fn next_pan_az

Generate the next set of grains. Uses azimuth panning for N channel output. Args:. buffer: Audio buffer containing the source sound. trig: Trigger signal (>0 to start a new grain). rate: Playback rate of the grains (1.0 = normal speed). start_frame: Starting frame position in the buffer. duration: Duration of each grain in seconds. pan: Panning position from -1.0 (left) to 1.0 (right). gain: Amplitude scaling factor for the grains.

fn next_pan_az Signature

next_pan_az[num_simd_chans: Int = 2](mut self, mut buffer: Buffer, buf_chan: Int = 0, trig: Bool = False, rate: Float64 = 1, start_frame: Float64 = 0, duration: Float64 = 0.10000000000000001, num_speakers: Int = 2, pan: Float64 = 0, gain: Float64 = 1) -> SIMD[DType.float64, num_simd_chans]

fn next_pan_az Parameters

Name Type Description
num_simd_chans Int

fn next_pan_az Arguments

Name Type Default Description
buffer Buffer
buf_chan Int 0
trig Bool False
rate Float64 1
start_frame Float64 0
duration Float64 0.10000000000000001
num_speakers Int 2
pan Float64 0
gain Float64 1

fn next_pan_az Returns : SIMD List of output samples for all channels.

struct PitchShift

An N channel granular pitchshifter. Each channel is processed in parrallel, thus each of the grains

Args: world: Pointer to the MMMWorld instance. buf_dur: Duration of the internal buffer in seconds.

Traits: AnyType, Copyable, Movable, UnknownDestructibility

PitchShift Parameters

Name Type Description
num_chans Int Number of input/output channels.
overlaps Int Number of overlapping grains (default is 4).

PitchShift Functions

struct PitchShift . fn init

world: pointer to the MMMWorld instance.     buf_dur: duration of the internal buffer in seconds.

fn init Signature

__init__(out self, world: UnsafePointer[MMMWorld], buf_dur: Float64 = 1)

fn init Arguments

Name Type Default Description
world UnsafePointer
buf_dur Float64 1

fn init Returns : Self

Static Method

This is a static method.

struct PitchShift . fn next

Generate the next set of grains. Args:. buffer: Audio buffer containing the source sound. trig: Trigger signal (>0 to start a new grain). rate: Playback rate of the grains (1.0 = normal speed). start_frame: Starting frame position in the buffer. duration: Duration of each grain in seconds. pan: Panning position from -1.0 (left) to 1.0 (right). gain: Amplitude scaling factor for the grains.

fn next Signature

next(mut self, in_sig: SIMD[DType.float64, num_chans], win_size: Float64 = 0.20000000000000001, pitch_ratio: Float64 = 1, pitch_dispersion: Float64 = 0, time_dispersion: Float64 = 0, gain: Float64 = 1) -> SIMD[DType.float64, num_chans]

fn next Arguments

Name Type Default Description
in_sig SIMD
win_size Float64 0.20000000000000001
pitch_ratio Float64 1
pitch_dispersion Float64 0
time_dispersion Float64 0
gain Float64 1

fn next Returns : SIMD List of output samples for all channels.


Documentation generated with mojo doc from Mojo version 0.25.6.1