Sound Open Firmware
Loading...
Searching...
No Matches
auditory.h File Reference
Include dependency graph for auditory.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  psy_mel_filterbank

Macros

#define AUDITORY_MAX_MEL_BANDS   256
#define AUDITORY_EPS_Q31   1 /* Smallest nonzero Q1.31 value */
#define AUDITORY_LOG2_2P25_Q16   Q_CONVERT_FLOAT(25.0, 16) /* log2(2^25) */

Enumerations

enum  psy_mel_log_scale { MEL_LOG = 0 , MEL_LOG10 , MEL_DB }

Functions

int16_t psy_hz_to_mel (int16_t hz)
 Convert Hz to Mel.
int16_t psy_mel_to_hz (int16_t mel)
 Convert Mel to Hz See Wikipedia https://en.wikipedia.org/wiki/Mel_scale hz = 700 * (exp(mel / 1126.9941805389) - 1).
int mod_psy_get_mel_filterbank (struct processing_module *mod, struct psy_mel_filterbank *mel_fb)
int mod_psy_free_mel_filterbank (struct processing_module *mod, struct psy_mel_filterbank *mel_fb)
void psy_apply_mel_filterbank_16 (struct psy_mel_filterbank *mel_fb, struct icomplex16 *fft_out, int32_t *power_spectra, int16_t *mel_log, int bitshift)
 Convert linear complex spectra from FFT into Mel band energies in desired logarithmic format.
void psy_apply_mel_filterbank_32 (struct psy_mel_filterbank *mel_fb, struct icomplex32 *fft_out, int32_t *power_spectra, int32_t *mel_log, int bitshift)
 Convert linear complex spectra from FFT into Mel band energies in desired logarithmic format.

Macro Definition Documentation

◆ AUDITORY_EPS_Q31

#define AUDITORY_EPS_Q31   1 /* Smallest nonzero Q1.31 value */

◆ AUDITORY_LOG2_2P25_Q16

#define AUDITORY_LOG2_2P25_Q16   Q_CONVERT_FLOAT(25.0, 16) /* log2(2^25) */

◆ AUDITORY_MAX_MEL_BANDS

#define AUDITORY_MAX_MEL_BANDS   256

Enumeration Type Documentation

◆ psy_mel_log_scale

Enumerator
MEL_LOG 
MEL_LOG10 
MEL_DB 

Function Documentation

◆ mod_psy_free_mel_filterbank()

int mod_psy_free_mel_filterbank ( struct processing_module * mod,
struct psy_mel_filterbank * mel_fb )

◆ mod_psy_get_mel_filterbank()

int mod_psy_get_mel_filterbank ( struct processing_module * mod,
struct psy_mel_filterbank * mel_fb )

◆ psy_apply_mel_filterbank_16()

void psy_apply_mel_filterbank_16 ( struct psy_mel_filterbank * mel_fb,
struct icomplex16 * fft_out,
int32_t * power_spectra,
int16_t * mel_log,
int bitshift )

Convert linear complex spectra from FFT into Mel band energies in desired logarithmic format.

Parameters
[in]mel_fbStruct with filterbank parameters and filter coefficients to apply.
[in]fft_outArray of complex numbers from FFT in Q1.15 format.
[out]power_spectraArray of linear power spectra, needed scratch are that is half + 1 side of fft_out. The data can be discarded after if no use.
[out]mel_logArray of Q9.7 log/log10/10log10 format Mel band energies.
[in]bitshiftA shift left scale that has been possibly applied to FFT. This will be subtracted from the log or decibels notation.

◆ psy_apply_mel_filterbank_32()

void psy_apply_mel_filterbank_32 ( struct psy_mel_filterbank * mel_fb,
struct icomplex32 * fft_out,
int32_t * power_spectra,
int32_t * mel_log,
int bitshift )

Convert linear complex spectra from FFT into Mel band energies in desired logarithmic format.

Parameters
[in]mel_fbStruct with filterbank parameters and filter coefficients to apply.
[in]fft_outArray of complex numbers from FFT in Q1.31 format.
[out]power_spectraArray of linear power spectra, needed scratch are that is half + 1 side of fft_out. The data can be discarded after if no use.
[out]mel_logArray of Q9.23 log/log10/10log10 format Mel band energies.
[in]bitshiftA shift left scale that has been possibly applied to FFT. This will be subtracted from the log or decibels notation.

◆ psy_hz_to_mel()

int16_t psy_hz_to_mel ( int16_t hz)

Convert Hz to Mel.

Parameters
[in]hzFrequency as Q16.0 Hz.
Returns
Value as Q14.2 Mel.

◆ psy_mel_to_hz()

int16_t psy_mel_to_hz ( int16_t mel)

Convert Mel to Hz See Wikipedia https://en.wikipedia.org/wiki/Mel_scale hz = 700 * (exp(mel / 1126.9941805389) - 1).

Parameters
[in]melValue as Q14.2 Mel, max 4358.4 Mel.
Returns
hz Frequency as Q16.0 Hz, max 32767 Hz.