ComplexFFTProcess
trait ComplexFFTProcessable¶
Implement this trait in a custom struct to pass to FFTProcess as a Parameter.
See TestFFTProcess.mojo for an example on how to create a spectral process
using a struct that implements FFTProcessable.
ComplexFFTProcessable Required Methods¶
trait ComplexFFTProcessable . fn init¶
Create a new instance of the value by copying an existing one.
Signature
Arguments
- copy:
_Self- The value to copy. Returns
Type: _Self
Create a new instance of the value by moving the value of another.
Signature
Arguments
- take:
_Self- The value to move. Returns
Type: _Self
trait ComplexFFTProcessable . fn next_frame¶
Signature
Arguments
- complex:
List[ComplexSIMD[DType.float64, 1]]
Default Implementation
This method has a default implementation.
trait ComplexFFTProcessable . fn next_stereo_frame¶
Signature
Arguments
- complex:
List[ComplexSIMD[DType.float64, 2]]
Default Implementation
This method has a default implementation.
trait ComplexFFTProcessable . fn get_messages¶
Signature
Default Implementation
This method has a default implementation.
struct ComplexFFTProcess¶
Create an FFTProcess for audio manipulation in the frequency domain. This version will output and input complex frequency bins directly rather than magnitude and phase. This is currently untested.
Traits: AnyType, Copyable, ImplicitlyDestructible, Movable
ComplexFFTProcess Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| T | ComplexFFTProcessable |
— | A user defined struct that implements the FFTProcessable trait. |
| ifft | Bool |
True |
A boolean specifying whether to perform an IFFT after processing in the frequency domain. |
| input_window_shape | Int |
WindowType.hann |
Int specifying what window shape to use to modify the amplitude of the input samples before the FFT. See WindowType for the options. |
| output_window_shape | Int |
WindowType.hann |
Int specifying what window shape to use to modify the amplitude of the output samples after the IFFT. See WindowType for the options. |
ComplexFFTProcess Functions¶
struct ComplexFFTProcess . fn init¶
Initializes a FFTProcess struct.
fn init Signature
__init__(out self, world: UnsafePointer[MMMWorld, MutExternalOrigin], var process: T, window_size: Int, hop_size: Int)
fn init Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| world | UnsafePointer[MMMWorld, MutExternalOrigin] |
— | A pointer to the MMMWorld. |
| process | T |
— | A user defined struct that implements the FFTProcessable trait. |
| window_size | Int |
— | The size of the window to use for processing. This will determine how many samples are passed to the user defined struct's .next_window() method. |
| hop_size | Int |
— | The number of samples between the beginning of FFT windows. |
fn init Returns
: Self
An initialized FFTProcess struct.
Static Method
This is a static method.
struct ComplexFFTProcess . fn get_process¶
fn get_process Signature
fn get_process Returns
: ref[self.buffered_process.process.process] T
struct ComplexFFTProcess . fn next¶
Processes the next input sample and returns the next output sample.
fn next Signature
fn next Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | Float64 |
— | The next input sample to process. |
fn next Returns
: Float64
The next output sample.
struct ComplexFFTProcess . fn next_stereo¶
Processes the next stereo input sample and returns the next output sample.
fn next_stereo Signature
fn next_stereo Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| input | SIMD[DType.float64, 2] |
— | The next input samples to process. |
fn next_stereo Returns
: SIMD[DType.float64, 2]
The next output samples.
struct ComplexFFTProcess . fn next_from_buffer¶
Returns the next output sample from the internal buffered process. The buffered process reads a block of samples from the provided buffer at the given phase and channel on each hop.
fn next_from_buffer Signature
fn next_from_buffer Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| buffer | SIMDBuffer[1] |
— | The input buffer to read samples from. |
| phase | Float64 |
— | The current phase to read from the buffer. Between 0 (beginning) and 1 (end). |
| chan | Int |
0 |
The channel to read from the buffer. |
fn next_from_buffer Returns
: Float64
The next output sample.
struct ComplexFFTProcess . fn next_from_stereo_buffer¶
Returns the next stereo output sample from the internal buffered process. The buffered process reads a block of samples from the provided buffer at the given phase and channel on each hop.
fn next_from_stereo_buffer Signature
fn next_from_stereo_buffer Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| buffer | SIMDBuffer |
— | The input buffer to read samples from. |
| phase | Float64 |
— | The current phase to read from the buffer. Between 0 (beginning) and 1 (end). |
fn next_from_stereo_buffer Returns
: SIMD[DType.float64, 2]
The next stereo output sample.
Documentation generated with mojo doc from Mojo version 1.0.0b1