Windows
struct Windows¶
Stores various window functions used in audio processing. This struct precomputes several common window types.
Traits: AnyType, Copyable, Movable, UnknownDestructibility
Windows Functions¶
struct Windows . fn init¶
struct Windows . fn at_phase¶
Get window value at given phase (0.0 to 1.0) for specified window type.
fn at_phase Signature
at_phase[window_type: Int64, interp: Int = 0](self, world: UnsafePointer[MMMWorld], phase: Float64, prev_phase: Float64 = 0) -> Float64
fn at_phase Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| window_type | Int64 |
— | — |
| interp | Int |
0 |
— |
fn at_phase Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer |
— | — |
| phase | Float64 |
— | — |
| prev_phase | Float64 |
0 |
— |
fn at_phase Returns
: Float64
struct Windows . fn make_window¶
Generate a window of specified type and size.
fn make_window Signature
fn make_window Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| window_type | Int |
— | Type of window to generate. Use alias variables from WindowType struct (e.g. WindowType.hann). |
fn make_window Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| size | Int64 |
— | Length of the window. |
| beta | Float64 |
5 |
Shape parameter only used for Kaiser window. See kaiser_window() for details. |
fn make_window Returns
: List
Static Method
This is a static method.
(Functions that are not associated with a Struct)
fn rect_window¶
Generate a rectangular window of length size.
Signature
Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| size | Int64 |
— | Length of the window. |
Returns
Type: List
List containing the rectangular window values (all ones).
fn tri_window¶
Generate a triangular window of length size. Args: size: Length of the window. Returns: List containing the triangular window values.
Signature
Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| size | Int64 |
— | — |
Returns
Type: List
fn bessel_i0¶
Calculate the modified Bessel function of the first kind, order 0 (I₀). Uses polynomial approximation for accurate results.
Signature
Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| x | Float64 |
— | Input value. |
Returns
Type: Float64
I₀(x).
fn kaiser_window¶
Create a Kaiser window of length n with shape parameter beta.
- beta = 0: rectangular window.
- beta = 5: similar to Hamming window.
- beta = 6: similar to Hanning window.
- beta = 8.6: similar to Blackman window.
Signature
Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| size | Int64 |
— | Length of the window. |
| beta | Float64 |
— | Shape parameter that controls the trade-off between main lobe width and side lobe level. See description for details. |
Returns
Type: List
List[Float64] containing the Kaiser window coefficients.
fn hann_window¶
Generate a Hann window of length size.
Signature
Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| size | Int64 |
— | Length of the window. |
Returns
Type: List
List containing the Hann window values.
fn hamming_window¶
Generate a Hamming window of length size.
Signature
Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| size | Int64 |
— | Length of the window. |
Returns
Type: List
List containing the Hamming window values.
fn blackman_window¶
Generate a Blackman window of length size.
Signature
Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| size | Int64 |
— | Length of the window. |
Returns
Type: List
List containing the Blackman window values.
fn sine_window¶
Generate a Sine window of length size.
Signature
Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| size | Int64 |
— | Length of the window. |
Returns
Type: List
List containing the Sine window values.
fn pan2_window¶
Generate a SIMD[DType.float64, 2] quarter cosine window for panning. The first element of the SIMD vector is the multiplier for the left channel, and the second element is for the right channel. This allows any sample to be panned at one of size positions between left and right channels smoothly.
Signature
Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| size | Int64 |
— | Length of the window. |
Returns
Type: List
List containing the quarter cosine window values.
Documentation generated with mojo doc from Mojo version 0.25.6.1