|
DSPark 1.8.0
Header-only C++20 DSP for real-time and offline audio
|
Reusable periodic-Hann real spectrum, without feature history. More...
#include <OnsetFeatures.h>
Public Member Functions | |
| void | prepare (int fftSize) |
| Allocates a valid power-of-two frame; the caller owns frame timing. | |
| void | compute (const T *input, bool withPhase=true) noexcept |
| Evaluates one contiguous frame, optionally including bin phases. Input is finite and scaled by the caller to avoid overflow in the FFT and squared magnitudes. Suppressing phases avoids unnecessary atan2 work for a pooled magnitude spectrum, which has no unique complex-domain phase. | |
| bool | computePooled (AudioBufferView< const T > frame) noexcept |
| Pools mono/stereo spectral energy without a phase-cancelling downmix. The view must contain exactly one prepared frame. Invalid shape returns false; callers must not consume old magnitudes after failure. Two channels share one FFT instance and scratch, with one transform per channel. Equal magnitudes (including dual mono and antiphase) retain their exact value. | |
| std::span< T > | magnitudes () noexcept |
| Borrowed scratch, valid until the next compute/prepare or destruction. | |
| std::span< const T > | phases () const noexcept |
| Empty when the last frame did not compute phases. Same scratch lifetime. | |
Static Public Member Functions | |
| static int | defaultFrameSize (double sampleRate) noexcept |
| static std::size_t | preparationBytes (int fftSize) noexcept |
| Conservative setup payload allowance for a fresh power-of-two instance. | |
Reusable periodic-Hann real spectrum, without feature history.
Definition at line 80 of file OnsetFeatures.h.
|
inlinenoexcept |
Evaluates one contiguous frame, optionally including bin phases. Input is finite and scaled by the caller to avoid overflow in the FFT and squared magnitudes. Suppressing phases avoids unnecessary atan2 work for a pooled magnitude spectrum, which has no unique complex-domain phase.
Definition at line 122 of file OnsetFeatures.h.
|
inlinenoexcept |
Pools mono/stereo spectral energy without a phase-cancelling downmix. The view must contain exactly one prepared frame. Invalid shape returns false; callers must not consume old magnitudes after failure. Two channels share one FFT instance and scratch, with one transform per channel. Equal magnitudes (including dual mono and antiphase) retain their exact value.
Definition at line 144 of file OnsetFeatures.h.
|
inlinestaticnoexcept |
Definition at line 83 of file OnsetFeatures.h.
|
inlinenoexcept |
Borrowed scratch, valid until the next compute/prepare or destruction.
Definition at line 168 of file OnsetFeatures.h.
|
inlinenoexcept |
Empty when the last frame did not compute phases. Same scratch lifetime.
Definition at line 174 of file OnsetFeatures.h.
|
inlinestaticnoexcept |
Conservative setup payload allowance for a fresh power-of-two instance.
Definition at line 93 of file OnsetFeatures.h.
|
inline |
Allocates a valid power-of-two frame; the caller owns frame timing.
Definition at line 103 of file OnsetFeatures.h.