SAF
Loading...
Searching...
No Matches
afSTFT_internal.h File Reference

A modified version of afSTFTlib. More...

Go to the source code of this file.

Data Structures

struct  complexVector
 Complex data type used by afSTFTlib. More...
 
struct  afSTFTlib_internal_data
 Main data structure for afSTFTlib. More...
 
struct  afHybrid
 Data structure for the hybrid filtering employed by afSTFTlib. More...
 

Macros

#define AFSTFT_USE_SAF_UTILITIES
 Remove the "AFSTFT_USE_SAF_UTILITIES" definition, and add the vecTools.h/c and fft4g.h/c to your project, if you want to use the original afSTFT vector code.
 
#define COEFF1   0.031273141818515176604f
 Filter coefficient 0 for hybrid filtering.
 
#define COEFF2   0.28127313041521179171f
 Filter coefficient 1 for hybrid filtering.
 
#define COEFF3   0.5f
 Filter coefficient 3 for hybrid filtering.
 

Functions

void afSTFTlib_init (void **handle, int hopSize, int inChannels, int outChannels, int LDmode, int hybridMode)
 Initialises an instance of afSTFTlib [1].
 
void afSTFTlib_channelChange (void *handle, int new_inChannels, int new_outChannels)
 Re-allocates memory to support a change in the number of input/output channels.
 
void afSTFTlib_clearBuffers (void *handle)
 Flushes time-domain buffers with zeros.
 
void afSTFTlib_forward (void *handle, float **inTD, complexVector *outFD)
 Applies the forward afSTFT transform.
 
void afSTFTlib_inverse (void *handle, complexVector *inFD, float **outTD)
 Applies the backward afSTFT transform.
 
void afSTFTlib_free (void *handle)
 Destroys an instance of afSTFTlib.
 
void afHybridInit (void **handle, int hopSize, int inChannels, int outChannels)
 Creates and initialises an instance of the afHybrid filtering structure.
 
void afHybridForward (void *handle, complexVector *FD)
 Forward hybrid-filtering transform.
 
void afHybridInverse (void *handle, complexVector *FD)
 Inverse hybrid-filtering transform.
 
void afHybridFree (void *handle)
 Frees an instnce of the afHybrid filtering structure.
 

Detailed Description

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]

See also
[1] Vilkamo, J., & Ba"ckstro"m, T. (2018). Time–Frequency Processing: Methods and Tools. In Parametric Time–Frequency Domain Spatial Audio. John Wiley & Sons.
Author
Juha Vilkamo
Date
08.04.2015
License
MIT

Definition in file afSTFT_internal.h.

Macro Definition Documentation

◆ AFSTFT_USE_SAF_UTILITIES

#define AFSTFT_USE_SAF_UTILITIES

Remove the "AFSTFT_USE_SAF_UTILITIES" definition, and add the vecTools.h/c and fft4g.h/c to your project, if you want to use the original afSTFT vector code.

Note the vecTools.h/c and fft4g.h/c files, may be found here: https://github.com/jvilkamo/afSTFT

Definition at line 63 of file afSTFT_internal.h.

◆ COEFF1

#define COEFF1   0.031273141818515176604f

Filter coefficient 0 for hybrid filtering.

Definition at line 74 of file afSTFT_internal.h.

◆ COEFF2

#define COEFF2   0.28127313041521179171f

Filter coefficient 1 for hybrid filtering.

Definition at line 75 of file afSTFT_internal.h.

◆ COEFF3

#define COEFF3   0.5f

Filter coefficient 3 for hybrid filtering.

Definition at line 76 of file afSTFT_internal.h.

Function Documentation

◆ afHybridForward()

void afHybridForward ( void * handle,
complexVector * FD )

Forward hybrid-filtering transform.

Definition at line 523 of file afSTFT_internal.c.

◆ afHybridFree()

void afHybridFree ( void * handle)

Frees an instnce of the afHybrid filtering structure.

Definition at line 655 of file afSTFT_internal.c.

◆ afHybridInit()

void afHybridInit ( void ** handle,
int hopSize,
int inChannels,
int outChannels )

Creates and initialises an instance of the afHybrid filtering structure.

Definition at line 495 of file afSTFT_internal.c.

◆ afHybridInverse()

void afHybridInverse ( void * handle,
complexVector * FD )

Inverse hybrid-filtering transform.

Definition at line 625 of file afSTFT_internal.c.

◆ afSTFTlib_channelChange()

void afSTFTlib_channelChange ( void * handle,
int new_inChannels,
int new_outChannels )

Re-allocates memory to support a change in the number of input/output channels.

Definition at line 158 of file afSTFT_internal.c.

◆ afSTFTlib_clearBuffers()

void afSTFTlib_clearBuffers ( void * handle)

Flushes time-domain buffers with zeros.

Definition at line 213 of file afSTFT_internal.c.

◆ afSTFTlib_forward()

void afSTFTlib_forward ( void * handle,
float ** inTD,
complexVector * outFD )

Applies the forward afSTFT transform.

Definition at line 237 of file afSTFT_internal.c.

◆ afSTFTlib_free()

void afSTFTlib_free ( void * handle)

Destroys an instance of afSTFTlib.

Definition at line 455 of file afSTFT_internal.c.

◆ afSTFTlib_init()

void afSTFTlib_init ( void ** handle,
int hopSize,
int inChannels,
int outChannels,
int LDmode,
int hybridMode )

Initialises an instance of afSTFTlib [1].

Parameters
[in]handle(&) afSTFTlib handle
[in]hopSizeHop size, in samples
[in]inChannelsNumber of input channels
[in]outChannelsNumber of output channels
[in]LDmode'0' disable low-delay mode, '1' enable
[in]hybridMode'0' disable hybrid-mode, '1' enable
See also
[1] Vilkamo, J., & Backstrom, T. (2018). Time–Frequency Processing: Methods and Tools. In Parametric Time-Frequency Domain Spatial Audio. John Wiley & Sons.

Definition at line 57 of file afSTFT_internal.c.

◆ afSTFTlib_inverse()

void afSTFTlib_inverse ( void * handle,
complexVector * inFD,
float ** outTD )

Applies the backward afSTFT transform.

Definition at line 335 of file afSTFT_internal.c.