Skip to content

Pan

Structs

struct SplayN

SplayN - Splays multiple input channels into N output channels. Different from splay which only outputs stereo, SplayN can output to any number of channels.

Traits: AnyType, Copyable, Movable, UnknownDestructibility

SplayN Parameters

Name Type Default Description
num_channels Int 2 Number of output channels to splay to.
pan_points Int 128 Number of discrete pan points to use for panning calculations. Default is 128.

SplayN Functions

struct SplayN . fn init

Initialize the SplayN instance.

fn init Signature

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

fn init Arguments

Name Type Default Description
world UnsafePointer Pointer to the MMMWorld instance.

fn init Returns : Self

Static Method

This is a static method.

struct SplayN . fn next

Evenly distributes multiple input channels to num_channels of output channels.

fn next Signature

next[num_simd: Int](mut self, input: List[SIMD[DType.float64, num_simd]]) -> SIMD[DType.float64, num_channels]

fn next Parameters

Name Type Default Description
num_simd Int

fn next Arguments

Name Type Default Description
input List List of input samples from multiple channels.

fn next Returns : SIMD SIMD[DType.float64, self.num_channels]: The panned output sample for each output channel.

Functions

(Functions that are not associated with a Struct)

fn pan2

Simple constant power panning function.

Signature

pan2(samples: Float64, pan: Float64) -> SIMD[DType.float64, 2]

Arguments

Name Type Default Description
samples Float64 Float64 - Mono input sample.
pan Float64 Float64 - Pan value from -1.0 (left) to 1.0 (right).

Returns

Type: SIMD Stereo output as SIMD[DType.float64, 2].

fn pan_stereo

Simple constant power panning function for stereo samples.

Signature

pan_stereo(samples: SIMD[DType.float64, 2], pan: Float64) -> SIMD[DType.float64, 2]

Arguments

Name Type Default Description
samples SIMD SIMD[DType.float64, 2] - Stereo input sample.
pan Float64 Float64 - Pan value from -1.0 (left) to 1.0 (right).

Returns

Type: SIMD Stereo output as SIMD[DType.float64, 2].

fn splay

Splay multiple input channels into stereo output.

There are multiple versions of splay to handle different input types. It can take a list of SIMD vectors or a single 1 or many channel SIMD vector. In the case of a list of SIMD vectors, each channel within the vector is treated separately and panned individually.

Signature

splay[num_simd: Int](input: List[SIMD[DType.float64, num_simd]], world: UnsafePointer[MMMWorld]) -> SIMD[DType.float64, 2]

Parameters

Name Type Description
num_simd Int

Arguments

Name Type Default Description
input List List of input samples from multiple channels.
world UnsafePointer Pointer to MMMWorld containing the pan_window.

Returns

Type: SIMD Stereo output as SIMD[DType.float64, 2].



fn splay

Splay multiple input channels into stereo output.

There are multiple versions of splay to handle different input types. It can take a list of SIMD vectors or a single 1 or many channel SIMD vector. In the case of a list of SIMD vectors, each channel within the vector is treated separately and panned individually.

Signature

splay[num_input_channels: Int](input: SIMD[DType.float64, num_input_channels], world: UnsafePointer[MMMWorld]) -> SIMD[DType.float64, 2]

Parameters

Name Type Description
num_input_channels Int

Arguments

Name Type Default Description
input SIMD List of input samples from multiple channels. List of Float64 or List of SIMD vectors.
world UnsafePointer Pointer to MMMWorld containing the pan_window.

Returns

Type: SIMD Stereo output as SIMD[DType.float64, 2].

fn pan_az

Pan a mono sample to N speakers arranged in a circle around the listener using azimuth panning.

Signature

pan_az[simd_out_size: Int = 2](sample: Float64, pan: Float64, num_speakers: Int64, width: Float64 = 2, orientation: Float64 = 0.5) -> SIMD[DType.float64, simd_out_size]

Parameters

Name Type Description
simd_out_size Int Number of output channels (speakers). Must be a power of two that is at least as large as num_speakers.

Arguments

Name Type Default Description
sample Float64 Mono input sample.
pan Float64 Pan position from 0.0 to 1.0.
num_speakers Int64 Number of speakers to pan to.
width Float64 2 Width of the speaker array (default is 2.0).
orientation Float64 0.5 Orientation offset of the speaker array (default is 0.5).

Returns

Type: SIMD SIMD[DType.float64, simd_out_size]: The panned output sample for each speaker.


Documentation generated with mojo doc from Mojo version 0.25.6.1