Skip to content

World

Structs

struct MMMWorld

The MMMWorld struct holds global audio processing parameters and state.

In pretty much all usage, don't edit this struct.

Traits: AnyType, Copyable, Movable, Representable, UnknownDestructibility


MMMWorld Functions

struct MMMWorld . fn init

Initializes the MMMWorld struct.

fn init Signature

__init__(out self, sample_rate: Float64 = 48000, block_size: Int64 = 64, num_in_chans: Int64 = 2, num_out_chans: Int64 = 2)

fn init Arguments

Name Type Default Description
sample_rate Float64 48000 The audio sample rate.
block_size Int64 64 The audio block size.
num_in_chans Int64 2 The number of input channels.
num_out_chans Int64 2 The number of output channels.

fn init Returns : Self

Static Method

This is a static method.

struct MMMWorld . fn set_channel_count

Sets the number of input and output channels.

fn set_channel_count Signature

set_channel_count(mut self, num_in_chans: Int64, num_out_chans: Int64)

fn set_channel_count Arguments

Name Type Default Description
num_in_chans Int64 The number of input channels.
num_out_chans Int64 The number of output channels.

struct MMMWorld . fn print

Print values to the console at the top of the audio block every n_blocks.

fn print Signature

print[*Ts: Writable](self, *values: *Ts, *, n_blocks: UInt16 = 10, sep: StringSlice[StaticConstantOrigin] = " ", end: StringSlice[StaticConstantOrigin] = "\n")

fn print Parameters

Name Type Default Description
*Ts Writable Types of the values to print. Can be of any type that implements Mojo's Writable trait. This parameter is inferred by the values passed to the function. The user doesn't need to specify it.

fn print Arguments

Name Type Default Description
*values *Ts Values to print. Can be of any type that implements Mojo's Writable trait. This is a "variadic" argument meaning that the user can pass in any number of values (not as a list, just as comma separated arguments).
n_blocks UInt16 10 Number of audio blocks between prints. Must be specified using the keyword argument.
sep StringSlice " " Separator string between values. Must be specified using the keyword argument.
end StringSlice "\n" End string to print after all values. Must be specified using the keyword argument.

struct Interp

Interpolation types for use in various UGens.

Specify an interpolation type by typing it explicitly. For example, to specify linear interpolation, one could use the number 1, but it is clearer to type Interp.linear.

Interpolation Type Value Notes
Interp.none 0
Interp.linear 1
Interp.quad 2
Interp.cubic 3
Interp.lagrange4 4
Interp.sinc 5 Should only be used with oscillators

Traits: AnyType, UnknownDestructibility


struct WindowType

Window types for predefined windows found in world[].windows.

Specify a window type by typing it explicitly. For example, to specify a hann window, one could use the number 1, but it is clearer to type WindowType.hann.

Window Type Value
WindowType.rect 0
WindowType.hann 1
WindowType.hamming 2
WindowType.blackman 3
WindowType.kaiser 4
WindowType.sine 5
WindowType.tri 6
WindowType.pan2 7

Traits: AnyType, UnknownDestructibility


struct OscType

Oscillator types for selecting waveform types.

Specify an oscillator type by typing it explicitly. For example, to specify a sine, one could use the number 0, but it is clearer to type OscType.sine.

Oscillator Type Value
OscType.sine 0
OscType.triangle 1
OscType.saw 2
OscType.square 3
OscType.bandlimited_triangle 4
OscType.bandlimited_saw 5
OscType.bandlimited_square. 6

Traits: AnyType, UnknownDestructibility



Documentation generated with mojo doc from Mojo version 0.25.6.1