Starting from:

$35

ASAS Homework 1: Basic Audio Signal Manipulations and Fourier Transform Solved

ASAS Homework 1: Basic Audio Signal Manipulations and Fourier Transform .
1.  
(a)    In MATLAB, create an array of length N=16000, and fill the array with the following values:   𝑦[𝑛] = 0.5𝑔[𝑛 − 𝑀] sin(2πœ‹π‘“!𝑛𝑇), where T = 1/16000 sec, n = 0:(2M-1),

𝑓!  (Hz) is a frequency of your choice, and  

" <πœ‹ 𝑛 = , −𝑀 ≤ 𝑛 ≤ 𝑀

                                            𝑔[𝑛] = 9cos     2 𝑀                           

0, elsewhere

So 𝑔[𝑛 − 𝑀] should be a bell-shaped function centered around time n=M and its width is 2𝑀 samples.  

(b)   First, set the sampling rate 𝑓# =16000, M=8000, and play y[n]. By appropriately choosing 𝑓!, you should hear a pip tone. Listen to it and record the range of 𝑓! that you can hear something. #discussion

(c)    Now, set 𝑓! = 1000 Hz. Shorten M and record the range of M at which you can still hear a definite pitch. #discussion

(d)   Change sin(2πœ‹π‘“!𝑛𝑇) to cos(2πœ‹π‘“!𝑛𝑇). Can you hear any difference? This is essentially asking the question of whether the phase of an audio signal is important. #discussion 

(e)    Change the definition of 𝑔[𝑛] to 𝑔[𝑛] = 1, −𝑀 ≤ 𝑛 ≤ 𝑀 , and 𝑔[𝑛] = 0 elsewhere. Can you hear a difference in 𝑦[𝑛]? #discussion

 

2. The discrete Fourier transform is defined as follows, ,$-

π‘Œ(π‘˜) = H   𝑦[𝑛]𝑒$%&("()*/, , *.!

where π‘˜ = 0,1,2, … , 𝑁 − 1.  

(a)   Create an array of length N=16000 to store π‘Œ(π‘˜) for all π‘˜. Your result should be identical as MATLAB’s fast Fourier transform (FFT) function: Y = fft(y); here, the purpose is to verify that indeed this is the case. If so, you can feel free to use FFT from now on.

(b)   Plot |π‘Œ(π‘˜)| against frequency 𝑓 = , & 𝑓#. The result is called the magnitude spectrum of the signal. Notes: Sometimes, we prefer to view |π‘Œ(π‘˜)| in dB by taking 20 log-! |π‘Œ(π‘˜)|.

(c)    Adjusting 𝑀 and 𝑓! and observe how changes occur in the magnitude spectrum.  

3. The Short time Fourier transform π‘Œ(𝑛, πœ”) is defined as

/

                                        π‘Œ(𝑛, πœ”) = H            π‘€[π‘š]𝑦[π‘š + 𝑛] 𝑒$%1*,

0.$/

where 𝑀[𝑛] is a (usually positively-valued) window function.  

(a)   Choose an appropriate window function w[n] and calculate π‘Œ(𝑛, πœ”) for πœ” ∈ [0, πœ‹].  Verify whether your implementation produces the same result as

MATLAB’s spectrogram() function.

(b)  In the audio field, it is a common practice to view the magnitude of STFT |π‘Œ(𝑛, πœ”)|.

Read some sound files into MATLAB by audioread(), and view the spectrogram to see if you can make sense of it. Are there any patterns that correspond to audible properties of the sound?

(c)   Is it possible to reconstruct the signal y[n] from the magnitude of STFT, |π‘Œ(𝑛, πœ”)|? Why or why not? Note that by taking the absolute value of complex numbers we have ignored the phase information. #discussion 

Preview of the next homework: We will filter audio signals in the sense that each frequency receives a different gain (and delay).

More products