Skip to content
Structs

struct YIN

Monophonic Frequency ('F0') Detection using the YIN algorithm (FFT-based, O(N log N) version).

Traits: AnyType, BufferedProcessable, Copyable, Movable, UnknownDestructibility

YIN Parameters

Name Type Description
window_size Int The size of the analysis window in samples.
min_freq Float64 The minimum frequency to consider for pitch detection.
max_freq Float64 The maximum frequency to consider for pitch detection.

YIN Functions

struct YIN . fn init

Initialize the YIN pitch detector.

fn init Signature

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

fn init Arguments

Name Type Default Description
world UnsafePointer A pointer to the MMMWorld.

fn init Returns : Self An initialized YIN struct.

Static Method

This is a static method.

struct YIN . fn next_window

Compute the YIN pitch estimate for the given frame of audio samples.

fn next_window Signature

next_window(mut self, mut frame: List[Float64])

fn next_window Arguments

Name Type Default Description
frame List The input audio frame of size window_size. This List gets passed from BufferedProcess.

struct SpectralCentroid

Spectral Centroid analysis.

Traits: AnyType, Copyable, FFTProcessable, Movable, UnknownDestructibility

SpectralCentroid Parameters

Name Type Description
min_freq Float64 The minimum frequency (in Hz) to consider when computing the centroid.
max_freq Float64 The maximum frequency (in Hz) to consider when computing the centroid.
power_mag Bool If True, use power magnitudes (squared) for the centroid calculation.

SpectralCentroid Functions

struct SpectralCentroid . fn init

fn init Signature

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

fn init Arguments

Name Type Default Description
world UnsafePointer

fn init Returns : Self

Static Method

This is a static method.

struct SpectralCentroid . fn next_frame

Compute the spectral centroid for a given FFT analysis. This function is to be used by FFTProcess if SpectralCentroid is passed as the "process".

fn next_frame Signature

next_frame(mut self, mut mags: List[Float64], mut phases: List[Float64])

fn next_frame Arguments

Name Type Default Description
mags List The input magnitudes as a List of Float64.
phases List The input phases as a List of Float64.

struct SpectralCentroid . fn from_mags

Compute the spectral centroid for the given magnitudes of an FFT frame. This static method is useful when there is an FFT already computed, perhaps as part of a custom struct that implements the FFTProcessable trait.

fn from_mags Signature

from_mags(mags: List[Float64], sample_rate: Float64) -> Float64

fn from_mags Arguments

Name Type Default Description
mags List The input magnitudes as a List of Float64.
sample_rate Float64 The sample rate of the audio signal.

fn from_mags Returns : Float64 Float64. The spectral centroid value.

Static Method

This is a static method.

struct RMS

Root Mean Square (RMS) amplitude analysis.

Traits: AnyType, BufferedProcessable, Copyable, Movable, UnknownDestructibility


RMS Functions

struct RMS . fn init

Initialize the RMS analyzer.

fn init Signature

__init__(out self)

fn init Returns : Self

Static Method

This is a static method.

struct RMS . fn next_window

Compute the RMS for the given window of audio samples. This function is to be used with a BufferedProcess.

None. The computed RMS value is stored in self.rms.

fn next_window Signature

next_window(mut self, mut input: List[Float64])

fn next_window Arguments

Name Type Default Description
input List The input audio frame of samples. This List gets passed from BufferedProcess.

struct RMS . fn from_window

Compute the RMS for the given window of audio samples. This static method is useful when there is an audio frame already available, perhaps as part of a custom struct that implements the BufferedProcessable trait.

fn from_window Signature

from_window(mut frame: List[Float64]) -> Float64

fn from_window Arguments

Name Type Default Description
frame List The input audio frame of samples.

fn from_window Returns : Float64 Float64. The computed RMS value.

Static Method

This is a static method.


Documentation generated with mojo doc from Mojo version 0.25.6.1