Hi
As I understand, you need to find the spectrogram on the bark-scale. This can be achieved by the following steps :-
- Read the wave-file using audioread(filename)
- Find the spectrogram of the signal with the desired "overlap", "number of frequency bins(nfft)" and the window type using spectrogram(x)
- Window length and the overlap can be calculated as per the requirement.
- Once the spectrogram is obtain, the spectrogram on bark-scale can be obtained using hz2bark(hz)
I would suggest you to take help of the following code snippet and the libraries mentioned above :-
N = 1024;
n = 0:N-1;
[x, fs] = audioread('farspeech.wav');
duration = length(x)/fs;
t = linspace(0, duration, length(x));
plot(t, x);
xlabel('Time (s)');
ylabel('Amplitude');
window = hann(256);
noverlap = 128; % can be adjusted as needed
nfft = 512; % can be adjusted as needed
spectrogram(x, window, noverlap, nfft, fs, 'yaxis');
[s, f, t] = spectrogram(x, window, noverlap, nfft, fs, 'yaxis');
f_bark = hz2bark(f);
imagesc(t, f_bark, 20*log10(abs(s)));
axis xy;
xlabel('Time (s)');
ylabel('Bark');
colorbar;
You can also obtain spectrogram with different scales directly by using simulink block. I would suggest you to go through the following link for you benifit and interest.
Hope this helps!