Question 1, Fourier Transform
1a)
Question
(a) The plot in Figure Q1 shows the frequency spectrum of a short sentence spoken by a male into a microphone with flat frequency response. i. What is the fundamental frequency of the lowest vowel? State which harmonic(s) of the vowel can be identified (if any). Explain how you have identified the fundamentals and harmonics (if any). [6] ii. Speech has aperiodic hissing sounds such as /s/, or /f/. Explain which part of the spectrum these sounds most likely occupy in the plot of Figure Q1 and provide an explanation for your reasoning. [6]
i) The fundamental of the lowest vowel will be the lowest “peak” we can identify, as well as the strongest peak, which we can see corresponds to the peak just above 100Hz, logically this extends then that our next harmonic is at 2F, or just above 200Hz, which we can also see. ii) These hissing noises will naturally be of a higher frequency than our vowels, and on top of this, we can assume their fundamental will most likely be the second most dominant frequency, which we can identify around 300Hz
1b)
Question
The sound recording of the speech is 10 secs long at a sampling rate of 50 KHz. Your task is to improve the quality of the speech. This is to be achieved by boosting the amplitudes of the high order harmonics between 6 kHz and 10 kHz in the frequency domain by manipulating the Fourier transformed frequency coefficients , then transforming back into the time domain. Calculate the index range of of the frequency samples based on the frequency range of the harmonics 6 kHz … 10 kHz and provide the formula(s) or python code fragment to boost the corresponding frequency amplitudes by a factor of two so that the inverse becomes real valued again. [8]
def improve_quality(signal):
f_sig = np.fft.fft(signal)
N = 10 * 50000 # 500,000
sixk_hz = int((6/50)* N) # 60,000
tenk_hz = int((1/5)* N) # 100,000
f[sixk_hz : tenk_hz] *= 2
f[-tenk_hz : -sixk_hz] *= 2
return np.fft.ifft(f_sig)1c)
Question
Imagine you want to use the Fourier Transform in a real-time system to manipulate a spectrum. What problems would arise? [5]
The problem is that just using the Inverse Fourier Transform would be acausal as the integral spans the range , which as we can see goes into the negative, which in the context of a real time system, negative time doesnt exist. In addition to this, as it evaluates at every point we could treat it like a filter with “infinite” taps, which would obviously cause infinite latency. If we were to take it in just blocks at a time, the system wouldnt really be considered real-time and would be very slow
Question 2, FIR Filtering
2a)
Question
An electrocardiogram (ECG) sampled at 500 Hz has 50 Hz interference and unwanted DC. (a) Frequencies below 0.5Hz need to be removed along with 50Hz mains interference using the same filter. Sketch the ideal frequency response of an FIR filter also including the mirror in the sampled frequency space having N frequency samples. Provide formulas of how to map the cutoff frequencies to the frequency indices k of the discrete spectrum .
Bandpass from 0.5Hz to 50Hz
Sketch this later
2b)
Question
(b) How many taps for the FIR filter are needed if the highpass has a cutoff frequency of 0.5 Hz and the bandstop filter should eliminate frequencies between 48 Hz and 52 Hz? Provide an explanation. [7]
In this case we have two filters here, highpass and bandstop, so we’ll calculate each seperately:
- Highpass, Taps =
- Bandstop, Taps =
Since we need to handle both, we take the larger of the two, and conclude we need 1000 taps. (In real systems the drop off tends to be too low however, and you can multiply this number by 2 or 4 for a better tap amount for the filter).
2c)
Question
(c) It turns out that the 50 Hz mains interference is not a pure sinusoid and its 1st harmonic also needs to be removed. Modify the ideal frequency response of the FIR filter so that it contains a notch for the 1st harmonic and state the real frequencies and the frequency sample indices. [7]
The real frequencies would be between 98-102. And therefore the indicies would be: and respectively.
2d)
Question
The discrete convolution is defined as: A Google search often claims that an FIR filter performs this operation. Is that statement 100% true if we don’t know anything about h(n) or x(n)? Provide an explanation. [4]
This statement isn’t true until we know more about h(n) or x(n) as the FIR filter is an approximation of the convolution. As the name suggests it is a “Finite” impulse response, i.e. the response is instead of the range necessary for a “true” convolution
Question 3, IIR Filters
Question
(a) Butterworth filter poles of even filter order are evenly distributed in the left half s plane forming a half circle as shown in Fig. Q3. This example is a 6th order filter; it has 3 pairs of poles where the imaginary values flip sign. How would you distribute the poles over a chain of digital filters so that processing is guaranteed real valued within every building block, and so that higher order filters can be created with minimal additional algebra? Provide a sketch which makes clear which poles will be used in the different building blocks. [7]
Poles grouped into complex conjugate pairs from right to left, i.e. 3rd → 2nd → 1st on the graph, each into stable second order filters,
Question
(b) The analogue filter is a lowpass filter. How would you use the analogue poles of Fig. Q3 to derive the digital coefficients h(n) to achieve maximum damping at the Nyquist frequency? State the transform you would use and provide a reason why it is appropriate. [7]
For maximum accuracy along the frequency plane, we would use the bilinear transform, i.e.
This is effective as it maps the frequencies non-linearly, allowing us to map all frequencies: This is important for the low-pass as infinity maps to the nyquist frequency allowing for max damping at that point.
Question
(c) Will the resulting digital filter also have zeroes? Provide an explanation. [5]
Yes, the bilinear tranform introduces zeros, as it introduces a z term on the numerator for each s. This is also needed to preserve stability as we are also introducing the poles, so these need to cancel each other out.
Question
(d) Explain why this digital filter is stable when using integer arithmetic but not necessarily when using floating point: [6]
This filter is stable using integer arithmetic, as it is a marginally stable system, i.e. it oscillates, and crucially, there are no extra inaccuraies added in the math. However, due to the nature of floating point arithmetic, there are always small inaccuacies. Now given that this system is on the exact edge of being stable, any small push beyond this can spiral, and cause an unstable system that tends to infinity.
Question 4
4a)
Question
FIR filter design in the frequency domain (a) Sketch the frequency response of an ideal digital bandstop filter with cut off frequencies and . [5]
4b)
Question
(b) Perform an inverse Fourier transform of the ideal bandstop filter to obtain the impulse response of the filter. [10]
4c)
Question
(c) Your task is to design a narrow bandstop filter. Which window function would you choose that maximises the bandstop rejection, and why? [5]
A hamming window would be a suitable window in this case as the higher the damping the wider the transition into the stopband, which means, in this case we dont want a very damping window, as it can affect the performance of our bandstop by cutting into it.
4d)
Question
(d) You sample a signal at 250Hz and the bandstop needs to have a bandwidth of 2Hz. What is the expected delay of the filter given the 2Hz bandwidth? [5]
We can approximate about taps here, which would correspond to a delay of about seconds. In other systems we might use 250 taps, to improve the transition, in this case, the delay would be about 1 second.
(a) The plot in Figure Q1 shows the frequency spectrum of a short sentence spoken by a male into a microphone with flat frequency response.
i. What is the fundamental frequency of the lowest vowel? State which harmonic(s) of the vowel can be identified (if any). Explain how you have identified the fundamentals and harmonics (if any). [6]
ii. Speech has aperiodic hissing sounds such as /s/, or /f/. Explain which part of the spectrum these sounds most likely occupy in the plot of Figure Q1 and provide an explanation for your reasoning. [6]
(a) Butterworth filter poles of even filter order are evenly distributed in the left half s plane forming a half circle as shown in Fig. Q3. This example is a 6th order filter; it has 3 pairs of poles where the imaginary values flip sign. How would you distribute the poles over a chain of digital filters so that processing is guaranteed real valued within every building block, and so that higher order filters can be created with minimal additional algebra? Provide a sketch which makes clear which poles will be used in the different building blocks. [7]