fundamentals of dsp -part 1 - kaist
TRANSCRIPT
![Page 1: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/1.jpg)
GCT535: Sound Technology for Multimedia
Fundamentals of DSP - Part 1
Juhan Nam
![Page 2: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/2.jpg)
Goals
β Introducing digital audio effects
β The fundamentals of digital signal processingβ Linear time-invariant (LTI) systemβ FIR / IIR Filtersβ Convolutionβ Impulse responseβ Frequency response
![Page 3: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/3.jpg)
Introduction
β Once we record or synthesize sound, we modify the acoustic characteristics using various digital audio effects β Loudness: volume, compressor, limiter, noise gateβ Timbre: filters, equalizer, distortion, modulation, chorus, flanger, vocoderβ Pitch: pitch correction, harmonizer, vibratoβ Duration: time scale modification, resampling β Spatial effect: panning, delay, reverberation, binaural (HRTF)
Input OutputDigital Audio Effects
![Page 4: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/4.jpg)
Introduction
β Filters and delaysβ Bi-quads filters: lowpass, bandpass, highpass, equalizersβ Comb filter (delayline): delay/echo, chorus, flanger, reverbβ Convolution: resampling, HRTF, reverberation (measured impulse responses)
β Non-linear processingβ Modulation: amplitude, frequencyβ Distortion and dynamic range control: compressor, limiter, noise gate
β Block-based processingβ Pitch shifting and Time-scale modification
![Page 5: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/5.jpg)
Filters and Delays
β Take the input signal π₯ π as a sequence of numbers and returns the output signal π¦ π as another sequence of numbers
β Perform a combination of three mathematic operations upon the inputβ Multiplication: π¦ π = π % π₯ πβ Delay: π¦ π = π₯ π βπβ Summation: π¦ π = π₯ π + π % π¦ π β π
Input OutputFiltersor Delays
π₯ π π¦ π
![Page 6: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/6.jpg)
Filters and Delays
β Bi-quad filterβ Two delay elements for input or outputβ The delayed output (βfeedbackβ) causes resonanceβ Rooted from analog circuits (R-L-C)
π§!"
π₯ π +
π§!" π"
π#
π$
π₯ π β 1
π₯ π β 2
π§!"
π¦ π
π§!"-π"
-π#
π¦ π β 1
π¦ π β 2
π¦ π = π$ + π₯ π + π" + π₯ π β 1 + π# + π₯ π β 2 β π" + π¦ π β 1 β π# + π¦ π β 2
![Page 7: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/7.jpg)
Filters and Delays
β Comb filterβ Use a delayline β Feedforward is used for chorus/flanger and feedback is for echo/reverbβ Rooted from magnetic tape recording
π¦ π = π₯ π + π + π₯ π β π
π§!%
π₯ π π¦ π+
Feedforward Comb Filter
π¦ π = π₯ π + π + π¦(π β π)
π§!&
π₯ π π¦ π+
π
Feedback Comb Filter
π
![Page 8: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/8.jpg)
Filters and Delays
β Convolution filterβ Conduct the convolution operation with an impulse response of a systemβ The impulse response is often measured from natural objects
β HRTF: human ears β Reverberation: rooms
π¦ π = π$ + π₯ π + π" + π₯ π β 1 + π# + π₯ π β 2 +β―+ π% + π₯ π β π
β(π)= [π$, π", π#β¦ , π%]
![Page 9: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/9.jpg)
Linear Time-Invariant Filters
β They are called Linear Time-Invariant (LTI) filters in the context of digital signal processing
β Linearityβ Scaling: if π₯ π β π¦ π , then a % π₯ π β a % π¦ πβ Superposition: if π₯! π β π¦! π and π₯" π β π¦" (n), then π₯! π + π₯" π β
π¦! π + π¦" π
β Time-Invarianceβ If π₯ π β π¦ π , then π₯ π β π β π¦ π β π for any πβ This means that the system does not change its behavior over time
![Page 10: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/10.jpg)
Linear Time-Invariant Filters
β Non-linear filtersβ π¦ π = π₯ π "
β Time-variant filtersβ π¦ π = π % π₯ π + π₯(π β 1)
β Modulation β Amplitude or frequency modulation generates new sinusoidal components
β Dynamic range compressionβ Input gain is a function of the input: π¦ π = π(π₯ π ) % π₯ π
![Page 11: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/11.jpg)
Linear Time-Invariant System
β Remember that sinusoids are eigenfunctions of linear systemβ The input sinusoids changes in amplitude and phase while preserving the
same frequencyβ No new sinusoidal components are created
LinearSystem
π#$%π΄(π)π#&($)π#$%
Amplitude Response
Phase Response
![Page 12: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/12.jpg)
The Simplest Lowpass Filter
β Difference equation: π¦ π = π₯ π + π₯(π β 1)
β Signal flow graph
π§!"
π₯ π π¦ π+
βDelay Operatorβ
![Page 13: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/13.jpg)
The Simplest Lowpass Filter: Sine-Wave Analysis
β Measure the amplitude and phase changes given a sinusoidal signal input
![Page 14: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/14.jpg)
The Simplest Lowpass Filter: Frequency Response
β Plot the amplitude and phase change over different frequencyβ The frequency sweeps from 0 to the Nyquist rate
![Page 15: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/15.jpg)
The Simplest Lowpass Filter: Frequency Response
β Mathematical approachβ Use complex sinusoid as input: π₯ π = π#$)
β Then, the output is: π¦ π = π₯ π + π₯ π β 1 = π#$) + π#$()*!) = 1 + π*#$ % π#$)
= 1 + π*#$ % π₯(π)
β Frequency response: π» π = 1 + π*#$ = π#!" + π*#
!" π*#
!" = 2cos($
")π*#
!"
β Amplitude response: π»(π) = 2 cos $"
β Phase response: β π» π = β$"
![Page 16: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/16.jpg)
The Simplest Highpass Filter
β Difference equation: π¦ π = π₯ π β π₯(π β 1)
β Signal flow graph
π§!"
π₯ π +
β1
π¦ π
![Page 17: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/17.jpg)
The Simplest Highpass Filter: Frequency Response
β Plot the amplitude and phase change over different frequencyβ The frequency sweeps from 0 to the Nyquist rate
![Page 18: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/18.jpg)
Finite Impulse Response (FIR) System
β Difference equationπ¦ π = π+ % π₯ π + π! % π₯ π β 1 + π" % π₯ π β 2 +β―+ π, % π₯ π β π
β Signal flow graph
π§!"
π₯ π +
π§!"
π§!"
...
π"
π#
π$
π%
π₯ π β 1
π₯ π β 2
π₯ π βπ
π¦ π
![Page 19: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/19.jpg)
Impulse Response
β The system output when the input is a unit impulseβ π₯ π = πΏ π = 1, 0, 0, 0, β¦ β π¦ π = β(π)= [π+, π!, π"β¦ , π,] (for FIR
system)
β Characterizes the digital system as a sequence of numbersβ A system is represented just like audio samples!
π₯ π = πΏ π π¦ π = β(π)β π
Input OutputLTISystem
![Page 20: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/20.jpg)
Examples: Impulse Response
β The simplest lowpass filterβ h π = 1, 1
β The simplest highpass filterβ h π = 1,β1
β Moving-average filter (order=5)
β h π = !-, !-, !-, !-, !-
![Page 21: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/21.jpg)
Convolution
β The output of LTI digital filters is represented by the convolution operation between π₯ π and β π
β Examplesβ The simplest lowpass filter β π¦ π = 1, 1 β π₯ π = 1 % π₯(π) + 1 % π₯(π β 1) = π₯ π + π₯(π β 1)
π¦ π = π₯ π β β π = :'(!)
)
π₯ π + β π β π = :'(!)
)
β(π) + π₯(π β π)
This is more practical expression when the input is an audio streaming
![Page 22: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/22.jpg)
Proof: Convolution
β Method 1β The input is represented as the sum of weighted and delayed impulses units
β π₯ π = π₯$, π₯", π₯#β¦ , π₯% = π₯$ + πΏ π + π₯" + πΏ π β 1 + π₯# + πΏ π β 2 +β―+ π₯% +πΏ π β π
β By the linearity and time-invariance β π¦ π = π₯$ + β π + π₯" + β π β 1 + π₯# + β π β 2 +β―+ π₯% + β π β π =
β'($% π₯(π) + β(π β π)
![Page 23: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/23.jpg)
Proof: Convolution
β Method 2β The impulse response can be represented as a set of weighted impulses
β β π = π$, π", π#β¦ , π% = π$ + πΏ π + π" + πΏ π β 1 + π# + πΏ π β 2 +β―+ π% +πΏ π β π
β By the linearity, the distributive property and π₯ π β πΏ π β π = π₯(π β π)β π¦ π = π$ + π₯ π + π" + π₯ π β 1 + π# + π₯ π β 2 +β―+ π% + π₯ π β π =
β'($% β(π) + π₯(π β π)
![Page 24: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/24.jpg)
Properties of Convolution
β Commutative: π₯ π β β" π β β# π = π₯ π β β# π β β" π
β Associative: (π₯ π β β" π ) β β# π = π₯ π β (β" π β β# π )
β Distributive: π₯ π β β" π + β# π = π₯ π β β" π + π₯ π β β# π
![Page 25: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/25.jpg)
Example: Convolution
β Given π₯ π = π₯$, π₯", π₯#, β¦ , π₯% and β π = β$, β", β#β π¦ π = β./+, β(π) % π₯(π β π)β π¦ 0 = β(0) 0 π₯(0)β π¦ 1 = β 0 0 π₯ 1 + β(1) 0 π₯(0)β π¦ 2 = β 0 0 π₯ 2 + β 1 0 π₯ 1 + β 2 0 π₯ 0β π¦ 3 = β 0 0 π₯ 3 + β 1 0 π₯ 2 + β 2 0 π₯ 1β π¦ 4 = β 0 0 π₯ 4 + β 1 0 π₯ 3 + β 2 0 π₯ 2β π¦ 5 = β 0 0 π₯ 5 + β 1 0 π₯ 4 + β 2 0 π₯ 3β π¦ 6 = β 1 0 π₯ 5 + β 2 0 π₯ 4β π¦ 7 = β 2 0 π₯ 5
β The size of transient region is equal to the number of delay operators
β If the length of π₯ π is π and the length of β π is π, then the length of π¦ π is π +π β 1.
Transient state
Steady state
Transient state
![Page 26: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/26.jpg)
Demo: Convolution
![Page 27: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/27.jpg)
Example: Convolution Reverb
β Convolution Reverb
Room Impulse Response
Lobby
Church
![Page 28: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/28.jpg)
A Simple Feedback Lowpass Filter
β Difference equation: π¦ π = π₯ π + π 3 π¦(π β 1)
β Signal flow graphβ When π is slightly less than 1, it is called βLeaky Integratorβ
π§!"
π₯ π π¦ π+
π
![Page 29: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/29.jpg)
A Simple Feedback Lowpass Filter: Impulse Response
β Impulse response: exponential decaysβ π¦ 0 = π₯ 0 = 1β π¦ 1 = π₯ 1 + π % π¦ 0 = πβ π¦ 2 = π₯ 2 + π % π¦ 1 = π"
β π¦ 3 = π₯ 3 + π % π¦ 2 = π"
β β¦
β Stability Issue! β If π < 1, the filter output converges (stable)β If π = 1, the filter output oscillates (critical)β If π > 1, the filter output diverges (unstable)
β(π)=[1, π, π#, π*, β¦ ]
![Page 30: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/30.jpg)
A Simple Feedback Lowpass Filter: Sine-Wave Analysis
β Measure the amplitude and phase changes given a sinusoidal signal input
π = 0.9
Transient state Steady state Transient state
![Page 31: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/31.jpg)
A Simple Feedback Lowpass Filter: Frequency Response
β More dramatic change than the simplest lowpass filter (FIR)β Phase response is not linear
π¦ π = π₯ π + 0.9 0 π¦(π β 1)
![Page 32: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/32.jpg)
A Simple Feedback Lowpass Filter: Frequency Response
β Mathematical approachβ Use complex sinusoid as input: π₯ π = π#$)
β π¦ π = πΊ π π#($)01 $ ) Γ π¦ π β π = π*#$2π¦ π for any πβ The output is: π¦ π = π₯ π + π % π¦(π β 1)
π¦ π = π₯ π + π % π#$π¦ π
β Frequency response: π» π = !!*345#$!
= !!*34678 $ 034#489: $
β Amplitude response: π»(π) = !(!*34678 $ )"0(3489: $ )"
β Phase response: β π» π = βatan( 3489: $!*3 4678 $
)
β Note that the this approach is getting complicated
![Page 33: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/33.jpg)
Reson Filter
β Difference equationβ π¦ π = π₯ π + 2π % cos(π) % π¦ π β 1 β π" % π¦ π β 2
β Signal flow graph
π§!"
π₯ π π¦ π+
2π 0 cosπ+
π§!"βπ#
+
![Page 34: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/34.jpg)
Reson Filter
β Mathematical approachβ Use complex sinusoid as input: π₯ π = π#$)
β π¦ π = πΊ π π#($)01 $ ) Γ π¦ π β π = π*#2$π¦ π for any πβ The output is: π¦ π = π₯ π + 2π % cos(π) % π¦ π β 1 β π" % π¦ π β 2
π¦ π = π₯ π + 2π % cos(π) % π#$π¦ π β π" % π#"$π¦ π β 2β Frequency response
β π» π = !!*";4678(1)45$!0;"45$"!
= !(!*;(678 1 0#489: 1 )5$!)(!*;(678 1 *#489: 1 )5$!)
β Now you see that the this approach is getting even more complicated β We will introduce more intuitive method to obtain the frequency response
![Page 35: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/35.jpg)
Reson Filter: Frequency Response
β Generate resonance at a particular frequency β Control the peak height by π and the peak frequency by π
For stability: π < 1
π < 1 is getting close to 1
π controls the location of the peak
![Page 36: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/36.jpg)
Infinite Impulse Response (IIR) Filters
β Difference equationβ π¦ π = π+ % π₯ π β π! % π¦ π β 1 β π" % π¦ π β 2 ββ―β π< % π¦ π β π
β Signal flow graphπ₯ π +
π%π§!"
π¦ π
π§!"
π§!"
...
-π"
-π#
-π&
π¦ π β 1
π¦ π β 2
π¦ π β π
![Page 37: Fundamentals of DSP -Part 1 - KAIST](https://reader036.vdocuments.site/reader036/viewer/2022071613/61570a03a097e25c76506e4e/html5/thumbnails/37.jpg)
General Form of LTI Filters
β Difference equationβ π¦ π = π+ % π₯ π + π! % π₯ π β 1 + π" % π₯ π β 2 + β¦+ π, % π₯ π β π
βπ! % π¦ π β 1 β π" % π¦ π β 2 ββ―β π< % π¦ π β π
β Signal flow graph
π§!"
π₯ π +
π§!"
π§!"
...
π"
π#
π$
π%
π₯ π β 1
π₯ π β 2
π₯ π βπ
π§!"
π¦ π
π§!"
π§!"
...
-π"
-π#
-π&
π¦ π β 1
π¦ π β 2
π¦ π β π