|
68 | 68 | % audio_spectrogram = abs(audio_stft(2:window_length/2+1,:));
|
69 | 69 | %
|
70 | 70 | % % Display the spectrogram in dB, seconds, and Hz
|
| 71 | + % number_samples = length(audio_signal); |
71 | 72 | % xtick_step = 1;
|
72 | 73 | % ytick_step = 1000;
|
73 | 74 | % 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); |
75 | 76 | % title('Spectrogram (dB)')
|
76 | 77 |
|
77 | 78 | % Get the number of samples and the window length in samples
|
|
122 | 123 | % [audio_signal,sampling_frequency] = audioread('audio_file.wav');
|
123 | 124 | %
|
124 | 125 | % % 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); |
127 | 127 | % window_function = hamming(window_length,'periodic');
|
128 | 128 | % step_length = window_length/2;
|
129 | 129 | %
|
|
290 | 290 | % mel_spectrogram = zaf.melspectrogram(audio_signal,window_function,step_length,mel_filterbank);
|
291 | 291 | %
|
292 | 292 | % % Display the mel spectrogram in in dB, seconds, and Hz
|
| 293 | + % number_samples = length(audio_signal); |
293 | 294 | % xtick_step = 1;
|
294 | 295 | % 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) |
296 | 297 | % title('Mel spectrogram (dB)')
|
297 | 298 |
|
298 | 299 | % Compute the magnitude spectrogram (without the DC component and the mirrored frequencies)
|
|
371 | 372 | % cqt_kernel = zaf.cqtkernel(sampling_frequency,octave_resolution,minimum_frequency,maximum_frequency)
|
372 | 373 | %
|
373 | 374 | % Inputs:
|
374 |
| - % sampling_frequency: sample frequency in Hz |
| 375 | + % sampling_frequency: sampling frequency in Hz |
375 | 376 | % octave_resolution: number of frequency channels per octave
|
376 | 377 | % minimum_frequency: minimum frequency in Hz
|
377 | 378 | % maximum_frequency: maximum frequency in Hz
|
|
394 | 395 | % axis xy
|
395 | 396 | % colormap(jet)
|
396 | 397 | % title('Magnitude CQT kernel')
|
397 |
| - % xlabel('FFT length') |
398 |
| - % ylabel('CQT frequency') |
| 398 | + % xlabel('FFT index') |
| 399 | + % ylabel('CQT index') |
399 | 400 |
|
400 | 401 | % Compute the constant ratio of frequency to resolution (= fk/(fk+1-fk))
|
401 | 402 | quality_factor = 1/(2^(1/octave_resolution)-1);
|
|
466 | 467 | % audio_signal = mean(audio_signal,2);
|
467 | 468 | %
|
468 | 469 | % % Compute the CQT kernel using some parameters
|
469 |
| - % frequency_resolution = 2; |
| 470 | + % octave_resolution = 24; |
470 | 471 | % minimum_frequency = 55;
|
471 | 472 | % 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); |
473 | 474 | %
|
474 | 475 | % % Compute the (magnitude) CQT spectrogram using the kernel
|
475 | 476 | % time_resolution = 25;
|
|
478 | 479 | % % Display the CQT spectrogram in dB, seconds, and Hz
|
479 | 480 | % xtick_step = 1;
|
480 | 481 | % 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); |
482 | 483 | % title('CQT spectrogram (dB)')
|
483 | 484 |
|
484 | 485 | % Derive the number of time samples per time frame
|
|
831 | 832 | % audio_mdct = zaf.mdct(audio_signal,window_function);
|
832 | 833 | %
|
833 | 834 | % % Display the MDCT in dB, seconds, and Hz
|
| 835 | + % number_samples = length(audio_signal); |
834 | 836 | % xtick_step = 1;
|
835 | 837 | % ytick_step = 1000;
|
836 | 838 | % 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) |
838 | 840 | % title('MDCT (dB)')
|
839 | 841 |
|
840 | 842 | % Get the number of samples and the window length in samples
|
|
0 commit comments