Signalsmith Audio's DSP Library  1.6.0
Useful C++ classes/templates for audio effects
Methods | Attributes
signalsmith::spectral::ProcessSTFT< Sample > Class Template Reference

#include <spectral.h>

Detailed Description

template<typename Sample>
class signalsmith::spectral::ProcessSTFT< Sample >

STFT processing, with input/output.

Before calling .ensureValid(index), you should make sure the input is filled up to index.

Inherits signalsmith::spectral::STFT< Sample >.

Methods

 ProcessSTFT (int inChannels, int outChannels, int windowSize, int interval, int historyLength=0)
 
virtual void processSpectrum (int)
 Alter the spectrum, using input up to this point, for the output block starting from this point. More...
 
void resize (int inChannels, int outChannels, int windowSize, int interval, int historyLength=0)
 Sets the input/output channels, FFT size and interval. More...
 
void reset (Sample value=Sample())
 
int latency ()
 Internal latency, including buffering samples for analysis. More...
 
void ensureValid (int i=0)
 
ProcessSTFToperator++ ()
 
ProcessSTFToperator+= (int i)
 
ProcessSTFToperator-- ()
 
ProcessSTFToperator-= (int i)
 
- Methods inherited from signalsmith::spectral::STFT< Sample >
void setWindow (Window shape, bool rotateToZero=false)
 Swaps between the default (Kaiser) shape and Approximate Confined Gaussian (ACG). More...
 
 STFT (int channels, int windowSize, int interval, int historyLength=0, int zeroPadding=0)
 Parameters passed straight to .resize() More...
 
void resize (int nChannels, int windowSize, int interval, int historyLength=0, int zeroPadding=0)
 Sets the channel-count, FFT size and interval. More...
 
int windowSize () const
 
int fftSize () const
 
int interval () const
 
decltype(fft.window()) window () const
 Returns the (analysis and synthesis) window. More...
 
std::vector< Sample > partialSumWindow (bool includeLatestBlock=true) const
 Calculates the effective window for the partially-summed future output (relative to the most recent block) More...
 
void reset ()
 Resets everything - since we clear the output sum, it will take windowSize samples to get proper output. More...
 
template<class AnalysisFn >
void ensureValid (int i, AnalysisFn fn)
 Generates valid output up to the specified index (or 0), using the callback as many times as needed. More...
 
template<class AnalysisFn >
void ensureValid (AnalysisFn fn)
 The same as above, assuming index 0. More...
 
int nextInvalid () const
 Returns the next invalid index (a.k.a. the index of the next block) More...
 
template<class Data >
void analyse (Data &&data)
 Analyse a multi-channel input, for any type where data[channel][index] returns samples. More...
 
template<class Data >
void analyse (int c, Data &&data)
 
template<class Data >
void analyseRaw (Data &&data)
 Analyse without windowing or zero-rotation. More...
 
template<class Data >
void analyseRaw (int c, Data &&data)
 
int bands () const
 
int latency ()
 Internal latency (between the block-index requested in .ensureValid() and its position in the output) More...
 
STFToperator++ ()
 
STFToperator+= (int i)
 
STFToperator-- ()
 
STFToperator-= (int i)
 
Super::MutableView operator++ (int postIncrement)
 
Super::MutableView operator-- (int postIncrement)
 
- Methods inherited from signalsmith::delay::MultiBuffer< Sample >
 MultiBuffer (int channels=0, int capacity=0)
 
void resize (int nChannels, int capacity, Sample value=Sample())
 
void reset (Sample value=Sample())
 
Stride< false > at (int offset)
 
Stride< true > at (int offset) const
 
MutableView view (int offset=0)
 
ConstView view (int offset=0) const
 
ConstView constView (int offset=0) const
 
MutableChannel operator[] (int channel)
 
ConstChannel operator[] (int channel) const
 
MultiBufferoperator++ ()
 
MultiBufferoperator+= (int i)
 
MutableView operator++ (int)
 
MutableView operator+ (int i)
 
ConstView operator+ (int i) const
 
MultiBufferoperator-- ()
 
MultiBufferoperator-= (int i)
 
MutableView operator-- (int)
 
MutableView operator- (int i)
 
ConstView operator- (int i) const
 

Attributes

signalsmith::delay::MultiBuffer< Sample > input
 
- Attributes inherited from signalsmith::spectral::STFT< Sample >
Window windowShape = Window::kaiser
 
Spectrum spectrum
 
WindowedFFT< Sample > fft
 

Additional Inherited Members

- Types inherited from signalsmith::spectral::STFT< Sample >
enum class  Window { kaiser , acg }
 
using Spectrum = MultiSpectrum
 
- Types inherited from signalsmith::delay::MultiBuffer< Sample >
using ConstChannel = typename Buffer< Sample >::ConstView
 
using MutableChannel = typename Buffer< Sample >::MutableView
 
using MutableView = View< false >
 
using ConstView = View< true >
 
- Static Attributes inherited from signalsmith::spectral::STFT< Sample >
static constexpr Window kaiser = Window::kaiser
 
static constexpr Window acg = Window::acg
 

Method Details

◆ latency()

template<typename Sample >
int signalsmith::spectral::ProcessSTFT< Sample >::latency ( )
inline

Internal latency, including buffering samples for analysis.

◆ processSpectrum()

template<typename Sample >
virtual void signalsmith::spectral::ProcessSTFT< Sample >::processSpectrum ( int  )
inlinevirtual

Alter the spectrum, using input up to this point, for the output block starting from this point.

Sub-classes should replace this with whatever processing is desired.

◆ resize()

template<typename Sample >
void signalsmith::spectral::ProcessSTFT< Sample >::resize ( int  inChannels,
int  outChannels,
int  windowSize,
int  interval,
int  historyLength = 0 
)
inline

Sets the input/output channels, FFT size and interval.