# Exercises

# 5.8. Exercises#

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

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)?

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\)?

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.

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?

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?