Expt-4: Basics of DSP

To study the effects of sampling, aliasing and quantization on speech signals by playing them at different rates (stretching and expanding the time scale) and observation of effect of quantization (upto 1bit/sample).


Discretization of a continuous time signal -sampling and aliasing

Consider a continous-time signal \(x_c(t)\) whose Fourier transform is \(X_c(\omega)\). Then $$ x_c(t)=\frac{1}{2\pi}\int\limits_{-\infty}^{\infty} X_c(\Omega) e^{j \Omega t} d\Omega$$ and $$ X_c(\Omega)=\int\limits_{-\infty}^{\infty} x_c(t) e^{-j \Omega t} dt$$ A discrete-time signal \(x_d(n)\) can be obtained by uniformly sampling the continuous-time signal \(x_c(t)\) at discrete intervals \(nT\) where T is called the sampling period. Consider a unit impulse function \(\delta(t)\), whose value is \(1\) at \(t=0\) and \(0\) elsewhere. Then the unit impulse sequence can be expressed as $$ s(t) = \sum\limits_{n=-\infty}^{\infty} \delta(t-nT), $$ and \(x_d(n)\) can be expressed as \begin{eqnarray} x_d(n) & = & x_c(t) s(t)\\ & = & x_c(t) \sum\limits_{n=-\infty}^{\infty} \delta(t-nT)\\ & = & x_c(nT). \end{eqnarray}

Signal Impulse train
Sampling Sampled Signal
Figure. 1: (a) Damped sinusoid, (b) Impulse train, (c) Illustration of sampling and (d) Sampled signal.

Figure 1 illustrates the process and effect of sampling a continuous-time signal in the time domain. In the frequency domain, the corresponding Fourier transform of \(x_d(n)\) can be obtained by convolving the individual Fourier transforms of \(x_c(t)\) and \(s(t)\). This is because multiplication of two sequences in the time domain is equivalent to convolution in the Fourier domain. Similarly multiplication in the Fourier domain is equivalent of convolution in the time domain.

To observe the effect of sampling in the frequency domain, consider the Fourier Transform of \(s(t)\) given by $$ S(\Omega) = \int\limits_{-\infty}^{\infty} s(t) e^{-j \Omega t} dt $$ Since \(s(t)\) is periodic with period T \begin{eqnarray} S(\Omega) & = & \frac{1}{T} \int\limits_{-\infty}^{\infty} \sum\limits_{k=-\infty}^{\infty} \delta(t-kT) e^{-j \Omega t} dt\\ & = & \sum\limits_{k=-\infty}^{\infty} e^{-j \Omega kTt}\\ & = & \frac{2\pi}{T} \sum\limits_{k=-\infty}^{\infty} \delta(\Omega - k \Omega_d), \end{eqnarray} where \(\Omega_d=\frac{2\pi}{T}\).

Thus the Fourier transform of an impulse train with period \(T\) is another impulse train with period \(\frac{2\pi}{T}\). To illustrate the effect of sampling in the frequency domain, consider some arbitrary Fouirer transform of a signal with bandwidth \(B\) shown in Figure 2(a). The Fourier transform of the impulse train sequence with period \(T\) is shown in Figure 2(b) where \(F_s=\frac{1}{T}\) denotes the sampling frequency. The corresponding discrete-time Fourier transform of of the sampled signal is shown in Figure 2(c); If the sampling frequency is reduced (\(F_s < 2B\)) , the resultant discrete-time Fourier transform (shown in Figure 2(d)) clearly indicates the overlapping of spectral components. This effect is called aliasing and is due to an insufficient sampling rate. If the signal is sampled at a sampling frequency of \(F_s = 2B\), then no spectral distortion occurs as can be seen from (shown in Figure 3). Hence the minimum sampling frequency required to discretize a signal without aliasing is equivalent to twice the bandwidth of the signal. This frequency is referred to as the Nyquist rate.

Signal FT Impulse train FT
Oversampled Undersampled
Figure. 2: Fourier transform of (a) Bandlimited signal and (b) Impulse train. Discrete time Fourier transform of (c) Oversampled signal (\(Fs>2B\)) (d) Undersampled signal (\(Fs<2B\)).
Figure. 3: Discrete time Fourier transform of signal sampled at Nyquist frequency (\(Fs=2B\)).

Digitization of a discrete-time signal - Quantization and quantization error

A discrete-time signal obtained through sampling is still a continuous amplitude time sequence, where each samples value has an infinite precision.But digital computers are finite precision devices and hence there is a need to discretize and limit the range of sample values. This is achieved by quantization (more accurately scalar quantization). In the quantization process, each sampled value of a discrete-time signal is compared against a finite set of amplitude values and assigned a value in the set that is closest to the discrete-time value. The number of elements in the finite set is determined by the precision of the digital system. In an 8-bit system, there are \(2^8 =256\) elements in the set. The number of elements in the the finite set is referred as the number of quantization levels. If the difference in values of adjacent elements in the ordered set is constant, then the quantizer is referred as an uniform linear quantizer. Figure 4 shows the effect of quantizing a line using a 3-bit quantizer.

Figure. 4: Quantization of a linear segment of an analog signal.

Since the digital signal is obtained by quantizing the continuous valued discrete-time signal, there is an error introduced in representation of the signal. If the discrete-time signal \(x_d(n)\) has a limited amplitude range i.e., \(|x_d(n)|\leq A_\mbox{max}, n=-N,\ldots,0,\ldots N\)  , then the quantizer error introduced by a B-bit uniform quantizer is $$Q_e=\frac{A_\mbox{max}}{2^B}$$ Hence the quantizer error for each sample \(e(n)\) is defined as $$e(n) = x_d(n)-x_D(n), n=-N,\ldots,0,\ldots N$$, where \(-\frac{Q_e}{2} \leq e(n) \leq \frac{Q_e}{2}\).

  1. Record a short utterance of speech for 2 to 3 sec (16 kHz, 16 bits).

  2. Listen to speech at different bit rates (16 bits/sample, 8 bits/sample and 1 bit/sample).

  3. Listen to speech at different sampling rates (16 kHz, 8 kHz, 4 kHz and 2 kHz) with and without aliasing.

  4. Design a second order resonator, i.e., an all-pole filter with complex conjugate pole-pair, given the resonance frequency and the bandwidth.
  5. Write a brief note on the observations.


  • The quality of speech is directly proportional to the number of quantization levels ( that is, number of bits used for quantization).Though quantization results in loss of information the human perception mechanism can still get the information present in the speech signal.

  • It is interesting to note that even with 1 bit/sample, most of the speech is intelligible. Hence we can conclude that information lies in the sequence and not in the set of numbers.

  • The aliasing effect is perceived as distortions in the output signal. This is due to the effect of overlapping of frequency components.

  • Explain why one can make out the message even with one bit quantization?

  • Write an algorithm for reducing the number of bits per sample (quantization levels) from a 16 bits to any given value say 8, 4, 2 or 1. (HINT: Assume that an "int floor(double)" function exists which takes in a float or double number and returns a integer part of the number.)

  • Show that the radius \( r \) of a pole in the \( z \)-plane is related to the bandwidth \( B \) by the expression $$ r = e^{-\pi B T}, $$ where \( T \) is the sampling interval.

  • Using the result \( r = e^{-\pi B T} \), show that the transfer function of a resonator with a pair of complex conjugate poles is given by $$ H(z) = \frac{1}{1-2e^{-\pi B_1 T}\cos{(2\pi F_1 T)} z^{-1} + e^{-2\pi B_1 T} z^{-2} },$$ where \( F_1 \) is the frequency of the resonator, \( B_1 \) is the bandwidth of the resonator, \( r \) is the radius of the pole in the \( z \)-plane, and \( T \) is the sampling interval.

  • Digital Processing of Speech Signals, L.R. Rabiner and R.W. Schafer, Chapter 2
  • Digital Processing of Speech Signals, L.R. Rabiner and R.W. Schafer, Chapter 5