File ns_melspec.c
FileList > neuralSPOT > neuralspot > ns-audio > src > ns_melspec.c
Go to the source code of this file
Set of mel-scaled spectrogram related utilities. More...
#include "am_bsp.h"
#include "am_mcu_apollo.h"
#include "am_util.h"
#include "float.h"
#include "ns_ambiqsuite_harness.h"
#include "ns_audio_melspec.h"
#include <string.h>
Public Attributes
Type | Name |
---|---|
arm_cfft_instance_f32 | g_melspecRfft |
Public Functions
Type | Name |
---|---|
void | ns_melspec_audio_to_stft (ns_melspec_cfg_t * cfg, const int16_t * audio_in, float32_t * stft_out) convert the audio samples into a short-time fourier transform |
void | ns_melspec_init (ns_melspec_cfg_t * cfg) initialize data structures used for mel spectrogram related functions |
void | ns_melspec_melspec_to_stft (ns_melspec_cfg_t * cfg, const float32_t * melspec_in, float32_t * stft_out) Inverts a mel spectrogram back into linear short-time fourier transform. |
void | ns_melspec_stft_to_audio (ns_melspec_cfg_t * cfg, float32_t * stft_in, int16_t * audio_out) Inverts short-time fourier transform into a reconstructed audio sample. |
void | ns_melspec_stft_to_compressed_melspec (ns_melspec_cfg_t * cfg, const float32_t * stft_in, float32_t * melspec_out) Converts complex valued short-time fourier transform into real-valued, power compressed mel scaled space. |
Detailed Description
Author:
Scott Leishman
Version:
0.1
Date:
2022-10-10
Copyright:
Copyright (c) 2022
Public Attributes Documentation
variable g_melspecRfft
arm_cfft_instance_f32 g_melspecRfft;
Public Functions Documentation
function ns_melspec_audio_to_stft
convert the audio samples into a short-time fourier transform
void ns_melspec_audio_to_stft (
ns_melspec_cfg_t * cfg,
const int16_t * audio_in,
float32_t * stft_out
)
Result is complex valued (containing magnitude and phase info in alternating 32-bit values, so stft_out should be 2*MELSPEC_FRAME_LEN
function ns_melspec_init
void ns_melspec_init (
ns_melspec_cfg_t * cfg
)
function ns_melspec_melspec_to_stft
void ns_melspec_melspec_to_stft (
ns_melspec_cfg_t * cfg,
const float32_t * melspec_in,
float32_t * stft_out
)
function ns_melspec_stft_to_audio
Inverts short-time fourier transform into a reconstructed audio sample.
void ns_melspec_stft_to_audio (
ns_melspec_cfg_t * cfg,
float32_t * stft_in,
int16_t * audio_out
)
We assume the stft input is complex valued (containing magnitude and phase info in alternating 32-bit values).
Note that this operation currently modifies the input buffer!
function ns_melspec_stft_to_compressed_melspec
void ns_melspec_stft_to_compressed_melspec (
ns_melspec_cfg_t * cfg,
const float32_t * stft_in,
float32_t * melspec_out
)
The documentation for this class was generated from the following file neuralSPOT/neuralspot/ns-audio/src/ns_melspec.c