Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::test::audio::ToneFit Struct Reference

Least-squares fit of a single sinusoid at a known frequency. More...

#include <audio_spectrum.hpp>

Public Attributes

double cycles_per_sample = 0.0
 The frequency fitted (f / sample_rate).
double sin_gain = 0.0
 Coefficient of sin(2π·f·n).
double cos_gain = 0.0
 Coefficient of cos(2π·f·n).
double amplitude = 0.0
 hypot(sin_gain, cos_gain).
double fitted_energy = 0.0
 Σ of the fitted tone squared.
double residual_energy = 0.0
 Σ of (samples − fitted) squared.

Detailed Description

Least-squares fit of a single sinusoid at a known frequency.

The fit spans both sin and cos, so the tone's PHASE is solved for, not assumed — amplitude is phase-independent and residual is unaffected by where the caller's segment happens to start.

Member Data Documentation

◆ amplitude

double pulp::test::audio::ToneFit::amplitude = 0.0

hypot(sin_gain, cos_gain).

◆ cos_gain

double pulp::test::audio::ToneFit::cos_gain = 0.0

Coefficient of cos(2π·f·n).

◆ cycles_per_sample

double pulp::test::audio::ToneFit::cycles_per_sample = 0.0

The frequency fitted (f / sample_rate).

◆ fitted_energy

double pulp::test::audio::ToneFit::fitted_energy = 0.0

Σ of the fitted tone squared.

◆ residual_energy

double pulp::test::audio::ToneFit::residual_energy = 0.0

Σ of (samples − fitted) squared.

◆ sin_gain

double pulp::test::audio::ToneFit::sin_gain = 0.0

Coefficient of sin(2π·f·n).


The documentation for this struct was generated from the following file:
  • /home/runner/work/pulp/pulp/tools/audio/analysis/include/pulp/audio/analysis/audio_spectrum.hpp