79 if (pData->
hSmb != NULL)
109 int nChannels, fftSize, osamp;
127 if (pData->
hSmb != NULL)
134 case PITCH_SHIFTER_OSAMP_2: osamp = 2;
break;
135 case PITCH_SHIFTER_OSAMP_4: osamp = 4;
break;
136 case PITCH_SHIFTER_OSAMP_8: osamp = 8;
break;
137 case PITCH_SHIFTER_OSAMP_16: osamp = 16;
break;
138 case PITCH_SHIFTER_OSAMP_32: osamp = 32;
break;
143 case PITCH_SHIFTER_FFTSIZE_512: fftSize = 512;
break;
144 case PITCH_SHIFTER_FFTSIZE_1024: fftSize = 1024;
break;
145 case PITCH_SHIFTER_FFTSIZE_2048: fftSize = 2048;
break;
146 case PITCH_SHIFTER_FFTSIZE_4096: fftSize = 4096;
break;
147 case PITCH_SHIFTER_FFTSIZE_8192: fftSize = 8192;
break;
148 case PITCH_SHIFTER_FFTSIZE_16384: fftSize = 16384;
break;
166 const float *
const * inputs,
167 float*
const*
const outputs,
174 int s, ch, nChannels;
178 for(s=0; s<nSamples; s++){
180 for(ch=0; ch<
SAF_MIN(nInputs,nChannels); ch++)
182 for(; ch<nChannels; ch++)
186 for(ch=0; ch<
SAF_MIN(nOutputs, nChannels); ch++)
188 for(; ch<nOutputs; ch++)
189 outputs[ch][s] = 0.0f;
200 for(ch=0; ch<nChannels; ch++)
207 for(ch=0; ch<nChannels; ch++)
#define MAX_NUM_CHANNELS
Maximum number of input/output channels supported.
#define PROGRESSBARTEXT_CHAR_LENGTH
Length of progress bar string.
@ PROC_STATUS_ONGOING
Codec is processing input audio, and should not be reinitialised at this time.
@ PROC_STATUS_NOT_ONGOING
Codec is not processing input audio, and may be reinitialised if needed.
CODEC_STATUS
Current status of the codec.
@ CODEC_STATUS_NOT_INITIALISED
Codec has not yet been initialised, or the codec configuration has changed.
@ CODEC_STATUS_INITIALISED
Codec is initialised and ready to process input audio.
@ CODEC_STATUS_INITIALISING
Codec is currently being initialised, input audio should not be processed.
void smb_pitchShift_create(void **hSmb, int nCH, int fftFrameSize, int osamp, float sampleRate)
Creates an instance of SMB PitchShifter.
void smb_pitchShift_apply(void *hSmb, float pitchShift, int frameSize, float *indata, float *outdata)
Performs pitch shifting of the input signals, while retaining the same time duration as the original ...
void smb_pitchShift_destroy(void **const hSmb)
Destroys an instance of SMB PitchShifter.
#define SAF_MIN(a, b)
Returns the minimum of the two values.
void * malloc1d(size_t dim1_data_size)
1-D malloc (same as malloc, but with error checking)
void ** calloc2d(size_t dim1, size_t dim2, size_t data_size)
2-D calloc (contiguously allocated, so use free() as usual to deallocate)
#define FLATTEN2D(A)
Use this macro when passing a 2-D dynamic multi-dimensional array to memset, memcpy or any other func...
void pitch_shifter_setOSampOption(void *const hPS, PITCH_SHIFTER_OSAMP_OPTIONS newOption)
Sets the oversampling factor used by the algorithm (see PITCH_SHIFTER_OSAMP_OPTIONS enum)
void pitch_shifter_setPitchShiftFactor(void *const hPS, float newValue)
Sets the pitch shift factor, 1: no change, 2: up one octave, 0.5: down one octave.
CODEC_STATUS pitch_shifter_getCodecStatus(void *const hBin)
Returns current codec status (see CODEC_STATUS enum)
void pitch_shifter_create(void **const phPS)
Creates an instance of pitch_shifter.
int pitch_shifter_getProcessingDelay(void *const hPS)
Returns the processing delay in samples (may be used for delay compensation features)
void pitch_shifter_setFFTSizeOption(void *const hPS, PITCH_SHIFTER_FFTSIZE_OPTIONS newOption)
Sets the FFT size used by the algorithm (see PITCH_SHIFTER_FFTSIZE_OPTIONS enum)
void pitch_shifter_destroy(void **const phPS)
Destroys an instance of pitch_shifter.
void pitch_shifter_initCodec(void *const hPS)
Intialises the codec variables, based on current global/user parameters.
int pitch_shifter_getNCHrequired(void *const hPS)
Returns the number of channels required by the current configuration.
float pitch_shifter_getPitchShiftFactor(void *const hPS)
Returns the pitch shift factor, 1: no change, 2: up one octave, 0.5: down one octave.
PITCH_SHIFTER_OSAMP_OPTIONS pitch_shifter_getOSampOption(void *const hPS)
Returns the oversampling factor used by the algorithm (see PITCH_SHIFTER_OSAMP_OPTIONS enum)
float pitch_shifter_getProgressBar0_1(void *const hBin)
(Optional) Returns current intialisation/processing progress, between 0..1
PITCH_SHIFTER_FFTSIZE_OPTIONS pitch_shifter_getFFTSizeOption(void *const hPS)
Returns the FFT size used by the algorithm (see PITCH_SHIFTER_FFTSIZE_OPTIONS enum)
void pitch_shifter_process(void *const hPS, const float *const *inputs, float *const *const outputs, int nInputs, int nOutputs, int nSamples)
Pitch shifts the input signals.
void pitch_shifter_getProgressBarText(void *const hBin, char *text)
(Optional) Returns current intialisation/processing progress text
int pitch_shifter_getFrameSize(void)
Returns the processing framesize (i.e., number of samples processed with every _process() call )
void pitch_shifter_init(void *const hPS, int sampleRate)
Initialises an instance of pitch_shifter with default settings.
void pitch_shifter_setNumChannels(void *const hPS, int newValue)
Sets the number channels to pitch shift.
void pitch_shifter_refreshParams(void *const hPS)
Sets all intialisation flags to 1; re-initialising all settings/variables as pitch_shifter is current...
A very basic multichannel pitch shifter.
PITCH_SHIFTER_FFTSIZE_OPTIONS
Available FFT size options.
PITCH_SHIFTER_OSAMP_OPTIONS
Available oversampling options.
void pitch_shifter_setCodecStatus(void *const hPS, CODEC_STATUS newStatus)
Sets codec status (see CODEC_STATUS enum)
A very basic multichannel pitch shifter.
#define PITCH_SHIFTER_FRAME_SIZE
Framesize, in time-domain samples.
Main struct for the pitch_shifter.
float inputFrame[MAX_NUM_CHANNELS][PITCH_SHIFTER_FRAME_SIZE]
Current input frame.
float outputFrame[MAX_NUM_CHANNELS][PITCH_SHIFTER_FRAME_SIZE]
Current output frame.
float pitchShift_factor
1: no shift, 0.5: down one octave, 2: up one octave
float ** inFIFO
Input FIFO buffer.
int fftFrameSize
FFT size.
char * progressBarText
Current (re)initialisation step, string.
int new_nChannels
(current value will be replaced by this after next re-init)
float progressBar0_1
Current (re)initialisation progress, between [0..1].
int FIFO_idx
FIFO buffer index.
int stepsize
Hop size in samples.
void * hSmb
pitch-shifter handle
float ** outFIFO
Output FIFO buffer.
PITCH_SHIFTER_OSAMP_OPTIONS osamp_option
see PITCH_SHIFTER_OSAMP_OPTIONS
PROC_STATUS procStatus
see PROC_STATUS
float sampleRate
Host sampling rate, in Hz.
int nChannels
Current number of input/output channels.
PITCH_SHIFTER_FFTSIZE_OPTIONS fftsize_option
see PITCH_SHIFTER_FFTSIZE_OPTIONS
CODEC_STATUS codecStatus
see CODEC_STATUS