ASPiK SDK
Loading...
Searching...
No Matches
PSMVocoder Class Reference

The PSMVocoder object implements a phase vocoder pitch shifter. Phase locking and peak tracking are optional. More...

#include <fxobjects.h>

Inheritance diagram for PSMVocoder:
IAudioSignalProcessor

Public Member Functions

virtual bool reset (double _sampleRate)
 
virtual bool canProcessAudioFrame ()
 
void setPitchShift (double semitones)
 
int findPreviousNearestPeak (int peakIndex)
 
void findPeaksAndRegionsOfInfluence ()
 
virtual double processAudioSample (double input)
 
PSMVocoderParameters getParameters ()
 
void setParameters (const PSMVocoderParameters &params)
 
- Public Member Functions inherited from IAudioSignalProcessor
virtual bool reset (double _sampleRate)=0
 
virtual double processAudioSample (double xn)=0
 
virtual bool canProcessAudioFrame ()=0
 
virtual void setSampleRate (double _sampleRate)
 
virtual void enableAuxInput (bool enableAuxInput)
 
virtual double processAuxInputAudioSample (double xn)
 
virtual bool processAudioFrame (const float *inputFrame, float *outputFrame, uint32_t inputChannels, uint32_t outputChannels)
 

Protected Attributes

PSMVocoderParameters parameters
 object parameters
 
PhaseVocoder vocoder
 vocoder to perform PSM
 
double alphaStretchRatio = 1.0
 alpha stretch ratio = hs/ha
 
const double hs = PSM_FFT_LEN / 4
 hs = N/4 — 75% overlap
 
double ha = PSM_FFT_LEN / 4
 ha = N/4 — 75% overlap
 
double phi [PSM_FFT_LEN] = { 0.0 }
 array of phase values for classic algorithm
 
double psi [PSM_FFT_LEN] = { 0.0 }
 array of phase correction values for classic algorithm
 
BinData binData [PSM_FFT_LEN]
 array of BinData structures for current FFT frame
 
BinData binDataPrevious [PSM_FFT_LEN]
 array of BinData structures for previous FFT frame
 
int peakBins [PSM_FFT_LEN] = { -1 }
 array of current peak bin index values (-1 = not peak)
 
int peakBinsPrevious [PSM_FFT_LEN] = { -1 }
 array of previous peak bin index values (-1 = not peak)
 
double * windowBuff = nullptr
 buffer for window
 
double * outputBuff = nullptr
 buffer for resampled output
 
double windowCorrection = 0.0
 window correction value
 
unsigned int outputBufferLength = 0
 lenght of resampled output array
 

Detailed Description

The PSMVocoder object implements a phase vocoder pitch shifter. Phase locking and peak tracking are optional.

Audio I/O:

  • Processes mono input to mono output.

Control I/F:

Author
Will Pirkle http://www.willpirkle.com
Remarks
This object is included in Designing Audio Effects Plugins in C++ 2nd Ed. by Will Pirkle
Version
Revision : 1.0
Date
Date : 2018 / 09 / 7

Member Function Documentation

◆ canProcessAudioFrame()

virtual bool PSMVocoder::canProcessAudioFrame ( )
inlinevirtual

return false: this object only processes samples

Implements IAudioSignalProcessor.

◆ findPeaksAndRegionsOfInfluence()

void PSMVocoder::findPeaksAndRegionsOfInfluence ( )
inline

identify peak bins and tag their respective regions of influence

◆ findPreviousNearestPeak()

int PSMVocoder::findPreviousNearestPeak ( int  peakIndex)
inline

find bin index of nearest peak bin in previous FFT frame

◆ getParameters()

PSMVocoderParameters PSMVocoder::getParameters ( )
inline

get parameters: note use of custom structure for passing param data

Returns
PSMVocoderParameters custom data structure

◆ processAudioSample()

virtual double PSMVocoder::processAudioSample ( double  input)
inlinevirtual

process input sample through PSM vocoder

Parameters
xninput
Returns
the processed sample

Implements IAudioSignalProcessor.

◆ reset()

virtual bool PSMVocoder::reset ( double  _sampleRate)
inlinevirtual

reset members to initialized state

Implements IAudioSignalProcessor.

◆ setParameters()

void PSMVocoder::setParameters ( const PSMVocoderParameters params)
inline

set parameters: note use of custom structure for passing param data

Parameters
PSMVocoderParameterscustom data structure

◆ setPitchShift()

void PSMVocoder::setPitchShift ( double  semitones)
inline

set the pitch shift in semitones (note that this can be fractional too)


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