I want to generate a spectrogram for a given song in Matlab, segmented at 1 second intervals, with 50% overlap.

I want to reproduce the results of a paper, which suggests computing the spectrogram on the 21 first Bark bands. My code is as follows, and I am not sure if it is correct. I would appreciate feedback on the process. I use 1:7700, so I can obtain a matrix with 7700 rows, which I can then segment into each individual bin. But I am not sure if the result returned makes sense.

[sounds,freqs]=audioread(file_name);

windowsize=floor(freqs); %if i want to change the windowsize to 0.5sec, I can delete by 2. So floor here is not required

%you can start from 0 or 20.

BandBarks = [20, 100, 200, 300, 400, 510, 630, 770, 920, 1080, 1270, 1480, 1720, 2000, 2320, 2700, 3150, 3700, 4400, 5300, 6400, 7700];

Spectro=spectrogram(sounds,hann(windowsize),floor(0.5*windowsize),1:7700);

%OR should I use

Spectro=spectrogram(sounds,hann(windowsize),floor(0.5*windowsize),1:7700,freqs);

Similar questions and discussions