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

Options for the THD analyzer. More...

#include <audio_spectrum.hpp>

Public Attributes

int fft_length = 16384
int analysis_offset = 0
int num_harmonics = 8
 Harmonics above the fundamental to include.
int channel = 0
float amplitude = 0.5f
 Sine amplitude (linear) used when a scenario-driven analyzer synthesizes the stimulus tone (see test/support/audio_doctor.hpp).
Window non_coherent_window = Window::hann
 Window used when the tone is NOT bin-coherent (a coherent tone always uses rectangular — it leaks nothing, so no taper can improve on it).
double kaiser_beta = kDefaultKaiserBeta
 β for Window::kaiser; ignored by every other window.

Detailed Description

Options for the THD analyzer.

fft_length must be a power of two; pick fundamental_hz bin-coherent with it for a required-gate reading.

Member Data Documentation

◆ amplitude

float pulp::test::audio::ThdOptions::amplitude = 0.5f

Sine amplitude (linear) used when a scenario-driven analyzer synthesizes the stimulus tone (see test/support/audio_doctor.hpp).

Ignored by the buffer-level measure_thd below, which analyzes an already-rendered signal — kept here so both entry points share one options struct.

◆ analysis_offset

int pulp::test::audio::ThdOptions::analysis_offset = 0

◆ channel

int pulp::test::audio::ThdOptions::channel = 0

◆ fft_length

int pulp::test::audio::ThdOptions::fft_length = 16384

◆ kaiser_beta

double pulp::test::audio::ThdOptions::kaiser_beta = kDefaultKaiserBeta

β for Window::kaiser; ignored by every other window.

◆ non_coherent_window

Window pulp::test::audio::ThdOptions::non_coherent_window = Window::hann

Window used when the tone is NOT bin-coherent (a coherent tone always uses rectangular — it leaks nothing, so no taper can improve on it).

Defaults to hann, preserving the analyzer's long-standing non-coherent behavior. Raise it to blackman/kaiser when a non-coherent reading must resolve HARMONICS far below Hann's −31 dB side lobes.

It will NOT rescue thd_plus_n, and reaching for it there is a trap. THD treats a single bin as the fundamental, so a non-coherent tone's main-lobe spread is counted as noise — THD+N is dominated by main-lobe WIDTH here, and a deeper window is a wider one, so it measures more apparent noise, not less (pinned by test_audio_doctor.cpp). The fix for a trustworthy THD+N is a bin-coherent tone, never a better window.

◆ num_harmonics

int pulp::test::audio::ThdOptions::num_harmonics = 8

Harmonics above the fundamental to include.


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