0% found this document useful (0 votes)
5 views38 pages

02 DSP

The document discusses discrete-time signal processing, focusing on real-world signals, sampling, quantization, and time series analysis. It covers concepts such as convolution, cross-correlation, periodic signals, Fourier transforms, and the short-time Fourier transform, emphasizing their applications in data compression, prediction, and classification. Additionally, it includes exercises and references for further study in digital signal processing.

Uploaded by

Adwik Rajesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views38 pages

02 DSP

The document discusses discrete-time signal processing, focusing on real-world signals, sampling, quantization, and time series analysis. It covers concepts such as convolution, cross-correlation, periodic signals, Fourier transforms, and the short-time Fourier transform, emphasizing their applications in data compression, prediction, and classification. Additionally, it includes exercises and references for further study in digital signal processing.

Uploaded by

Adwik Rajesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Discrete-time

Signal Processing
Vipul Arora
Real world signals

• Measured using sensors


• microphone
• camera
• instruments …
• How do we process them on (digital) computers?
Sampling and Quantization

SAMPLE
Exercise:
What is 𝐹𝑠
(sampling rate)?

QUANTIZE
Time Series

• An ordered collection of numbers


Time Series Analysis
• Data Compression
• E.g., mp3, mp4, jpeg
• Data Explanation
• E.g., why are the sales increasing?
• Data Denoising
• E.g., audio noise removal
• Prediction of future values
• E.g., weather forecasting
• Classification and detection
• E.g., detect car horn in audio
Benefits of Time Series Models

• Fast and efficient


• Real time implementation
Convolution

• 𝒉 ∈ ℝ𝐷 , generally 𝐷 ≪ 𝑀
• Reduced dependency
Convolution: with zero padding
Cross-correlation

𝑦 𝑛 = 𝑥 𝑛 ⨂ℎ 𝑛 = ෍ 𝑥 𝑚 ℎ 𝑚 − 𝑛
𝑚

• Find similar segment, shifted in time


Cross Correlation: with zero padding
Periodic Signals
Periodic Signals

• What is the fundamental frequency, F0 (in samples)?

Auto Correlation,
i.e., cross-correlation
with itself

Works for any shape of


a unit
Periodic Signals

• Decompose them into standard periodic basis

= +
_ _
2 2
Periodic Signals – a sinusoid

A sinusoid is:

• very well-behaved (continuous, differentiable)


• characterized by 3 parameters:
• Amplitude, X
• Frequency, f
• Phase, 𝜙
• Orthogonal basis
Sampling
• 𝑥 𝑡 = sin 2𝜋𝑓0𝑡
• Que: What is 𝑥 𝑛 after sampling with rate 𝐹𝑠 = 1/𝑇𝑠 ?
𝑛 2𝜋𝑓0 𝑛
• 𝑥 𝑛 = 𝑥 𝑛𝑇𝑠 = 𝑥 𝐹𝑠
= sin
𝐹𝑠

• Que: What is 𝑥෤ 𝑡 after interpolation with rate 𝐹𝑠 ?


𝑛
• 𝑥෤ 𝑡 = 𝑥 𝑇𝑠
= 𝑥 𝑛𝐹𝑠 = sin 2𝜋𝑓0𝑡

• Que: Repeat this exercise with 𝑓0 = 10 Hz and 𝐹𝑠 = 15 Hz. What is 𝑥(𝑡)?


• Que: Draw frequency of 𝑥෤ 𝑡 as a function of 𝑓0 while 𝐹𝑠 = 15 Hz.


https://youtu.be/smDpCsVVgPA?si=WlZf9EzRTAaClv-v

• https://youtu.be/smDpCsVVgPA?si=WlZf9EzRTAaClv-v (Stroboscopic effect)


Sampling

• How small a sampling rate can we choose for 𝑥෤ 𝑡 = 𝑥(t)


𝐹𝑠
• 𝑓0 = 2

• Nyquist rate 𝐹𝑠 = 2𝑓0


• What is the highest frequency we can represent, given Fs?
• fmax = Fs/2
Periodic Signals

• f = k/N
• For N samples, we can go upto N sinusoidal components
• How to estimate X[k] and 𝜙[k]?
Fourier Transforms
Discrete Fourier Transform (DFT)

Note: 𝑛 = 0, … , 𝑁 − 1

Ref: Quatieri, Chp-2


Discrete Time Fourier Transform (DTFT)


𝑋 𝑒 𝑗𝜔 = ෍ 𝑥 𝑛 𝑒 −𝑗𝜔𝑛
𝑛=−∞

1 𝜋
𝑥𝑛 = න 𝑋 𝑒 𝑗𝜔 𝑒 𝑗𝜔𝑛 𝑑𝜔
2𝜋 −𝜋

Note: 𝑛 = −∞, … , −1,0,1, … , ∞

Ref: Oppenheim, Ch-2


Discrete Fourier Transform

• If 𝑥[𝑛] is real,
• 𝑋 −𝑘 = 𝑋 ∗ 𝑘 , i.e.,
• 𝑋 𝑘 is an even function
• ∠ 𝑋 𝑘 is an odd function

• Exercise: Derive it from the definition of DFT


Discrete Fourier Transform

x[n] = sin(2𝜋 * 2/32 * n)

x[n] = 0.5 * sin(2𝜋 * 2/32 * n) + 0.5 * sin(2𝜋 * 8/32 * n)


Discrete Fourier Transform
• Zero padding
Why Spectral Representation

• Analysis of periodicity
• Compact
• Disentangles
Discrete Fourier Transform
• This representation is valid if the signal is stationary, i.e., its
characteristics do not change with time
• How about a non-stationary signal? a mess?

x[n] = sin(2𝜋 * f * n); where, f varies from 2/32 to 8/32 linearly with n
Discrete Fourier Transform
f = 2/32 f = 4/32 f = 8/32

x[n] = sin(2𝜋 * f * n)
A Quasi-stationary Signal
almost stationary in small intervals
Short time Fourier Transform
for quasi-stationary signals
Short-time Fourier Transform (STFT)

• Intuitively,

SPEEC
window size,
W
TIME

Hop size,
ACOU
H
Short-time Fourier Transform (STFT)
f = 2/32 f = 4/32 f = 8/32

5
3

x[n] = sin(2𝜋 * f * n) W = 32
A Quasi-stationary Signal H=1

STFT preserves the signal characteristics, both in time and frequency


Short-time Fourier Transform (STFT)

• The effect of changing window size, W

• Notice the trade off between time resolution vs frequency resolution


• Heisenberg uncertainty principal
Short-time Fourier Transform (STFT)

• Mathematically,

SPEECH WAVEFORM

m=0 m=2
m=1 TIME FRAMES

ACOUSTIC FEATUR
k
Window

Sharp
discontinuities
in signal cause
more side
lobes in |X[k]|
Spectrogram with windowing
Fast Fourier Transform

• FFT, 𝑂 𝑁log 𝑁 , is a faster implementation of DFT,


𝑂(𝑁 2 )

• Using FFTs in your computations results in


computational gains
Spectrograms

• https://www.youtube.com/watch?v=_FatxGN3vAM
Topics studied

• Convolution: transformation of a signal


• Correlation: similarity check
• Periodicity
• Fourier Transform: represent periodic signals
• Short Time Fourier Transform: represent quasi-periodic signals
Exercises
• Write python codes for all the concepts studied in this
lecture. Use audio signals.
• use numpy.fft for DFT
• use librosa for reading/writing audio signals
• Write a code for real time plotting of spectrogram from live
audio stream
• use pyAudio (portAudio) for access to mic and speakers
References
• DSP Course by me: https://youtube.com/playlist?list=PLbtAaXHMto-
t0TIXdaXjgwr1vi4pSz4bj
• https://www.tutorialspoint.com/digital_signal_processing/index.htm
• Quatieri, T. F. (2006). Discrete-time speech signal processing:
principles and practice. Pearson Education India (Chapter 2)
• Oppenheim, A.V., Willsky, A.S., & Nawab, H.S. (1996). Signals and
systems. Pearson press, USA.

You might also like