[DSP] W01 - Basics
- obligatory dead person quote:
- ”[…] space and time are mere thought entities and creatures of the imagination […] They precede the existence of objects of the senses […]”
- number sets:
- : natural numbers
- whole numbers
- : integers
- : rational numbers
- inclusive of recurring mantissa
- : irrational numbers
- non-repeating and non-recurring mantissa
- value,
- : real numbers (everything on the number line)
- includes rational and irrational numbers
- : complex numbers
- includes real and imaginary numbers
- : natural numbers
fig: number sets
digital signal processing
- signal: description of a physical phenomenon’s evolution over time
- signal processing:
- analysis: understanding the information carried by the signal
- synthesis: creating a signal to contain the information
- digital paradigm for signal processing:
- discrete, digitized time
- discrete, digitized amplitude
- a digital signal is a sequence of observations called samples
- a sample is denoted by
- each sample is subjected to both:
- time discretization: time component ‘’
- amplitude discretization: amplitude component ‘’
discrete-time
- discrete-time model:
- a paradigm that moves away from the idealistic analog view
- makes computation more intuitive
- finding solutions easier with computational methods
- more practical model of reality compared to analog models
- a paradigm that moves away from the idealistic analog view
- Sampling Theorem:
- mathematically, analog and discrete models are equivalent
- provided sufficient discrete sampling is available
- mathematically, analog and discrete models are equivalent
- samples replace idealized models
- simple math replaces calculus
discrete-amplitude
- each amplitude can only take on a value from a predetermined set
- the number of levels in countable
- so the amplitude is mapped to a set of integers
- this ability to integer mapping provides benefits for
- storage
- processing
- transmission
- analog signals suffer from noise and attenuation in way that causes loss of information during signal transmission
- digital signal transmission mechanisms are more robust
- information is significantly low
- general-purpose storage can be used
- general-purpose processing can be applied
- noise can be controlled during signal transmission
discrete-time signals
- ‘lollipop’ notation
- discrete-time signals sampled sufficiently densely look continuous in a plot
formally
- a sequence of complex numbers
- one dimensional
- notation:
- : integer
- two-sided sequences:
- is adimensional “time”
- no physical units, just a counter
- can embody periodicity
- number of samples of the repeating pattern
- analysis eg.: periodic temperature, sea-level, river water level
- synthesis eg.: stream of algorithm generated samples
fundamental discrete signals
- delta signal:
- when ; else
- signifies a physical phenomenon that lasts a very short duration of time
- eg. a clapper for syncing video and audio for a movie recording
- when audio and video recording happens separately
fig: discrete delta
- unit step:
- when ; else
- synonymous to flipping a switch
fig: discrete unit step
- exponential decay:
- when ; else decays exponentially, starting from @
- as
- newton’s law of cooling
- cooling of a coffee cup
- rate of capacitor discharge
fig: discrete exponential decay
- sinusoid:
- : angular frequency
- : initial phase
fig: discrete sinusoid
signal classes
- finite-length
- infinite length
- periodic
- finite-support
finite-length signals
- can only have samples
- : range of signal
- is limited in finite-length signals
- notations:
- sequence:
- vector:
- practical entities
- good for numerical packages
infinite-length signals
- can have infinite number of samples
- it is an abstraction
- useful for theorems that do not depend on the length of the data
periodic signals
- repetitive samples with a constant frequency
- notation:
- -periodic signals:
- data repeats every samples
- same information as finite-length of length
- natural bridge between finite and infinite lengths
finite-support signals
- infinite length sequence
- but only a finite number of non-zero sample
- notation:
- if
- same information as finite-length
- another bridge between finite and infinite length lengths
elementary signal operations
- scaling:
- sum:
- product:
- delay (shift):
- output of operation is shifted by samples
- care must be taken to append and prepend zeros to accommodate the shift
- two types of delay:
- finite-length is turned into finite-support
- by adding zeros until and
- then shift is applied
- make the finite-signal periodic:
- samples circle around in the given range of
- finite-length is turned into finite-support
- energy:
- sum of the squares of all amplitudes of the signal
- consistent with physical energy
- many signals have infinite energy i.e. periodic signals
- so not a great way to describe the energetic property of a signal
- power:
- a signal cannot have infinite power even if it’s energy is infinite
- power is the rate of production of energy for a sequence
- it is limit of the ratio of local energy in a window to the size of the window as N goes to infinity
- for a periodic signal, the power is the ratio fo energy in one period to the length of the period
simple dsp applications
digital vs. physical frequency
- discrete time:
- : just a counter, no time dimension
- periodicity: number of samples of one cycle of the pattern
- physical time:
- frequency:
- periodicity: number of seconds of one cycle of the pattern
dsp lab: laptop/desktop
- a desktop computer is a signal processing lab for all practical purposes
- signals can be generated
- visualed as plots
- can be used to generate sounds
- an analog-digital interface is needed for this
- a sound card is an interface that converts digital signals to analog
- has a system clock of period seconds
- discrete samples at intervals are sampled and converted to analog electrical signals
- a periodicity of samples in digital domain
- becomes seconds in the physical domain
- frequency in physical domain
- sampling rate for sound card:
- usually ; so
- so, for
- and
- dsp involves a few fundamental building blocks
- adder block:
- fig: adder block
- scaler block:
- fig: scaler block
- delay block:
-
- means unit buffer
- holds current value and send previously held value fig: unit delay (buffer) block
-
- means samples buffer fig: N delay (buffer) block
-
- adder block:
- these blocks can be combined in any way to build arbitrarily complex circuitry for analysis or synthesis
- an abstract implementation of dsp algorithm is first made
- with the building blocks in a flow chart
- can then be coded and executed in any language
- example: moving average:
- local average of a few samples
- 2-sample moving average:
- fig: two-point moving average block
- M sample moving average is an ubiquitous tool to smooth discrete signals
- an abstract implementation of dsp algorithm is first made
- feedback loop:
- unit delay feedback loop
- fig: feedback loop with delay
- introduces recursion in the algorithm: chicken-and-egg problem
- to solve the particular problem feedback loop is applied to
- set a start time
- assert zero initial conditions for input and output for all time before
- feedback loop for interest accumulation in a bank account:
- assume interest rate 10% p.a.
- interest accrual date: Dec 31
- deposit/withdrawals in year :
- so balance (with accrued interest) at year-end is:
- M-delay feedback loop:
- fig: M-samples delay feedback loop
- equivalent to cascading unit delays in feedback branch
- unit delay feedback loop
- Karplus-Strong Algorithm:
- to synthesize plucked-string sound
- algorithm: build a recursion loop with a delay
- the number of samples controls the pitch of the output sound
- input: finite support signal
- non-zero only for
- this controls the timbre of the output
- parameters to configure (knobs of the algorithm):
- decay factor:
- : no decay (100% feedback)
- : extreme decay (0% feedback)
- controls how sustained the sound is
- decay factor:
- run the algorithm on the input to generate output
- a random valued finite-support signal input was found to give best results
- Refactoring DSP operations:
- DSP operations can get complex very quickly
- refactoring them is an art that heavily aids building simple block diagrams
- the simplified expressions are used for efficiency in analysis and synthesis