ailia  1.5.0.0
ailia_audio.h
Go to the documentation of this file.
1 
15 #if !defined(INCLUDED_AILIA_AUDIO)
16 #define INCLUDED_AILIA_AUDIO
17 
18 #if !defined(AILIA_API)
19 #if defined(_MSC_VER) && !defined(_WIN64)
20 #define AILIA_API __stdcall
21 #else
22 #define AILIA_API
23 #endif
24 #endif
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
39 #define AILIA_AUDIO_WIN_TYPE_HANN (1)
49 #define AILIA_AUDIO_WIN_TYPE_HAMMING (2)
50 
60 #define AILIA_AUDIO_STFT_CENTER_NONE (0)
70 #define AILIA_AUDIO_STFT_CENTER_ENABLE (1)
82 #define AILIA_AUDIO_STFT_CENTER_SCIPY_DEFAULT (2)
83 
93 #define AILIA_AUDIO_FFT_NORMALIZE_NONE (0)
103 #define AILIA_AUDIO_FFT_NORMALIZE_LIBROSA_COMPAT (1)
113 #define AILIA_AUDIO_FFT_NORMALIZE_PYTORCH_COMPAT (1)
123 #define AILIA_AUDIO_FFT_NORMALIZE_SCIPY_COMPAT (2)
124 
134 #define AILIA_AUDIO_MEL_NORMALIZE_NONE (0)
144 #define AILIA_AUDIO_MEL_NORMALIZE_ENABLE (1)
145 
155 #define AILIA_AUDIO_MEL_SCALE_FORMULA_HTK (1)
165 #define AILIA_AUDIO_MEL_SCALE_FORMULA_SLANYE (0)
166 
176 #define AILIA_AUDIO_PHASE_FORM_COMPLEX (1)
186 #define AILIA_AUDIO_PHASE_FORM_REAL (0)
187 
197 #define AILIA_AUDIO_FILTFILT_PAD_NONE (0)
208 #define AILIA_AUDIO_FILTFILT_PAD_ODD (1)
218 #define AILIA_AUDIO_FILTFILT_PAD_EVEN (2)
228 #define AILIA_AUDIO_FILTFILT_PAD_CONSTANT (3)
229 
251 int AILIA_API ailiaAudioLog1p(void* dst, const void* src, int src_n);
252 
280 int AILIA_API ailiaAudioConvertPowerToDB(void* dst, const void* src, int src_n, float top_db);
281 
318 int AILIA_API ailiaAudioGetFrameLen(int* frame_n, int sample_n, int fft_n, int hop_n, int center);
319 
350 int AILIA_API ailiaAudioGetSampleLen(int* sample_n, int frame_n, int freq_n, int hop_n, int center);
351 
373 int AILIA_API ailiaAudioGetWindow(void* dst, int window_n, int win_type);
374 
399 int AILIA_API ailiaAudioFFT(void* dst, const void* src, int fft_n);
400 
426 int AILIA_API ailiaAudioIFFT(void* dst, const void* src, int fft_n);
427 
477 int AILIA_API ailiaAudioGetSpectrogram(void* dst, const void* src, int sample_n, int fft_n, int hop_n, int win_n, int win_type, int max_frame_n, int center, float power, int norm_type);
478 
519 int AILIA_API ailiaAudioGetInverseSpectrogram(void* dst, const void* src, int frame_n, int freq_n, int hop_n, int win_n, int win_type, int max_sample_n, int center, int norm_type);
520 
550 int AILIA_API ailiaAudioGetFBMatrix(void* dst, const int freq_n, float f_min, float f_max, int mel_n, int sample_rate, int mel_norm, int mel_formula);
551 
610 int AILIA_API ailiaAudioGetMelSpectrogram(void* dst, const void* src, int sample_n, int sample_rate, int fft_n, int hop_n, int win_n, int win_type, int max_frame_n, int center, float power, int fft_norm_type, float f_min, float f_max, int mel_n, int mel_norm_type, int mel_formula);
611 
653 int AILIA_API ailiaAudioMagPhase(void* dst_mag, void* dst_phase, const void* src, int freq_n, int frame_n, float power, int phase_form);
654 
678 int AILIA_API ailiaAudioStandardize(void* dst, const void* src, const int src_n);
679 
710 int AILIA_API ailiaAudioComplexNorm(void* dst, const void* src, const int src_n, float power);
711 
744 int AILIA_API
745 ailiaAudioConvertToMel(void* dst, const void* src, const void* fb_mtrx, int freq_n, int frame_n, int mel_n);
746 
778 int AILIA_API
779 ailiaAudioFixFrameLen(void* dst, const void* src, int freq_n, int dst_frame_n, int src_frame_n, float pad_data);
780 
812 int AILIA_API
813 ailiaAudioResample(void* dst, const void* src, int dst_sample_rate, int dst_n, int src_sample_rate, int src_n);
814 
834 int AILIA_API ailiaAudioGetResampleLen(int* dst_sample_n, int dst_sample_rate, int src_sample_n, int src_sample_rate);
835 
881 int AILIA_API ailiaAudioLinerFilter(void* dst, const void* src, const void* n_coef, const void* d_coef, void* zi, int dst_n, int src_n, int n_coef_n, int d_coef_n, int zi_n);
882 
919 int AILIA_API ailiaAudioGetLinerFilterZiCoef(void* dst_zi, const void* n_coef, const void* d_coef, int dst_n, int n_coef_n, int d_coef_n);
920 
959 int AILIA_API ailiaAudioFilterFilter(void* dst, const void* src, const void* n_coef, const void* d_coef, int dst_n, int src_n, int n_coef_n, int d_coef_n, int pad_type, int pad_len);
960 
993 int AILIA_API ailiaAudioGetNonSilentPos(int* dst_start_pos, int* dst_length, const void* src, int sample_n, int win_n, int hop_n, float thr_db);
994 
995 #ifdef __cplusplus
996 }
997 #endif
998 #endif /* !defined(INCLUDED_AILIA_AUDIO) */
int AILIA_API ailiaAudioMagPhase(void *dst_mag, void *dst_phase, const void *src, int freq_n, int frame_n, float power, int phase_form)
Get the amplitude and the phase from the spectrogram.
int AILIA_API ailiaAudioStandardize(void *dst, const void *src, const int src_n)
Standardize a real signal.
int AILIA_API ailiaAudioFixFrameLen(void *dst, const void *src, int freq_n, int dst_frame_n, int src_frame_n, float pad_data)
Fix the number of time frames of a real-valued spectrogram/mel-spectrogram.
int AILIA_API ailiaAudioConvertToMel(void *dst, const void *src, const void *fb_mtrx, int freq_n, int frame_n, int mel_n)
Convert the real output of the STFT to the mel scale.
int AILIA_API ailiaAudioFilterFilter(void *dst, const void *src, const void *n_coef, const void *d_coef, int dst_n, int src_n, int n_coef_n, int d_coef_n, int pad_type, int pad_len)
Apply a zero-phase filter to the signal.
#define AILIA_API
Definition: ailia_audio.h:22
int AILIA_API ailiaAudioGetSampleLen(int *sample_n, int frame_n, int freq_n, int hop_n, int center)
Get the number of samples generated by the ISTFT.
int AILIA_API ailiaAudioConvertPowerToDB(void *dst, const void *src, int src_n, float top_db)
Convert non-negative input values to decibel scale.
int AILIA_API ailiaAudioFFT(void *dst, const void *src, int fft_n)
Execute the FFT.
int AILIA_API ailiaAudioGetFBMatrix(void *dst, const int freq_n, float f_min, float f_max, int mel_n, int sample_rate, int mel_norm, int mel_formula)
Create a mel filter-bank.
int AILIA_API ailiaAudioGetInverseSpectrogram(void *dst, const void *src, int frame_n, int freq_n, int hop_n, int win_n, int win_type, int max_sample_n, int center, int norm_type)
Generate an audio signal from a complex spectrogram.
int AILIA_API ailiaAudioIFFT(void *dst, const void *src, int fft_n)
Execute the IFFT.
int AILIA_API ailiaAudioGetSpectrogram(void *dst, const void *src, int sample_n, int fft_n, int hop_n, int win_n, int win_type, int max_frame_n, int center, float power, int norm_type)
Generate the spectrogram from the audio signal.
int AILIA_API ailiaAudioGetMelSpectrogram(void *dst, const void *src, int sample_n, int sample_rate, int fft_n, int hop_n, int win_n, int win_type, int max_frame_n, int center, float power, int fft_norm_type, float f_min, float f_max, int mel_n, int mel_norm_type, int mel_formula)
Generate the mel spectrogram from the audio signal.
int AILIA_API ailiaAudioGetFrameLen(int *frame_n, int sample_n, int fft_n, int hop_n, int center)
Get the number of frames generated by the STFT.
int AILIA_API ailiaAudioComplexNorm(void *dst, const void *src, const int src_n, float power)
Get the norm of the complex signal.
int AILIA_API ailiaAudioResample(void *dst, const void *src, int dst_sample_rate, int dst_n, int src_sample_rate, int src_n)
Resample the signal.
int AILIA_API ailiaAudioGetNonSilentPos(int *dst_start_pos, int *dst_length, const void *src, int sample_n, int win_n, int hop_n, float thr_db)
Find the region of the signal between the first and the last non-silence samples. Detects the area ex...
int AILIA_API ailiaAudioLinerFilter(void *dst, const void *src, const void *n_coef, const void *d_coef, void *zi, int dst_n, int src_n, int n_coef_n, int d_coef_n, int zi_n)
Apply a filter to the signal.
int AILIA_API ailiaAudioGetWindow(void *dst, int window_n, int win_type)
Get the window function.
int AILIA_API ailiaAudioLog1p(void *dst, const void *src, int src_n)
Convert the input values to a logarithmic scale.
int AILIA_API ailiaAudioGetResampleLen(int *dst_sample_n, int dst_sample_rate, int src_sample_n, int src_sample_rate)
Get the number of samples after the resampling.
int AILIA_API ailiaAudioGetLinerFilterZiCoef(void *dst_zi, const void *n_coef, const void *d_coef, int dst_n, int n_coef_n, int d_coef_n)
Calculate the initial delay coefficients for filtering.