Skip to content

Commit 309e963

Browse files
committedApr 13, 2021
Finalizing before release.
1 parent b7b065c commit 309e963

File tree

2 files changed

+38
-34
lines changed

2 files changed

+38
-34
lines changed
 

‎examples.ipynb

+25-23
Large diffs are not rendered by default.

‎zaf.m

+13-11
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@
6868
% audio_spectrogram = abs(audio_stft(2:window_length/2+1,:));
6969
%
7070
% % Display the spectrogram in dB, seconds, and Hz
71+
% number_samples = length(audio_signal);
7172
% xtick_step = 1;
7273
% ytick_step = 1000;
7374
% figure
74-
% zaf.specshow(audio_spectrogram, length(audio_signal), sampling_frequency, xtick_step, ytick_step);
75+
% zaf.specshow(audio_spectrogram, number_samples, sampling_frequency, xtick_step, ytick_step);
7576
% title('Spectrogram (dB)')
7677

7778
% Get the number of samples and the window length in samples
@@ -122,8 +123,7 @@
122123
% [audio_signal,sampling_frequency] = audioread('audio_file.wav');
123124
%
124125
% % Set the parameters for the STFT
125-
% window_duration = 0.04;
126-
% window_length = 2^nextpow2(window_duration*sampling_frequency);
126+
% window_length = 2^nextpow2(0.04*sampling_frequency);
127127
% window_function = hamming(window_length,'periodic');
128128
% step_length = window_length/2;
129129
%
@@ -290,9 +290,10 @@
290290
% mel_spectrogram = zaf.melspectrogram(audio_signal,window_function,step_length,mel_filterbank);
291291
%
292292
% % Display the mel spectrogram in in dB, seconds, and Hz
293+
% number_samples = length(audio_signal);
293294
% xtick_step = 1;
294295
% figure
295-
% zaf.melspecshow(mel_spectrogram, length(audio_signal), sampling_frequency, window_length, xtick_step)
296+
% zaf.melspecshow(mel_spectrogram, number_samples, sampling_frequency, window_length, xtick_step)
296297
% title('Mel spectrogram (dB)')
297298

298299
% Compute the magnitude spectrogram (without the DC component and the mirrored frequencies)
@@ -371,7 +372,7 @@
371372
% cqt_kernel = zaf.cqtkernel(sampling_frequency,octave_resolution,minimum_frequency,maximum_frequency)
372373
%
373374
% Inputs:
374-
% sampling_frequency: sample frequency in Hz
375+
% sampling_frequency: sampling frequency in Hz
375376
% octave_resolution: number of frequency channels per octave
376377
% minimum_frequency: minimum frequency in Hz
377378
% maximum_frequency: maximum frequency in Hz
@@ -394,8 +395,8 @@
394395
% axis xy
395396
% colormap(jet)
396397
% title('Magnitude CQT kernel')
397-
% xlabel('FFT length')
398-
% ylabel('CQT frequency')
398+
% xlabel('FFT index')
399+
% ylabel('CQT index')
399400

400401
% Compute the constant ratio of frequency to resolution (= fk/(fk+1-fk))
401402
quality_factor = 1/(2^(1/octave_resolution)-1);
@@ -466,10 +467,10 @@
466467
% audio_signal = mean(audio_signal,2);
467468
%
468469
% % Compute the CQT kernel using some parameters
469-
% frequency_resolution = 2;
470+
% octave_resolution = 24;
470471
% minimum_frequency = 55;
471472
% maximum_frequency = 3520;
472-
% cqt_kernel = zaf.cqtkernel(sampling_frequency,frequency_resolution,minimum_frequency,maximum_frequency);
473+
% cqt_kernel = zaf.cqtkernel(sampling_frequency,octave_resolution,minimum_frequency,maximum_frequency);
473474
%
474475
% % Compute the (magnitude) CQT spectrogram using the kernel
475476
% time_resolution = 25;
@@ -478,7 +479,7 @@
478479
% % Display the CQT spectrogram in dB, seconds, and Hz
479480
% xtick_step = 1;
480481
% figure
481-
% zaf.cqtspecshow(cqt_spectrogram,time_resolution,frequency_resolution,minimum_frequency,xtick_step);
482+
% zaf.cqtspecshow(cqt_spectrogram,time_resolution,octave_resolution,minimum_frequency,xtick_step);
482483
% title('CQT spectrogram (dB)')
483484

484485
% Derive the number of time samples per time frame
@@ -831,10 +832,11 @@
831832
% audio_mdct = zaf.mdct(audio_signal,window_function);
832833
%
833834
% % Display the MDCT in dB, seconds, and Hz
835+
% number_samples = length(audio_signal);
834836
% xtick_step = 1;
835837
% ytick_step = 1000;
836838
% figure
837-
% zaf.specshow(abs(audio_mdct),length(audio_signal),sampling_frequency,xtick_step,ytick_step)
839+
% zaf.specshow(abs(audio_mdct),number_samples,sampling_frequency,xtick_step,ytick_step)
838840
% title('MDCT (dB)')
839841

840842
% Get the number of samples and the window length in samples

0 commit comments

Comments
 (0)