Identity-phase-locked STFT analysis/synthesis core (internal).
More...
#include <PhaseVocoderEngine.h>
|
| struct | Params |
| | The control-published parameter set (adopted as ONE unit). More...
|
| |
|
| bool | prepare (double sampleRate, int numChannels, int fftSize, bool resampleCompensation, bool separationSupport=false, bool transientLockedHop=false, bool spectralFluxDetector=false) |
| | Allocates all rings and spectral state.
|
| |
| void | reset () noexcept |
| | Clears all signal state and re-adopts the latest published parameters (jump, no glide). Stream owner only.
|
| |
| void | publishParams (const Params &p) noexcept |
| | Publishes a whole parameter set (control thread only).
|
| |
| int | samplesToNextHop () const noexcept |
| |
| void | pushInput (int ch, const T *src, int count) noexcept |
| | Writes count samples (count <= samplesToNextHop()) into channel ch's analysis ring. Positions advance in commitInput().
|
| |
| void | commitInput (int count, int numActiveChannels) noexcept |
| | Advances the shared input position by count samples and runs one analysis->synthesis hop when the analysis boundary is reached.
|
| |
| double | activeRatio () const noexcept |
| |
| Params | activeParams () const noexcept |
| |
| const T * | olaData (int ch) const noexcept |
| |
| int64_t | olaMask () const noexcept |
| |
| int | olaSize () const noexcept |
| |
| int64_t | writeHead () const noexcept |
| |
| int | fftSize () const noexcept |
| |
| int | synthHop () const noexcept |
| |
template<FloatType T>
class dspark::detail::PhaseVocoderEngine< T >
Identity-phase-locked STFT analysis/synthesis core (internal).
- Template Parameters
-
| T | Sample type (float or double). |
Definition at line 183 of file PhaseVocoderEngine.h.
◆ activeParams()
- Returns
- The currently ADOPTED parameter set (audio thread / stream owner only: these are the audio-thread-private active copies, not the staged words). Changes only at hop boundaries or reset().
Definition at line 528 of file PhaseVocoderEngine.h.
◆ activeRatio()
- Returns
- The glided active stretch ratio (updates once per hop).
Definition at line 523 of file PhaseVocoderEngine.h.
◆ commitInput()
Advances the shared input position by count samples and runs one analysis->synthesis hop when the analysis boundary is reached.
- Parameters
-
| count | Samples pushed to every channel since the last commit (count <= samplesToNextHop()). |
| numActiveChannels | Channels to synthesize this hop (<= prepared). |
Definition at line 511 of file PhaseVocoderEngine.h.
◆ fftSize()
◆ olaData()
◆ olaMask()
◆ olaSize()
◆ prepare()
template<FloatType T>
| bool dspark::detail::PhaseVocoderEngine< T >::prepare |
( |
double |
sampleRate, |
|
|
int |
numChannels, |
|
|
int |
fftSize, |
|
|
bool |
resampleCompensation, |
|
|
bool |
separationSupport = false, |
|
|
bool |
transientLockedHop = false, |
|
|
bool |
spectralFluxDetector = false |
|
) |
| |
|
inline |
Allocates all rings and spectral state.
Invalid arguments (non-positive/non-finite rate, channel count < 1, or an fftSize that is not a power of two in [256, 1 << 20]) are rejected: nothing is touched and false is returned.
- Parameters
-
| sampleRate | Sample rate in Hz. |
| numChannels | Channel count (>= 1). |
| fftSize | STFT frame size, power of two in [256, 1<<20]. |
| resampleCompensation | True for owners that resample the synthesis stream back by ratio (PitchShifter): the engine then tapers bins that would land above Nyquist after resampling, and the formant pre-warp targets env(k*ratio). |
| separationSupport | True to allocate the harmonic/percussive median history, which is what lets an owner turn params.percussiveSplit on and off while streaming without ever allocating again. False leaves those buffers empty and the split permanently off. |
| transientLockedHop | True to force the analysis hop to Rs across a detected attack (see the file doc). Only an owner that reads the synthesis stream directly may ask for it. An owner that resamples the synthesis stream back advances its reader by ratio per input sample and so assumes Ra = Rs/ratio every hop; a locked hop breaks that assumption for the length of the lock and the reader runs past the write head into ring content no frame has written yet. Measured on a click train, which is 84% silence - 48 kHz, 10 s at 120 BPM, a 2048-sample frame, over -12 to +12 semitones: locking the hop under a resample-back reader raises the output RMS by 0.8 to 5.9 dB, which is energy appearing in the silence. How far it rises is a property of that bed - a sparser one has more silence to fill - so the range is a reading and not a bound. The lock also buys such an owner nothing, because resampling puts the strike back where it started whatever the analysis hop did. |
| spectralFluxDetector | True to detect onsets by log-filterbank spectral flux, false to keep the broadband frame-energy test (see the file doc). It is the owner's choice and not the engine's, and it defaults to the energy test, because the detector decides where phase is reset and so it is part of an owner's rendering: an owner whose output has already been released cannot change detector without changing renders its users already have. On strikes over sustained material the flux detector fires earlier and more often: that is the point of it, and the cost is that each extra reset loosens the strike and smears energy ahead of the attack, which is audible as pre-echo. How much of either depends on the material and on the estimator it is measured with, so the trade is named here and its size is left to the owner that asks for it. Only an owner that needs onsets its schedule can act on - which the energy test cannot supply over sustained material - should ask for it, and its own acceptance measurements then cover it. False also leaves the filterbank unallocated and the flux front end permanently off. |
- Returns
- true if the engine (re)allocated and is ready for reset().
Definition at line 280 of file PhaseVocoderEngine.h.
◆ publishParams()
Publishes a whole parameter set (control thread only).
Canonical seqlock publish; see the file doc for the fence derivation. The set is adopted as one unit at the next analysis hop (or at reset()); the active shift then glides toward the target at up to 0.5 semitones per hop. May be called before prepare().
Definition at line 465 of file PhaseVocoderEngine.h.
◆ pushInput()
◆ reset()
Clears all signal state and re-adopts the latest published parameters (jump, no glide). Stream owner only.
Definition at line 422 of file PhaseVocoderEngine.h.
◆ samplesToNextHop()
- Returns
- Samples the owner may push before the next analysis hop fires.
Definition at line 485 of file PhaseVocoderEngine.h.
◆ synthHop()
◆ writeHead()
- Returns
- Absolute write head of the OLA ring (advances Rs per hop).
Definition at line 555 of file PhaseVocoderEngine.h.
The documentation for this class was generated from the following file: