Shared whitening, spectral/complex flux and SuperFlux feature history.
More...
#include <OnsetFeatures.h>
|
| void | prepare (double sampleRate, int fftSize, bool boundedWorkspace=false, int pickLag=1, int persistLag=0, int persistSpan=1, int contentBack=0, int contentAhead=0, int contentHold=0, int contentSpan=1) |
| | Allocates histories and the canonical quarter-tone filterbank.
|
| |
| void | reset () noexcept |
| | Clears feature history without allocation or changing the filterbank.
|
| |
| int | getNumBands () const noexcept |
| |
| T | contentShare () noexcept |
| | New-content share of the frame contentHold back from the last processed one (prepare()); zero when no content hold is configured. Computed on request, allocation free.
|
| |
| void | setLinearFlux (bool on) noexcept |
| | Computes Frame::linear alongside SuperFlux. Allocation free.
|
| |
| Frame | process (std::span< T > mag, std::span< const T > phase, Method method, bool whiten=false) noexcept |
| | Advances one frame; optional whitening modifies the supplied magnitudes. Phase-less frames support SpectralFlux, SuperFlux and BothFlux. ComplexDomain requires phases on every frame since reset; missing/incompatible data returns valid=false without changing history. No source clock is inferred here.
|
| |
|
| static std::size_t | preparationBytes (int fftSize) noexcept |
| | Setup payload allowance when prepare() reserves the bounded filterbank.
|
| |
template<FloatType T>
class dspark::detail::OnsetNovelty< T >
Shared whitening, spectral/complex flux and SuperFlux feature history.
Definition at line 221 of file OnsetFeatures.h.
◆ Method
| Enumerator |
|---|
| SpectralFlux | |
| ComplexDomain | |
| SuperFlux | |
| BothFlux | |
Definition at line 224 of file OnsetFeatures.h.
◆ contentShare()
New-content share of the frame contentHold back from the last processed one (prepare()); zero when no content hold is configured. Computed on request, allocation free.
A band counts when its energy contentAhead after that frame is more than kContentGain times the largest energy it, or either neighbour, held over the contentSpan frames ending contentBack before it; it then contributes the smaller of its energies contentAhead and contentHold after the frame. The share is their sum over all band energy contentAhead after the frame. A note that starts while a louder one ends raises its own bands and holds them; the spectral spread of a note-off raises bands that are silent again a few frames later, and the neighbours and the span keep a vibrato or a tremolo from reading as new. Frames of the functions that compute no bands read as silence.
Definition at line 359 of file OnsetFeatures.h.
◆ getNumBands()
◆ preparationBytes()
◆ prepare()
template<FloatType T>
| void dspark::detail::OnsetNovelty< T >::prepare |
( |
double |
sampleRate, |
|
|
int |
fftSize, |
|
|
bool |
boundedWorkspace = false, |
|
|
int |
pickLag = 1, |
|
|
int |
persistLag = 0, |
|
|
int |
persistSpan = 1, |
|
|
int |
contentBack = 0, |
|
|
int |
contentAhead = 0, |
|
|
int |
contentHold = 0, |
|
|
int |
contentSpan = 1 |
|
) |
| |
|
inline |
Allocates histories and the canonical quarter-tone filterbank.
- Parameters
-
| sampleRate | Sample rate in Hz. |
| fftSize | Power-of-two frame size. |
| boundedWorkspace | Reserve the filterbank's worst-case size up front. |
| pickLag | Frames back the SuperFlux pick value compares with (1, the default, is the value itself and keeps no extra history). |
| persistLag | Frames back the persistence value compares with (0, the default, disables it). Lags above 1 keep a ring of max-filtered band frames, allocated here. |
| persistSpan | Frames, ending persistLag back, whose band-wise maximum the persistence value compares with: a partial whose level oscillates within the span does not read as a rise. |
| contentBack | Frames before the content candidate its band energies are compared from. |
| contentAhead | Frames after the candidate they are compared at. |
| contentHold | Frames after the candidate the grown bands must still hold their energy at; 0 (the default) disables contentShare(), and it must exceed contentAhead otherwise. A ring of band energies is allocated here. |
| contentSpan | Frames, ending contentBack before the candidate, whose band-wise maximum the energies are compared from: a sound whose level or pitch oscillates within the span does not read as new content. |
Definition at line 285 of file OnsetFeatures.h.
◆ process()
Advances one frame; optional whitening modifies the supplied magnitudes. Phase-less frames support SpectralFlux, SuperFlux and BothFlux. ComplexDomain requires phases on every frame since reset; missing/incompatible data returns valid=false without changing history. No source clock is inferred here.
Definition at line 405 of file OnsetFeatures.h.
◆ reset()
Clears feature history without allocation or changing the filterbank.
Definition at line 322 of file OnsetFeatures.h.
◆ setLinearFlux()
◆ kNumRegisters
The documentation for this class was generated from the following file: