DSPark 1.8.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
dspark::detail::StudioVocoder< T > Class Template Reference

Streaming phase-gradient vocoder with a strike-anchored time map. More...

#include <StudioVocoder.h>

Classes

struct  Params
 The control-published parameter set (adopted as ONE unit). More...
 

Public Member Functions

bool prepare (double sampleRate, int numChannels, int fftSize, bool resampleCompensation)
 Allocates every buffer the stream will use.
 
void reset () noexcept
 Clears all signal state and adopts the latest parameters (jump, no glide). Stream owner only.
 
void publishParams (const Params &p) noexcept
 Publishes a whole parameter set (one control thread only).
 
int samplesToNextHop () const noexcept
 
void pushInput (int ch, const T *src, int count) noexcept
 Writes count (<= samplesToNextHop(), or any count when it is 0... see commitInput) samples of channel ch at the input head.
 
void commitInput (int count, int numActiveChannels) noexcept
 Advances the input head by count and runs at most one frame.
 
void steerTimeline (double nominalCentre) noexcept
 Owner-supplied nominal analysis centre for the NEXT frame (a resampling owner keeps its reader and the timeline in step with it).
 
void setAnchorLeadLimit (double samples) noexcept
 Caps how far a strike anchor may move the analysis ahead of the nominal timeline, in input samples (owner with a fixed latency budget; unlimited by default).
 
double activeRatio () const noexcept
 
double nextNominalCentre () const noexcept
 
double nextStreamCentre () const noexcept
 
double streamPositionOf (double x) 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
 
int lookahead () const noexcept
 
int64_t inputCount () const noexcept
 

Detailed Description

template<FloatType T>
class dspark::detail::StudioVocoder< T >

Streaming phase-gradient vocoder with a strike-anchored time map.

Template Parameters
TSample type (float or double).

Definition at line 98 of file StudioVocoder.h.

Member Function Documentation

◆ activeRatio()

template<FloatType T>
double dspark::detail::StudioVocoder< T >::activeRatio ( ) const
inlinenoexcept
Returns
The glided active ratio (stretch factor, stream per input).

Definition at line 326 of file StudioVocoder.h.

◆ commitInput()

template<FloatType T>
void dspark::detail::StudioVocoder< T >::commitInput ( int  count,
int  numActiveChannels 
)
inlinenoexcept

Advances the input head by count and runs at most one frame.

The onset detector consumes the new input first, so a strike it finds is planned before the frame that would reach it is analysed.

Definition at line 297 of file StudioVocoder.h.

◆ fftSize()

template<FloatType T>
int dspark::detail::StudioVocoder< T >::fftSize ( ) const
inlinenoexcept

Definition at line 348 of file StudioVocoder.h.

◆ inputCount()

template<FloatType T>
int64_t dspark::detail::StudioVocoder< T >::inputCount ( ) const
inlinenoexcept
Returns
Input samples committed since reset().

Definition at line 353 of file StudioVocoder.h.

◆ lookahead()

template<FloatType T>
int dspark::detail::StudioVocoder< T >::lookahead ( ) const
inlinenoexcept
Returns
How far (samples) the analysis trails the newest input.

Definition at line 351 of file StudioVocoder.h.

◆ nextNominalCentre()

template<FloatType T>
double dspark::detail::StudioVocoder< T >::nextNominalCentre ( ) const
inlinenoexcept
Returns
Nominal analysis centre (input coordinate) of the next frame.

Definition at line 329 of file StudioVocoder.h.

◆ nextStreamCentre()

template<FloatType T>
double dspark::detail::StudioVocoder< T >::nextStreamCentre ( ) const
inlinenoexcept
Returns
Stream centre of the next frame.

Definition at line 332 of file StudioVocoder.h.

◆ olaData()

template<FloatType T>
const T * dspark::detail::StudioVocoder< T >::olaData ( int  ch) const
inlinenoexcept

Definition at line 343 of file StudioVocoder.h.

◆ olaMask()

template<FloatType T>
int64_t dspark::detail::StudioVocoder< T >::olaMask ( ) const
inlinenoexcept

Definition at line 344 of file StudioVocoder.h.

◆ olaSize()

template<FloatType T>
int dspark::detail::StudioVocoder< T >::olaSize ( ) const
inlinenoexcept

Definition at line 345 of file StudioVocoder.h.

◆ prepare()

template<FloatType T>
bool dspark::detail::StudioVocoder< T >::prepare ( double  sampleRate,
int  numChannels,
int  fftSize,
bool  resampleCompensation 
)
inline

Allocates every buffer the stream will use.

Parameters
sampleRateSample rate in Hz.
numChannelsChannel count (>= 1).
fftSizeFrame size, power of two in [256, 1 << 20].
resampleCompensationTrue for owners that resample the stream by the ratio afterwards (pitch shifting): enables the anti-alias taper and the formant pre-warp.
Returns
false (nothing touched) on invalid arguments.

Definition at line 129 of file StudioVocoder.h.

◆ publishParams()

template<FloatType T>
void dspark::detail::StudioVocoder< T >::publishParams ( const Params &  p)
inlinenoexcept

Publishes a whole parameter set (one control thread only).

Definition at line 260 of file StudioVocoder.h.

◆ pushInput()

template<FloatType T>
void dspark::detail::StudioVocoder< T >::pushInput ( int  ch,
const T *  src,
int  count 
)
inlinenoexcept

Writes count (<= samplesToNextHop(), or any count when it is 0... see commitInput) samples of channel ch at the input head.

Definition at line 283 of file StudioVocoder.h.

◆ reset()

template<FloatType T>
void dspark::detail::StudioVocoder< T >::reset ( )
inlinenoexcept

Clears all signal state and adopts the latest parameters (jump, no glide). Stream owner only.

Definition at line 212 of file StudioVocoder.h.

◆ samplesToNextHop()

template<FloatType T>
int dspark::detail::StudioVocoder< T >::samplesToNextHop ( ) const
inlinenoexcept
Returns
Input samples to push before the next frame can run (0 = the next commitInput() runs it).

Definition at line 275 of file StudioVocoder.h.

◆ setAnchorLeadLimit()

template<FloatType T>
void dspark::detail::StudioVocoder< T >::setAnchorLeadLimit ( double  samples)
inlinenoexcept

Caps how far a strike anchor may move the analysis ahead of the nominal timeline, in input samples (owner with a fixed latency budget; unlimited by default).

A lock of half-width h runs h (1/r - 1) ahead of the timeline as it starts below ratio 1, and h (1 - 1/r) ahead as it ends above it; the cap narrows the lock instead of letting a frame need input the owner's latency does not cover.

Definition at line 323 of file StudioVocoder.h.

◆ steerTimeline()

template<FloatType T>
void dspark::detail::StudioVocoder< T >::steerTimeline ( double  nominalCentre)
inlinenoexcept

Owner-supplied nominal analysis centre for the NEXT frame (a resampling owner keeps its reader and the timeline in step with it).

Definition at line 307 of file StudioVocoder.h.

◆ streamPositionOf()

template<FloatType T>
double dspark::detail::StudioVocoder< T >::streamPositionOf ( double  x) const
inlinenoexcept
Returns
Stream position of input x on the timeline in force at reset.

Definition at line 338 of file StudioVocoder.h.

◆ synthHop()

template<FloatType T>
int dspark::detail::StudioVocoder< T >::synthHop ( ) const
inlinenoexcept

Definition at line 349 of file StudioVocoder.h.

◆ writeHead()

template<FloatType T>
int64_t dspark::detail::StudioVocoder< T >::writeHead ( ) const
inlinenoexcept
Returns
End of the completed overlap-add (advances Rs per frame).

Definition at line 347 of file StudioVocoder.h.


The documentation for this class was generated from the following file: