image thumbnail

Zaf-Matlab

version 1.0 (6.79 MB) by Zafar
Zafar's Audio Functions in Matlab for audio signal analysis

15 Downloads

Updated 14 Apr 2021

From GitHub

View license on GitHub

Zafar's Audio Functions in Matlab for audio signal analysis.

Files:
- zaf.m: Matlab class with the audio functions.
- examples.ipynb: Jupyter notebook with some examples.
- audio_file.wav: audio file used for the examples.

Functions:
- stft - Compute the short-time Fourier transform (STFT).
- istft - Compute the inverse STFT.
- melfilterbank - Compute the mel filterbank.
- melspectrogram - Compute the mel spectrogram using a mel filterbank.
- mfcc - Compute the mel-frequency cepstral coefficients (MFCCs) using a mel filterbank.
- cqtkernel - Compute the constant-Q transform (CQT) kernel.
- cqtspectrogram - Compute the CQT spectrogram using a CQT kernel.
- cqtchromagram - Compute the CQT chromagram using a CQT kernel.
- dct - Compute the discrete cosine transform (DCT) using the fast Fourier transform (FFT).
- dst - Compute the discrete sine transform (DST) using the FFT.
- mdct - Compute the modified discrete cosine transform (MDCT) using the FFT.
- imdct - Compute the inverse MDCT using the FFT.

stft
audio_stft = zaf.stft(audio_signal,window_function,step_length);
- audio_signal: audio signal [number_samples,1]
- window_function: window function [window_length,1]
- step_length: step length in samples
- audio_stft: audio STFT [window_length,number_frames]

istft
audio_signal = zaf.istft(audio_stft,window_function,step_length);
- audio_stft: audio STFT [window_length,number_frames]
- window_function: window function [window_length,1]
- step_length: step length in samples
- audio_signal: audio signal [number_samples,1]

melfilterbank
mel_filterbank = zaf.melfilterbank(audio_signal,sampling_frequency,number_filters,number_coefficients);
- sampling_frequency: sampling frequency in Hz
- window_length: window length for the Fourier analysis in samples
- number_mels: number of mel filters
- mel_filterbank: mel filterbank (sparse) [number_mels,number_frequencies]

melspectrogram
mel_spectrogram = zaf.melspectrogram(audio_signal, window_function, step_length, mel_filterbank);
- audio_signal: audio signal [number_samples,1]
- window_function: window function [window_length,1]
- step_length: step length in samples
- mel_filterbank: mel filterbank [number_mels,number_frequencies]
- mel_spectrogram: mel spectrogram [number_mels,number_times]

mfcc
audio_mfcc = zaf.mfcc(audio_signal,sampling_frequency,number_filters,number_coefficients);
- audio_signal: audio signal [number_samples,1]
- window_function: window function [window_length,1]
- step_length: step length in samples
- mel_filterbank: mel filterbank [number_mels,number_frequencies]
- number_coefficients: number of coefficients (without the 0th coefficient)
- audio_mfcc: audio MFCCs [number_coefficients, number_times]

cqtkernel
cqt_kernel = zaf.cqtkernel(sampling_frequency,octave_resolution,minimum_frequency,maximum_frequency);
- sampling_frequency: sampling frequency in Hz
- octave_resolution: number of frequency channels per octave
- minimum_frequency: minimum frequency in Hz
- maximum_frequency: maximum frequency in Hz
- cqt_kernel: CQT kernel (sparse) [number_frequencies,fft_length]

cqtspectrogram
cqt_spectrogram = zaf.cqtspectrogram(audio_signal,sampling_frequency,time_resolution,cqt_kernel);
- audio_signal: audio signal [number_samples,1]
- sampling_frequency: sampling frequency in Hz
- time_resolution: time resolution in number of time frames per second
- cqt_kernel: CQT kernel [number_frequencies,fft_length]
- cqt_spectrogram: CQT spectrogram [number_frequencies,number_times]

cqtchromagram
cqt_chromagram = zaf.cqtchromagram(audio_signal,sampling_frequency,time_resolution,octave_resolution,cqt_kernel);
- audio_signal: audio signal [number_samples,1]
- sampling_frequency: sample frequency in Hz
- time_resolution: number of time frames per second
- octave_resolution: number of frequency channels per octave
- cqt_kernel: CQT kernel [number_frequencies,fft_length]
- cqt_chromagram: CQT chromagram [number_chromas,number_times]

dct
audio_dct = zaf.dct(audio_signal,dct_type);
- audio_signal: audio signal [number_samples,1]
- dct_type: DCT type (1, 2, 3, or 4)
- audio_dct: audio DCT [number_frequencies,1]

dst
audio_dst = zaf.dst(audio_signal,dst_type);
- audio_signal: audio signal [number_samples,1]
- dst_type: DST type (1, 2, 3, or 4)
- audio_dst: audio DST [number_frequencies,1]

mdct
audio_mdct = zaf.mdct(audio_signal,window_function);
- audio_signal: audio signal [number_samples,1]
- window_function: window function [window_length,1]
- audio_mdct: audio MDCT [number_frequencies,number_times]

imdct
audio_signal = zaf.imdct(audio_mdct,window_function);
- audio_mdct: audio MDCT [number_frequencies,number_times]
- window_function: window function [window_length,1]
- audio_signal: audio signal [number_samples,1]

Author:
- Zafar Rafii
- zafarrafii@gmail.com
- http://zafarrafii.com
- https://github.com/zafarrafii
- https://www.linkedin.com/in/zafarrafii/

See also: https://github.com/zafarrafii/Zaf-Matlab

Cite As

Zafar (2021). Zaf-Matlab (https://github.com/zafarrafii/Zaf-Matlab/releases/tag/v1.0), GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2021a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.