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, ImplicitlyDestructible, Movable

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)

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: Span[SIMD[DType.float64, num_simd], origin]) -> SIMD[DType.float64, num_channels]

fn next Parameters

Name Type Default Description
num_simd Int

fn next Arguments

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

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

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: 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 SIMD Input samples from multiple channels.

fn next Returns : SIMD MFloat[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 MFloat[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 MFloat[2] - Stereo input sample.
pan Float64 Float64 - Pan value from -1.0 (left) to 1.0 (right).

Returns

Type: SIMD Stereo output as MFloat[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 or InlineArray of SIMD vectors, a VariadicList of SIMD, 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: SIMD[DType.float64, num_simd], *, world: UnsafePointer[MMMWorld, MutExternalOrigin]) -> SIMD[DType.float64, 2]

Parameters

Name Type Description
num_simd Int

Arguments

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

Returns

Type: SIMD Stereo output as MFloat[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 or InlineArray of SIMD vectors, a VariadicList of SIMD, 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: Span[SIMD[DType.float64, num_simd], origin], world: UnsafePointer[MMMWorld, MutExternalOrigin]) -> SIMD[DType.float64, 2]

Parameters

Name Type Description
num_simd Int

Arguments

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

Returns

Type: SIMD Stereo output as MFloat[2].

fn splay

Signature

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

Parameters

Name Type Description
num_input_channels Int

Arguments

Name Type Default Description
input SIMD
world UnsafePointer

Returns

Type: SIMD

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: Int, 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 Int 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 MFloat[simd_out_size]: The panned output sample for each speaker.


Documentation generated with mojo doc from Mojo version 0.26.1.0