Extract frequency samples from .wav file

Hi,
I'd like to get a list of frequencies from a .wav file, but I don't have any idea how. I've tried to use the function wavread, from which I can get the amplitude values and plot them against the time, but what I want is to get and plot the discrete frequency values of the sound file (as I show in the image I've attached). The code I've used is the following one, and it would be perfect if I could do exactly the same operations but with the frequency values instead of the amplitude ones.
[wave,fs]=wavread('filename.wav');
t=0:1/fs:(length(wave)-1)/fs;
plot(t,wave);
Could anyone here give me a hand? Thanks in advance!

Respuestas (2)

Azzi Abdelmalek
Azzi Abdelmalek el 21 de Jun. de 2015
stem(abs(fft(wave)))

1 comentario

FirstName LastName
FirstName LastName el 23 de Jun. de 2015
Well... What I get from plotting the FFT is not exactly the union of all the frequency samples. I attach an image of the result of using this command. I would want to get something similar to the image below the amplitude graphs. The amplitude graph I get by using plot(t,wave) is correct, the problem I have is that I need to get the same but with frequency values. Thanks!

Iniciar sesión para comentar.

Star Strider
Star Strider el 21 de Jun. de 2015

0 votos

If you have the Signal Processing Toolbox, use the spectrogram function. That may provide what you want.

2 comentarios

FirstName LastName
FirstName LastName el 24 de Jun. de 2015
Thanks for your answer! I see that with the spectrogram function I can plot a lot of different graphs, but I don't just want to plot the frequency values, I also want to get and access them, that's the problem.
Star Strider
Star Strider el 24 de Jun. de 2015
My pleasure.
You can get data from spectrogram by asking it for outputs. All the data it calculates are available. See the documentation on Spectrogram and Instantaneous Frequency for details.

Iniciar sesión para comentar.

Preguntada:

el 21 de Jun. de 2015

Comentada:

el 24 de Jun. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by