Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
spectrum_trace.hpp File Reference

Fixed-capacity conditioning for FFT magnitude frames. More...

#include <algorithm>
#include <array>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <span>
#include <type_traits>

Go to the source code of this file.

Classes

struct  pulp::signal::SpectrumTraceConfig
struct  pulp::signal::SpectrumTraceFrameT< SampleType, MaxBands >
class  pulp::signal::SpectrumTraceT< SampleType, MaxInputBins, MaxBands >

Namespaces

namespace  pulp
namespace  pulp::signal

Typedefs

using pulp::signal::SpectrumTrace = SpectrumTraceT<float>
using pulp::signal::SpectrumTrace64 = SpectrumTraceT<double>

Enumerations

enum class  pulp::signal::SpectrumBandScale : std::uint8_t { pulp::signal::linear , pulp::signal::logarithmic }
enum class  pulp::signal::SpectrumBandAggregation : std::uint8_t { pulp::signal::mean_power , pulp::signal::maximum }
enum class  pulp::signal::SpectrumFrequencyWeighting : std::uint8_t { pulp::signal::none , pulp::signal::a , pulp::signal::c }

Detailed Description

Fixed-capacity conditioning for FFT magnitude frames.

Input is one-sided FFT magnitude in amplitude dBFS (20*log10(|X|/ref)), ordered from DC through Nyquist, with exactly fft_size / 2 + 1 bin centers at k * sample_rate / fft_size. Band means convert those dB values to linear power, average, then convert back to dB. DC and Nyquist participate only when the configured band edges include their centers. A band containing no FFT bin center remains at floor_db; it never borrows or duplicates a nearby out-of-range bin.

This class owns band aggregation, additive A/C weighting, attack/release smoothing, and peak hold/decay. Attack/release and peak decay are explicit per-input-frame values; the defaults preserve the existing UI's 0.5/0.15 coefficients. Callers own the window/hop cadence and upstream analysis latency because this class deliberately does not duplicate an FFT. current() exposes same-thread state only; callers must provide their own synchronized snapshot/mailbox when publishing frames across threads.