34 *phDecor = (
void*)pData;
79 if(pData->
hSTFT!=NULL)
106 pData->
fs = sampleRate;
135 if(pData->
hSTFT==NULL)
148 const int orders[4] = {20, 15, 6, 3};
149 const float freqCutoffs[4] = {600.0f, 2.4e3f, 4.0e3f, 12e3f};
151 const int maxDelay = 8;
153 latticeDecorrelator_create(&(pData->
hDecor), pData->
fs,
HOP_SIZE, pData->
freqVector,
HYBRID_BANDS, pData->
nChannels, (
int*)orders, (
float*)freqCutoffs, 4, maxDelay, 0, 0.75f);
164 const float *
const * inputs,
165 float*
const*
const outputs,
172 int ch, i, band, enableTransientDucker, compensateLevel;
187 for(i=0; i <
SAF_MIN(nCH, nInputs); i++)
196 if(enableTransientDucker){
212 if(enableTransientDucker){
228 for (ch = 0; ch <
SAF_MIN(nCH, nOutputs); ch++)
230 for (; ch < nOutputs; ch++)
234 for (ch=0; ch < nOutputs; ch++)
267 saf_assert(newValue==0 || newValue==1,
"newValue is a bool");
274 saf_assert(newValue==0 || newValue==1,
"newValue is a bool");
#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 afSTFT_clearBuffers(void *const hSTFT)
Flushes time-domain buffers with zeros.
void afSTFT_create(void **const phSTFT, int nCHin, int nCHout, int hopsize, int lowDelayMode, int hybridmode, AFSTFT_FDDATA_FORMAT format)
Creates an instance of afSTFT.
void afSTFT_backward_knownDimensions(void *const hSTFT, float_complex ***dataFD, int framesize, int dataFD_nCH, int dataFD_nHops, float **dataTD)
Performs backward afSTFT transform (dataFD dimensions are known)
void afSTFT_forward_knownDimensions(void *const hSTFT, float **dataTD, int framesize, int dataFD_nCH, int dataFD_nHops, float_complex ***dataFD)
Performs forward afSTFT transform (dataFD dimensions are known)
void afSTFT_getCentreFreqs(void *const hSTFT, float fs, int nBands, float *freqVector)
Returns current frequency vector.
void afSTFT_destroy(void **const phSTFT)
Destroys an instance of afSTFT.
void afSTFT_channelChange(void *const hSTFT, int new_nCHin, int new_nCHout)
Re-allocates memory to support a change in the number of input/output channels.
@ AFSTFT_BANDS_CH_TIME
nBands x nChannels x nTimeHops
#define TIME_SLOTS
Number of STFT timeslots.
#define HOP_SIZE
STFT hop size.
#define HYBRID_BANDS
Number of frequency bands.
int decorrelator_getLevelCompensationFlag(void *const hDecor)
Returns whether to apply level compensation (0 or 1)
void decorrelator_setDecorrelationAmount(void *const hDecor, float newValue)
Sets the decorrelation amount [0..1].
int decorrelator_getFrameSize(void)
Returns the processing framesize (i.e., number of samples processed with every _process() call )
void decorrelator_refreshParams(void *const hDecor)
Sets intialisation flags to 1, so as to re-initialise all settings/variables (as decorrelator is curr...
int decorrelator_getDAWsamplerate(void *const hDecor)
Returns the DAW/Host sample rate.
int decorrelator_getTransientBypassFlag(void *const hDecor)
Returns whether to bypass decorrelating the transients (0 or 1)
void decorrelator_setLevelCompensationFlag(void *const hDecor, int newValue)
Sets whether to apply level compensation (0 or 1)
void decorrelator_destroy(void **const phDecor)
Destroys an instance of decorrelator.
float decorrelator_getProgressBar0_1(void *const hDecor)
(Optional) Returns current intialisation/processing progress, between 0..1
void decorrelator_getProgressBarText(void *const hDecor, char *text)
(Optional) Returns current intialisation/processing progress text
void decorrelator_setTransientBypassFlag(void *const hDecor, int newValue)
Sets whether to bypass decorrelating the transients (0 or 1)
void decorrelator_init(void *const hDecor, int sampleRate)
Initialises decorrelator with default settings, and samplerate.
void decorrelator_process(void *const hDecor, const float *const *inputs, float *const *const outputs, int nInputs, int nOutputs, int nSamples)
Decorrelates the input signals.
void decorrelator_setNumberOfChannels(void *const hDecor, int newValue)
Sets the number of input/output channels.
CODEC_STATUS decorrelator_getCodecStatus(void *const hDecor)
Returns current codec status, see CODEC_STATUS enum.
int decorrelator_getNumberOfChannels(void *const hDecor)
Returns the number of input/output channels.
void decorrelator_create(void **const phDecor)
Creates an instance of decorrelator.
float decorrelator_getDecorrelationAmount(void *const hDecor)
Returns the decorrelation amount [0..1].
int decorrelator_getProcessingDelay()
Returns the processing delay in samples (may be used for delay compensation features)
void decorrelator_initCodec(void *const hDecor)
Intialises the codec variables, based on current global/user parameters.
void decorrelator_setCodecStatus(void *const hDecor, CODEC_STATUS newStatus)
Sets codec status.
A multi-channel decorrelator.
#define DECORRELATOR_FRAME_SIZE
Framesize, in time-domain samples.
#define saf_assert(x, message)
Macro to make an assertion, along with a string explaining its purpose.
#define SAF_CLAMP(a, min, max)
Ensures value "a" is clamped between the "min" and "max" values.
void transientDucker_destroy(void **phDucker)
Destroys an instance of the transient ducker.
void transientDucker_apply(void *hDucker, float_complex ***inFrame, int nTimeSlots, float alpha, float beta, float_complex ***residualFrame, float_complex ***transientFrame)
Applies the transient ducker, returning either the "ducked" input frame, or the transient part of the...
void utility_svvcopy(const float *a, const int len, float *c)
Single-precision, vector-vector copy, i.e.
void latticeDecorrelator_reset(void *hDecor)
Sets the internal buffers to zero.
void latticeDecorrelator_apply(void *hDecor, float_complex ***inFrame, int nTimeSlots, float_complex ***decorFrame)
Applies the lattice all-pass-filter-based multi-channel signal decorrelator.
#define SAF_MIN(a, b)
Returns the minimum of the two values.
void latticeDecorrelator_create(void **phDecor, float fs, int hopsize, float *freqVector, int nBands, int nCH, int *orders, float *freqCutoffs, int nCutoffs, int maxDelay, int lookupOffset, float enComp_coeff)
Creates an instance of the lattice all-pass-filter-based multi-channel signal decorrelator.
void latticeDecorrelator_destroy(void **phDecor)
Destroys an instance of the lattice all-pass-filter-based multi-channel signal decorrelator.
void transientDucker_create(void **phDucker, int nCH, int nBands)
Creates an instance of the transient ducker/extractor.
void ** malloc2d(size_t dim1, size_t dim2, size_t data_size)
2-D malloc (contiguously allocated, so use free() as usual to deallocate)
void * malloc1d(size_t dim1_data_size)
1-D malloc (same as malloc, but with error checking)
void *** malloc3d(size_t dim1, size_t dim2, size_t dim3, size_t data_size)
3-D malloc (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...
Main structure for decorrelator.
float freqVector[HYBRID_BANDS]
frequency vector for time-frequency transform, in Hz
int enableTransientDucker
1: transient extractor is enabled, 0: disabled
float ** InputFrameTD
Input time-domain signals; MAX_NUM_CHANNELS x DECORRELATOR_FRAME_SIZE.
int new_nChannels
New number of input/output channels (current value will be replaced by this after next re-init)
float progressBar0_1
Current (re)initialisation progress, between [0..1].
CODEC_STATUS codecStatus
see CODEC_STATUS
float_complex *** InputFrameTF
Input time-frequency domain signals; HYBRID_BANDS x MAX_NUM_CHANNELS x TIME_SLOTS.
float decorAmount
The mix between decorrelated signals and the input signals [0..1], 1: fully decorrelated 0: bypassed.
float_complex *** transientFrameTF
Transient time-frequency domain signals; HYBRID_BANDS x MAX_NUM_CHANNELS x TIME_SLOTS.
void * hSTFT
afSTFT handle
char * progressBarText
Current (re)initialisation step, string.
float ** OutputFrameTD
Output time-domain signals; MAX_NUM_CHANNELS x DECORRELATOR_FRAME_SIZE.
void * hDucker
Transient extractor/Ducker handle.
int nChannels
Current number of input/output channels.
int compensateLevel
1: apply a sqrt(nChannels)/nChannels scaling on the output signals, 0: disabled
float_complex *** OutputFrameTF
Output time-frequency domain signals; HYBRID_BANDS x MAX_NUM_CHANNELS x TIME_SLOTS.
PROC_STATUS procStatus
see PROC_STATUS
void * hDecor
Decorrelator handle.