Help interpreting Audio-Signal from 'audioread( .wav)' output?

Hey
I am a beginner at MatLab and working with Audio-Signals. So I have a few basic questions:
Using the audioread('.wav') to sample a wav-file, I become to outputs, [data,fs]. data=A Matrix with two vectors of samples of the wav-file, and fs=the sampling-rate.
  1. Why do I get two vectors of data?
  2. How do I best proceed to get a plot of the frequency-domain?
  3. Should I only use the fft() on one of the vectors?
  4. What do I get if I make a convolution of the two vectors of the data?

 Accepted Answer

  1. you do not get two vectors of data. You get an N x 2 array. The left channel is in the first column and the right channel is in the second column.
  2. plot(abs(fft(A(:,1)))) . Notice this will give you the frequency information over the entire time. You might be more interested in frequency information over shorter periods of time. For that look at spectrogram
  3. It depends on your purpose. You can use fft(A) if you want. The result will be the two separate ffts combined into one array, as if you had done [fft(A(:,1)), fft(A(:,2))]
  4. something pretty useless

4 Comments

Thank you. Am I correct in assuming that the magnitude=abs(fft(A)) is measured in watts/Hz?
No, that measure is definitely wrong. The input values from audioread() are dimensionless, scaled to -1<=x<1, typically scaled from a voltage reading that might be positive and negative or might be positive only. The voltage levels depend on what you are measuring, whether it is a microphone or whether it is line level (for which the levels vary by consumer vs pro)
To get energy values you would need to have a calibration expression that knew how the original sound energy converted into voltage levels, then how the voltage level readings get converted into digital values, then about any processing that went on that might have rescaled the values. The values were then written to the .wav and the values you read back from the .wav are not necessarily the values that are stored in the .wav -- see the 'native' option of wavread() for that.
Only once you have an expression that can transform from original energy to the readings that you are dealing with can you calculate the magnitude on any kind of absolute scale. The values you get out of fft are only coefficients that make the math work, and you cannot assign physical meaning without knowing about multiple processing stages.
Thank you for your answer it was helpful for me. I've implemented FFT myself, now i am using [myfft(A(:,1)), myfft(A(:,2))] and it is giving the same graph with matlab's fft function. The problem now i have, is that using ifft it does not give back my original input signal. Can you help me to understand it?
Why do you mean by N x 2 arrays? Each column represents the sound level right? How are they different?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!