SAF
|
A modified version of afSTFTlib. More...
Go to the source code of this file.
Data Structures | |
struct | afSTFT_data |
Data structure for the afSTFT filterbank. More... | |
Functions | |
static void | afAnalyse (float *inTD, int nSamplesTD, int nCH, int hopSize, int LDmode, int hybridmode, float_complex *outTF) |
Passes input time-domain data through the afSTFT filterbank. | |
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_destroy (void **const phSTFT) |
Destroys an instance of afSTFT. | |
void | afSTFT_forward (void *const hSTFT, float **dataTD, int framesize, float_complex ***dataFD) |
Performs forward afSTFT transform. | |
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_forward_flat (void *const hSTFT, float *dataTD, int framesize, float_complex *dataFD) |
Performs forward afSTFT transform (flattened arrays) | |
void | afSTFT_backward (void *const hSTFT, float_complex ***dataFD, int framesize, float **dataTD) |
Performs backward afSTFT transform. | |
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_backward_flat (void *const hSTFT, float_complex *dataFD, int framesize, float *dataTD) |
Performs backward afSTFT transform (flattened arrays) | |
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. | |
void | afSTFT_clearBuffers (void *const hSTFT) |
Flushes time-domain buffers with zeros. | |
int | afSTFT_getNBands (void *const hSTFT) |
Returns number of frequency bands. | |
int | afSTFT_getProcDelay (void *const hSTFT) |
Returns current processing delay, in samples. | |
void | afSTFT_getCentreFreqs (void *const hSTFT, float fs, int nBands, float *freqVector) |
Returns current frequency vector. | |
void | afSTFT_FIRtoFilterbankCoeffs (float *hIR, int N_dirs, int nCH, int ir_len, int hopSize, int LDmode, int hybridmode, float_complex *hFB) |
Converts FIR filters into Filterbank Coefficients by passing them through the afSTFT filterbank. | |
Variables | |
static const double | __afCenterFreq48e3 [133] |
afSTFT centre frequencies for 128 hop size, hybrid-mode enabled, 48kHz | |
static const double | __afCenterFreq44100 [133] |
afSTFT centre frequencies for 128 hop size, hybrid-mode enabled, 44.1kHz | |
static const float | __stft2hybCentreFreq [9][5] |
Matrix for converting the centre frequencies of the first 5 stft bins into the centre frequencies for the 9 hybrid bands. | |
A modified version of afSTFTlib.
The original afSTFT code (by Juha Vilkamo) can be found here: https://github.com/jvilkamo/afSTFT This version is slightly modified to be more in-line with how the rest of SAF is structured. The files afSTFTlib.h/.c act as the interface to afSTFT, which is then implemented in afSTFT_internal.h/.c.
This version also adds functionality to change the number of channels on the fly, flush the run-time buffers with zeros, return the current frequency vector and the current processing delay. It also incorporates SAF utilities (for the vectorisation and FFT).
The afSTFT design is also described in more detail in [1]
Definition in file afSTFTlib.c.
|
static |
Passes input time-domain data through the afSTFT filterbank.
Copyright (c) 2015 Juha Vilkamo, MIT license
Definition at line 78 of file afSTFTlib.c.
void afSTFT_backward | ( | void *const | hSTFT, |
float_complex *** | dataFD, | ||
int | framesize, | ||
float ** | dataTD ) |
Performs backward afSTFT transform.
[in] | hSTFT | afSTFT handle |
[in] | dataFD | Frequency-domain input; AFSTFT_FDDATA_FORMAT |
[in] | framesize | Frame size of time-domain data |
[out] | dataTD | Time-domain output; nCHout x framesize |
Definition at line 347 of file afSTFTlib.c.
void afSTFT_backward_flat | ( | void *const | hSTFT, |
float_complex * | dataFD, | ||
int | framesize, | ||
float * | dataTD ) |
Performs backward afSTFT transform (flattened arrays)
[in] | hSTFT | afSTFT handle |
[in] | dataFD | Frequency-domain input; FLAT: AFSTFT_FDDATA_FORMAT |
[in] | framesize | Frame size of time-domain data |
[out] | dataTD | Time-domain output; FLAT: nCHout x framesize |
Definition at line 433 of file afSTFTlib.c.
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)
[in] | hSTFT | afSTFT handle |
[in] | dataFD | Frequency-domain input; AFSTFT_FDDATA_FORMAT |
[in] | framesize | Frame size of time-domain data |
[in] | dataFD_nCH | Number of channels dataFD is allocated (the max) |
[in] | dataFD_nHops | Number of timeslots dataFD is allocated (the max) |
[out] | dataTD | Time-domain output; nCHout x framesize |
Definition at line 390 of file afSTFTlib.c.
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.
[in] | hSTFT | afSTFT handle |
[in] | new_nCHin | New number of input channels |
[in] | new_nCHout | New number of output channels |
Definition at line 476 of file afSTFTlib.c.
void afSTFT_clearBuffers | ( | void *const | hSTFT | ) |
Flushes time-domain buffers with zeros.
Definition at line 518 of file afSTFTlib.c.
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.
[in] | phSTFT | (&) address of afSTFT handle |
[in] | nCHin | Number of input channels |
[in] | nCHout | Number of output channels |
[in] | hopsize | Hop size, in samples |
[in] | lowDelayMode | 0: disabled, 1: low-delay mode enabled |
[in] | hybridmode | 0: disabled, 1: hybrid-filtering enabled |
[in] | format | Frequency-domain frame format, see AFSTFT_FDDATA_FORMAT enum |
Definition at line 142 of file afSTFTlib.c.
void afSTFT_destroy | ( | void **const | phSTFT | ) |
Destroys an instance of afSTFT.
[in] | phSTFT | (&) address of afSTFT handle |
Definition at line 198 of file afSTFTlib.c.
void afSTFT_FIRtoFilterbankCoeffs | ( | float * | hIR, |
int | N_dirs, | ||
int | nCH, | ||
int | ir_len, | ||
int | hopSize, | ||
int | LDmode, | ||
int | hybridmode, | ||
float_complex * | hFB ) |
Converts FIR filters into Filterbank Coefficients by passing them through the afSTFT filterbank.
[in] | hIR | Time-domain FIR; FLAT: N_dirs x nCH x ir_len |
[in] | N_dirs | Number of FIR sets |
[in] | nCH | Number of channels per FIR set |
[in] | ir_len | Length of the FIR |
[in] | hopSize | Hop size |
[in] | LDmode | 0: disabled, 1:enabled |
[in] | hybridmode | 0: disabled, 1:enabled |
[out] | hFB | The FIRs as Filterbank coefficients; FLAT: N_bands x nCH x N_dirs |
Definition at line 592 of file afSTFTlib.c.
void afSTFT_forward | ( | void *const | hSTFT, |
float ** | dataTD, | ||
int | framesize, | ||
float_complex *** | dataFD ) |
Performs forward afSTFT transform.
[in] | hSTFT | afSTFT handle |
[in] | dataTD | Time-domain input; nCHin x framesize |
[in] | framesize | Frame size of time-domain data |
[out] | dataFD | Frequency-domain output; AFSTFT_FDDATA_FORMAT |
Definition at line 229 of file afSTFTlib.c.
void afSTFT_forward_flat | ( | void *const | hSTFT, |
float * | dataTD, | ||
int | framesize, | ||
float_complex * | dataFD ) |
Performs forward afSTFT transform (flattened arrays)
[in] | hSTFT | afSTFT handle |
[in] | dataTD | Time-domain input; FLAT: nCHin x framesize |
[in] | framesize | Frame size of time-domain data |
[out] | dataFD | Frequency-domain output; FLAT: AFSTFT_FDDATA_FORMAT |
Definition at line 310 of file afSTFTlib.c.
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)
[in] | hSTFT | afSTFT handle |
[in] | dataTD | Time-domain input; nCHin x framesize |
[in] | framesize | Frame size of time-domain data |
[in] | dataFD_nCH | Number of channels dataFD is allocated (the max) |
[in] | dataFD_nHops | Number of timeslots dataFD is allocated (the max) |
[out] | dataFD | Frequency-domain output; AFSTFT_FDDATA_FORMAT |
Definition at line 267 of file afSTFTlib.c.
void afSTFT_getCentreFreqs | ( | void *const | hSTFT, |
float | fs, | ||
int | nBands, | ||
float * | freqVector ) |
Returns current frequency vector.
Definition at line 545 of file afSTFTlib.c.
int afSTFT_getNBands | ( | void *const | hSTFT | ) |
Returns number of frequency bands.
Definition at line 527 of file afSTFTlib.c.
int afSTFT_getProcDelay | ( | void *const | hSTFT | ) |
Returns current processing delay, in samples.
If the low-delay mode is enabled, it is instead: analysis delay: 2*hopsize
Definition at line 536 of file afSTFTlib.c.
|
static |
afSTFT centre frequencies for 128 hop size, hybrid-mode enabled, 44.1kHz
Definition at line 58 of file afSTFTlib.c.
|
static |
afSTFT centre frequencies for 128 hop size, hybrid-mode enabled, 48kHz
Definition at line 54 of file afSTFTlib.c.
|
static |
Matrix for converting the centre frequencies of the first 5 stft bins into the centre frequencies for the 9 hybrid bands.
Definition at line 65 of file afSTFTlib.c.