5.8. Exercises#

Exercise 5.1

If \(N=100\) and \(f_s = 8000\), what is the lowest non-zero analysis frequency?

Exercise 5.2

What values of \(f_s\) and \(N\) would be necessary to ensure that the minimum and maximum (non-zero) analysis frequencies cover the range of typical human hearing (20-20000 Hz)?

Exercise 5.3

Imagine a signal of \(N\) samples is extended by padding with \(N\) additional zeros, resulting in a signal \(y[n]\) of length \(2\cdot N\). How does the DFT \(Y[m]\) compare to the DFT of the original signal \(X[m]\)?

In particular:

  • How does the set of analysis frequencies change?

  • For any given frequency index \(m\), what can you say about \(Y[m]\) in relation to the original spectrum \(X\)?

Exercise 5.4

Generate different types of signals with the same fundamental frequency (square, triangle, sawtooth). For each one, compute its DFT and look at its magnitude spectrum. Can you tell apart the different types of waves by the placement and magnitudes of their harmonics?

Hint

The scipy.signal.square and scipy.signal.sawtooth functions can be used to generate these signals.

Exercise 5.5

Generate a sinusoid at \(f_0 = 110\) for 1 second at \(f_s = 8000\). Then, apply different levels of quantization: 8-bit, 4-bit, 2-bit, and 1-bit. For each quantized signal, compute its DFT. How does it compare (qualitatively) to the original signal’s DFT?

Exercise 5.6

Make (or find) a recording of the note \(D\sharp 5\) on an instrument of your choice. Using the code provided for analyzing the trumpet recording, compute its DFT and magnitude spectrum. How does its spectrum compare to that of the trumpet?