You are on page 1of 45

1 Introduction

Signals, Systems, and Digital Signal Processing


Definition Basic Elements of a Digital Signal Processing Advantages of Digital over Analog Signal Processing

Backgrounds1

Classification of Signals
Multi-channel and Multi-dimensional Signals Continuous-Time versus Discrete-Time Signals Continuous-Valued versus Discrete-Valued Signals

Concepts of Frequency
Physical Interpretation of Signal Frequency Continuous-Time Sinusoidal Signals Discrete-Time Sinusoidal Signals

NCTU/CSIE/DSP LAB Audio Processing Group

1.1 Signals, Systems, & Digital Signal Processing

Backgrounds2

Definition Basic Elements of DSP Advantages of Digital over Analog Signal Processing

NCTU/CSIE/DSP LAB Audio Processing Group

Definition
Signals
Any physical quantity that varies with time, space or any other independent variable. Communication beween humans and machines.

Backgrounds3

Systems
mathematically a transformation or an operator that maps an input signal into an output signal. can be either hardware or software. such operations are usually referred as signal processing.

Digital Signal Processing


The representation of signals by sequences of numbers or symbols and the processing of these sequences.
NCTU/CSIE/DSP LAB Audio Processing Group

Basic Elements of a Digital Signal Processing System


A/D Converter
Converts an analog signal into a sequence of digits Analog Input Signal
A/D A/D Converter Converter
t 0 {3, 5, 4, 6 ...}

Backgrounds4

Digital Input Signal

D/A Converter
Converts a sequence of digits into an analog signal

Digital Digital Signal Signal Processing Processing

D/A D/A Converter Converter

Analog Output Signal

Digital Output Signal

NCTU/CSIE/DSP LAB Audio Processing Group

Advantages of Digital over Analog Processing


Better control of accuracy Easily stored on magnetic media Allow for more sophisticated signal processing Cheaper in some cases

Backgrounds5

NCTU/CSIE/DSP LAB Audio Processing Group

1.2 Classification of Signals


Multichannel versus Multidimensional Signals

Backgrounds6

Signals may be generated by multiple sources or multiple sensors. Such signals are multi-channel signals. A signal which is a function of M independent variables is called multidimensional signals.

Continuous-Time versus Discrete-Time Signals


Continuous-time signals are defined for every value of time. Discrete -time signals are defined at discrete values of time.

Continuous-Valued versus Discrete-Valued Signals


A signal which takes on all possible values on a finite range or infinite range is said to be a multi-channel signal. A signal takes on values from a finite set of possible values is said to be a multi-dimensionall signal.

NCTU/CSIE/DSP LAB Audio Processing Group

Examples
A picture is a two-dimensional signal
I(x,y) is a function of two variables.

Backgrounds7

A black-and-white television picture is a three-dimensional signal


I(x,y,t) is a function of three variables.

A color TV picture is a three-channel, three-dimensional signals


Ir(x,y,t), Ig(x,y,t), and Ib(x,y,t)

NCTU/CSIE/DSP LAB Audio Processing Group

1.3 Concepts of Frequency


Physical Interpretation of Signal Frequency Continuous-Time Sinusoidal Signals Discrete-Time Sinusoidal Signals

Backgrounds8

NCTU/CSIE/DSP LAB Audio Processing Group

Physical Interpretation of Signal Frequency


A familiar term in physics and mathematics
Radio transmitter/receiver Amplifier Color photography ...............

Backgrounds9

NCTU/CSIE/DSP LAB Audio Processing Group

Physical Interpretation of Signal Frequency


Interpretation
Closed related to a specific type of periodic motion called harmonic oscillation, described by sinusoidal functions. Usually a dimension of inverse time.

Backgrounds10

Why is the term important ?


Time

NCTU/CSIE/DSP LAB Audio Processing Group

Physical Interpretation of Signal Frequency


Time Domain Representation

Backgrounds11

An Observation

Fourier Transform

Frequency-Domain Representation
NCTU/CSIE/DSP LAB Audio Processing Group

Physical Interpretation of Signal Frequency

Backgrounds12

Signal can be represented either through time- or frequency-domain. Frequency-domain representation of signals provides another viewpoint benefitial to signal analysis, human sensitivity, system design, and phenomenon interpretation. Frequency Transform: the tool to decompose a timedomain signal into frequency components. The "frequency" can be considered as the varying rate of the signal f(x) in x-domain.
f(t)

f(F) Time

Spectrum Frequency

NCTU/CSIE/DSP LAB Audio Processing Group

1.3 Concepts of Frequency


Physical Interpretation of Signal Frequency Continuous-Time Sinusoidal Signals Discrete-Time Sinusoidal Signals

Backgrounds13

NCTU/CSIE/DSP LAB Audio Processing Group

Continuous-Time Sinusoidal Signals


Backgrounds14

Definition Xa(t) = A cos( t+ )

-*<t<*
A is the amplitude of the sinusoid
is the frequency in radians per second

is the phase in radians

F=/2 is the frequency in cycles per second or hertz

Time

NCTU/CSIE/DSP LAB Audio Processing Group

Continuous-Time Sinusoidal Signals (Cont.)


For every fixed value of F, Xa(t) is periodic
Xa(t+Tp) = Xa(t), Tp=1/F

Backgrounds15

Continuous-time sinusoidal signals with distinct frequencies are themselves distinct Increasing the frequency F results in an increase in the rate of oscillation

NCTU/CSIE/DSP LAB Audio Processing Group

Discrete-Time Sinusoidal Signals


Definition X(n) = A cos( n+ ), -*<t<*
A is the amplitude of the sinusoid is the frequency in radians per second is the phase in radians

Backgrounds16

f=/2 is the frequency in cycles per second or hertz


X(n) = A cos( n+ )

NCTU/CSIE/DSP LAB Audio Processing Group

Discrete-Time Sinusoidal Signals(Cont.)


A discrete-time sinusoidal is periodic only if its frequency f is a rational number
X(n+N) = X(n), N=p/f, where p is an integer

Backgrounds17

X(n) = A cos( n+ )

Discrete-time sinusoidal signals where frequencies are separated by an integer multiple of 2 are identical
X1(n) = A cos( 0 n) X2(n) = A cos( (0 +2) n)

The highest rate of oscillation in a discrete-time sinusoidal is attained when = or (=-), or equivalently f=1/2.
X(n) = A cos(( 0+)n) = -A cos((0+)n

NCTU/CSIE/DSP LAB Audio Processing Group

2. The Process of A/D and D/A Conversion


Basic Elements Signal Sampling Anti-aliasing Filtering Quantization Interpolator Smoothing Filters

Backgrounds18

NCTU/CSIE/DSP LAB Audio Processing Group

2.1 Basic Elements


Analog Input Signal
Cut-off Frequency Fc
Antialiasing Antialiasing Filter Filter
t 0 t t

Backgrounds19

Sampling Frequency Fs
Sampler Sampler

The number of bits


Quantizer Quantizer
{3, 5, 4, 6 ...}

Digital Digital Signal Signal Processing Processing

{3, 5, 4, 6 ...}

Smoothing Smoothing Filter Filter

Interpolator Interpolator

Analog Output Signal

Cut-off Frequency Fc*

Sampling Frequency Fs*

NCTU/CSIE/DSP LAB Audio Processing Group

2.1 Basic Elements(c.1)


An Observation

Backgrounds20

The mapping between discrete-frequency and analogfrequency is one-to many


NCTU/CSIE/DSP LAB Audio Processing Group

2.1 Basic Elements(c.2)


Sampler
Converts a continuous-time signal into a discrete-time signal.

Backgrounds21

Anti-aliasing Filter(A low-pass filter)


Deletes the frequency components above a threshold frequency to avoid the aliasing effects.

Quantizer
Converts a discrete-time continuous-valued signal into a discrete-time, discrete-valued signal

Antialiasing Antialiasing Filter Filter


t 0

Sampler Sampler

Quantizer Quantizer {3, 5, 4, 6 ...}


t
NCTU/CSIE/DSP LAB Audio Processing Group

Fc

Fs
t

2.1 Basic Elements

2.1 Basic Elements(c.3)


Interpolator
Converts a discrete-time signal into a continuous-time signal.

Backgrounds22

Smoothing Filter
Deletes the frequency components above a threshold frequency to avoid the image signal.

t t

{3, 5, 4, 6 ...}
t

Smoothing Smoothing Filter Filter

Interpolator Interpolator

Analog Output Signal

Cut-off Frequency Fc*

Sampling Frequency Fs*

NCTU/CSIE/DSP LAB Audio Processing Group

2.1 Basic Elements(c.4)


Analog Input Signal
Cut-off Frequency Fc
Antialiasing Antialiasing Filter Filter
t 0 t t

Backgrounds23

Sampling Frequency Fs
Sampler Sampler

The number of bits


Quantizer Quantizer & &Coder Coder
{3, 5, 4, 6 ...}

t t

{3, 5, 4, 6 ...}

Digital Digital Signal Signal Processing Processing

Smoothing Smoothing Filter Filter

Interpolator Interpolator

Analog Output Signal

Cut-off Frequency Fc*

Sampling Frequency Fs*

NCTU/CSIE/DSP LAB Audio Processing Group

2.2 Signal Sampling


Sampling

Backgrounds24

The conversion of a continuous-time signal into a discrete-time signal obtained by taking "samples" of the continuous-time signal at discrete-time instants Xa(nT) = X(n) where T is the sampling interval

Many-to-One Mapping between F and f

Time X(t) X(n)

NCTU/CSIE/DSP LAB Audio Processing Group

Analog Frequency <==> Discrete FrequencyBackgrounds25


The relationship between the time variables t and n
t = nT = n/Fs

2.2 Signal Sampling (c.1)

Analog Frequency F (or ) <==> Discrete Frequency f ()


Xa(nT) = x(n) = Acos(2FnT +) = A cos (2pnF/Fs + ) compare with x(n) = A cos (2fn+) f = F/Fs or = T

f = F/Fs or = T

f
X(n) = A cos( n+ )

NCTU/CSIE/DSP LAB Audio Processing Group

2.2 Signal Sampling (c.2)


Frequency Restriction
Backgrounds26

Continuous-Time Frequency -<F< -*<< Discrete-Time Frequency - 1/2 < f < 1/2 -<< Relation and Restriction - Fs/2 < F < Fs/2 - Fs < < Fs

Many-to-One Mappling between F and f

NCTU/CSIE/DSP LAB Audio Processing Group

2.2 Signal Sampling (c.3)


Frequency Relation
Backgrounds27

Many-to-one Mapping Fk = F0 + kFs are indistinguishable from the frequency F0 after resampling and hence they are aliased of F0.

f 0 -Fs/2 -Fs Fs/2 Fs F

Folding Frequency ==> Fs/2

NCTU/CSIE/DSP LAB Audio Processing Group

2.2 Signal Sampling (c.4)


Sampling Theorem
If the highest frequency contained in an analog signal Xa(t) is Fmax =B and the signal is sampled at a rate Fs > 2Fmax = B, then Xa(t) can be exactly recovered from its sample values using the interpolation

Backgrounds28

sin 2 Bt g(t ) = 2 Bt

Thus Xa(t) may be expressed as

n Xa ( n / Fs ) g( t ) x a (t ) = n Fs =
where Xa(n/Fs) = Xa(nT) = X(n) are the sample of Xa(t)

NCTU/CSIE/DSP LAB Audio Processing Group

2.2 Signal Sampling (c.5)


History

Backgrounds29

Cauchy, French, 1841 Functions could be nonuniformly sampled and averaged over a long period. Whittaker, Scottish, 1915 A bandlimited function can be completely reconstructed from samples. (first mathematical proof of a general sampling theorem) K. Ogura, Japanese, 1920 If a function is sampled at a frequency at least twice the highest function frequency, the samples contain all the information in the function, and can reconstruct the function. Carson, American, 1920 Unpublished proof that related the same result to communication.

NCTU/CSIE/DSP LAB Audio Processing Group

2.2 Signal Sampling (c.6)


History (c.1)

Backgrounds30

Nyquist, Sweden, 1928 For complete signal reconstruction, the required frequency bandwidth is proportional to the signalling speed. The minimum bandwidth is equal to half the number of code elements per second. Expressed the theorem in terms that are familiar to communication engineers. Kotelnikov, Russian, 1933 A proof of sampling theorem Shannon, American, 1949 Unified many aspects of sampling and founded the larger science of information theory.

NCTU/CSIE/DSP LAB Audio Processing Group

2.3 Antialiasing Filters


Aliasing
F +- kFs are mapped into the same discrete frequency f 0 Fs/2 F Fs

Backgrounds31

-Fs -Fs/2

NCTU/CSIE/DSP LAB Audio Processing Group

2.3 Antialiasing Filters


1 Low-Pass Filter

Backgrounds32

Purpose: Delete the frequency components that will be aliased to low frequency components.

Fc

Low-Pass Filters Fc < Fs/2

NCTU/CSIE/DSP LAB Audio Processing Group

2.4 Quantization
z Quantization
Express each sample value as a finite number of digits.

Backgrounds33

Output of Sampler

z Quantization Error
The error introduced in representing the continuous-value signal by a discrete value levels. Output of Quantization

z Signal-to-quantization noise ratio, SQNR(dB)


1.76 + 6.02b 16 bits CD audio data has a quality of more than 96 dB

NCTU/CSIE/DSP LAB Audio Processing Group

2.4 Quantization (c.1)


SQNR(dB)
The maximum root mean square signal Srms is

Backgrounds34

S rms =

Q 2 b 1
21 / 2

The rms quantization error is


2 E rms = e p e de ( )
1/ 2

1 = Q

e 2de

1/ 2

Q 2 = 12

1/ 2

Q
( 12 )1 / 2

The poweer ratio is


S 3 ( dB ) = 10 log ( 2 2b ) = 6 . 02b + 1. 76 E 2
NCTU/CSIE/DSP LAB Audio Processing Group

2.4 Quantization (c.2)


Observation
The quantization error is random and perceptually similar to analog white noise for large amplitude signals. Problems low-amplitude signals. narrow band signals.

Backgrounds35

Dither
Decorrelates the errors from the signals. Allows the digital system to encode amplitude smaller than the LSB.

NCTU/CSIE/DSP LAB Audio Processing Group

2.4 Quantization-- Types of Dither


Gaussian pdf
Contributes to Q2/4

Backgrounds36

Rectangular pdf
Contributes to Q2/12

Triangular pdf
Contributes to Q2/6

NCTU/CSIE/DSP LAB Audio Processing Group

2.4 Quantization (c.4)


Earliest Dither in Word War II
Jim MacArthur has pointed out Bombers used mechanical computers to perform navigation and bomb trajectory calculations. These computers perform more accurately when flying on board the aircraft and less well on ground. Engineers realized that the vibration from the aircraft reduced the error from sticky moving parts.

Backgrounds37

NCTU/CSIE/DSP LAB Audio Processing Group

Optimal Interpolator

2.5 Interpolator
Optimal Interpolator:
from Sampling Theorems
Zero-order Interpolator

Backgrounds38

First-order Interpolator

no distortion for the frequency components below Fs/2 no frequency components above Fs/2 exist and smoothing filtering is not necessary

n Xa (n / Fs)g(t ) xa (t ) = n Fs =

Suboptimal Interpolator
Signal Mangitude Spectrum F Fs 2Fs

distortion exists for the frequency components below Fs/2 result in passing frequencies above the folding frequency and smoothing filtering is necessary
NCTU/CSIE/DSP LAB Audio Processing Group

2.6 Smoothing Filters

Backgrounds39

Delete the frequency components above a threshold frequency to avoid the image signal introduced by suboptimal filters
Low-pass filtering 1 Low-Pass Filter Smoothing Smoothing Filter Filter
t t

Fc'

Signal Mangitude Spectrum

Cut-off Frequency Fc*


F

2Fs

Fs

2Fs

NCTU/CSIE/DSP LAB Audio Processing Group

2.7 Concluding Remarks


Time/Frequency Illustrarion
Antialiasing filtering and Antiimaging filtering

Backgrounds40

NCTU/CSIE/DSP LAB Audio Processing Group

2.7 Concluding Remarks


Analog Input Signal
Cut-off Frequency Fc
Antialiasing Antialiasing Filter Filter
t 0 t t

Backgrounds41

Sampling Frequency Fs
Sampler Sampler

The number of bits


Quantizer Quantizer
{3, 5, 4, 6 ...}

{3, 5, 4, 6 ...}

Digital Digital Signal Signal Processing Processing

Analog Output Signal

Smoothing Smoothing Filter Filter

Interpolator Interpolator

Cut-off Frequency Fc*

Sampling Frequency Fs*


NCTU/CSIE/DSP LAB Audio Processing Group

Experiment 1
WinAmp Architectures

Backgrounds42

Describe the functionality of Input Plugin, Output Plugin, DSP Plugin, and VIS Plugin.

Find the Input Plugin for Wave File. Change the decoded results for Stereo Channels as

L[n] = L[n] + {L[n] R[n]} R[n] = R[n] + {R[n] L[n]}


Find the suitable parameters for the two parameters. Describe the noise you have found during the experiments.

NCTU/CSIE/DSP LAB Audio Processing Group

Experiment 2
Sampling Rates Change Problem.

Backgrounds43

1. Change the sampling rates from 44.1kHz to 22.05 kHz by eliminate the odd samples of stereo channels. L[n] = L[2n] R[n] = R[2n] Listen to the resulted music and describe the artifacts. Compare the spectrum through COOL editor to find the spectrum artifact. 2. Change again the sampling rates from 44.1 kHz to 11.025 kHz by three samples every four samples. L[n] = L[4n] R[n] = R[4n] Listen to the resulted music and describe the artifacts. Compare the spectrum through COOL editor to find the spectrum artifact.

NCTU/CSIE/DSP LAB Audio Processing Group

Experiments
Analog Input Signal
Cut-off Frequency Fc Antialiasing Antialiasing Filte r Filter
t 0

Backgrounds44

Sampling Frequency Fs
Sampler Sampler

The number of bits


Quantizer Quantizer
{3, 5, 4, 6 ...}

Sampling Frequency Fs*

Cut-off Frequency Fc* Smoothing Smoothing Filter Filter

Interpolator Interpolator
t

Fc=Fc' and is below 1.5 k ==> Lowpass filtering effects Fc > Fs/2 ==> Aliasing effects Quantization effects Fs' > Fs or Fs' < Fs ==> Frequency mismatching Fc' > Fs/2 ==> Image effects

Analog Output Signal

NCTU/CSIE/DSP LAB Audio Processing Group

Hearing Area in Frequency Domain


Backgrounds45

1. Blind Deconvolution for the first music 2. Piano Music a. Original One b. Low-pass One c. Image Distortation (too many high frequency) d. Aliasing effects Quantization Noise is independent of the Original Signals ?

NCTU/CSIE/DSP LAB Audio Processing Group

You might also like