Revision as of 22:21, 14 November 2016 by Max (Talk | contribs)

Use of MATLAB to process Music Signals

1. Introduction

From the lecture, we learned that if we sample the given signals by certain frequency which above the Nyquist sampling frequency. We can get the pure processed signals without aliasing. If we sample the given signals by some frequency which under Nyquist sampling frequency. Then there will be aliasing in the processed signals. In this project, I want to explore what will happen in both cases. In order to feel it more directly, I decided to process some music signals. We can directly feel what will happen after processing the given music signals in two situations.


2. Method Description

In order to let people feel the project more directly. I decided to pick a famous song <Opera 2> which has much high frequency part. I pick up a piece of the song containing the highlight part. From some material, I detected that the highest tune of this song is C4(2093Hz).

  • In the first step, I pick up a sampling frequency Fa as 22050Hz which is twice bigger than 2093Hz. After sampling by Fa, we can hear the processed music signals. We can sense that whether it is clear enough compared to the original music signals.

Here is the code for STEP 1

[w,fs,bit]=wavread('D:\Vitas-opera2.wav');
wav=(w(:,1));
fwav=fft(wav);
lwav=round(length(fwav)/2);
fn=22050;  
d1=fs/fn;
j=0;
for   i=1:d1:lwav;
      j=j+1;
      dwav1(j)=wav(i);
end
sound(dwav1,fn);
  • In the second step, I pick up another sampling frequency Fb as 2205Hz which is twice less than 2093Hz.After sampling by Fb, we can hear the processed music signals. We can also sense that whether it is clear enough compare to the original music signals.

Here is the code for STEP 2

[w,fs,bit]=wavread('D:\Vitas-opera2.wav');
wav=(w(:,1));
fwav=fft(wav);
lwav=round(length(fwav)/2);
fn=2205;  
d1=fs/fn;
j=0;
for   i=1:d1:lwav;
      j=j+1;
      dwav1(j)=wav(i);
end
sound(dwav1,fn);

3. Result

  • In the first step. Comparing with the original signal, we can still hear the processed music signal clearly without noise.
  • In the second step. Comparing with the original signal, we hardly can detect what the singer sing especially for the high frequency part. The processed signals sound weird.

4. Conclusion

If we sample the signal with the sampling frequency which satisfied Nyquist frequency, then we can get the processed signal without aliasing. If we sample the signal with the sampling frequency which below twice of the highest frequency of the original signals. There will be aliasing in the processed signal. So the sound will lose some information, and will sound weird.


5. References

Alumni Liaison

Correspondence Chess Grandmaster and Purdue Alumni

Prof. Dan Fleetwood