Im new to Matlab. I need to split the time dimensions of an audio track into frames of 10mS and for every 10mS frame have to compute the FFT to generate the spectrograph. I need help on this.

 採用された回答

Wayne King
Wayne King 2012 年 1 月 17 日

0 投票

Hi Karthik, Why can't you just use spectrogram()? You can specify the window length (the number of samples corresponding to 10 msec) as an input.
If you cannot use spectrogram(), you can use reshape() as one option.
Suppose you have an audio signal sampled at 20 kHz.
Then 200 samples is 10 msec.
x = randn(2e4,1);
x = reshape(x,200,100);
You can then apply the Fourier transform to the columns of x.
Better than the above option is buffer(), which allows you to construct overlapping segments.
x = 1:16;
x = buffer(x,4,2)
Again, spectrogram provides a NOVERLAP input argument that handles this easily.

4 件のコメント

Karthik Raj
Karthik Raj 2012 年 1 月 17 日
K thanks for your reply.
When is use spectrogram() directly it flags an error saying input must be vector.
My audio signal is of length 4 mins. When i stored that in an array it forms a matrix of size 11470464 x 2
frequency is 44100
so samples will be 441 for 10ms correct? how to proceed?
These thing may be silly but help me.
Thanks.
Wayne King
Wayne King 2012 年 1 月 17 日
yes, you don't input an array into spectrogram(). Input a vector. If you have a two-channel audio signal, then just give spectrogram 1 column
input = x(:,1);
Yes, that is correct. 441 samples. You will definitely want to play with NOVERLAP.
You can try:
S = spectrogram(x,441,[],[],44100);
to start
Wayne King
Wayne King 2012 年 1 月 17 日
[s,f,t,p] = spectrogram(x,441,[],[],44100);
surf(t,f,10*log10(abs(p)),'EdgeColor','none');
axis xy; axis tight; colormap(jet); view(0,90);
xlabel('Time');
ylabel('Frequency (Hz)');
Karthik Raj
Karthik Raj 2012 年 1 月 17 日
thanks i got it. Then how to input the window and fft of the signal to spectrogram?
my script looks like this...
[y,fs]=wavread('aud1.wav');
t=fs/100;
nfft=fft(y,t);
nwindow=hann(t);
[s,f,t,p]=spectrogram(y(:,1),t,nwindow,nfft,fs);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeTime-Frequency Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by