Top Banner
Copyright 2004 Ken Copyright 2004 Ken Greenebaum Greenebaum Introduction to Introduction to Interactive Sound Interactive Sound Synthesis Synthesis Lecture 20:Spectral Filtering Lecture 20:Spectral Filtering Ken Greenebaum Ken Greenebaum
36

Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Dec 13, 2015

Download

Documents

Ella Jefferson
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Introduction to Interactive Introduction to Interactive Sound SynthesisSound Synthesis Lecture 20:Spectral FilteringLecture 20:Spectral Filtering

Ken GreenebaumKen Greenebaum

Page 2: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Final ExamFinal Exam

Designing the exam to take 1 hourDesigning the exam to take 1 hour

Page 3: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Optional ReadingsOptional Readings

Audio AnecdotesAudio Anecdotes Chapter 3: RecordingChapter 3: Recording

Might help record voice and musicMight help record voice and music (great articles in volume 2 too)(great articles in volume 2 too)

Pg 237: Rate conversionPg 237: Rate conversion High quality rate conversionHigh quality rate conversion

Pg 339: Octave and GNUPlotPg 339: Octave and GNUPlot

Page 4: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Assignment 7 Wind SynthAssignment 7 Wind Synth

Anybody start?Anybody start?

Questions?Questions?

Page 5: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Spectral FilteringSpectral Filtering

Change frequency content of a signalChange frequency content of a signal Can attenuate or amplify frequenciesCan attenuate or amplify frequencies Add group delayAdd group delay

Phase of frequencies may shift by different Phase of frequencies may shift by different amountsamounts

Page 6: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Spectral FilteringSpectral Filtering

Types of filters?Types of filters?

How to describe a filter?How to describe a filter?

Page 7: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Spectral FilteringSpectral Filtering

Basic Types:Basic Types: High PassHigh Pass Low PassLow Pass Band PassBand Pass

Elements:Elements: Pass BandPass Band Stop BandStop Band

Page 8: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Low Pass FilterLow Pass Filter

Ideal Low Pass Filter:Ideal Low Pass Filter:

Page 9: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Low Pass FilterLow Pass Filter

Why do we call this an ideal filter Why do we call this an ideal filter response?response?

How might an actual filter differ?How might an actual filter differ?

Page 10: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Low Pass FilterLow Pass Filter

Actual Low Pass Filter Actual Low Pass Filter Characteristics:Characteristics:

Page 11: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Low Pass FilterLow Pass Filter

First-order filter:First-order filter: Rate of cut off in the stop band:Rate of cut off in the stop band:

Reduces signal strength by half Reduces signal strength by half Every time the frequency doublesEvery time the frequency doubles Above the cutoff frequencyAbove the cutoff frequency

22ndnd order filter: order filter: Rate of cut off in the stop band:Rate of cut off in the stop band:

Reduces signal strength by ¾ for each octaveReduces signal strength by ¾ for each octave

Page 12: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Filter IssuesFilter Issues

Always will be ripple in pass bandAlways will be ripple in pass band Brick-wall filter impossibleBrick-wall filter impossible

Sharpness of transition between pass Sharpness of transition between pass band and stop band controlled by filter band and stop band controlled by filter orderorder

Page 13: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Spectral FilteringSpectral Filtering

Can be accomplished in:Can be accomplished in: Analog or Digital domainsAnalog or Digital domains

Page 14: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Analog FilterAnalog Filter

Simple Low pass analog filter:Simple Low pass analog filter:

Page 15: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Analog FilterAnalog Filter

Issues:Issues: Requires close toleranceRequires close tolerance

Wire wound resistorsWire wound resistors Quality capacitorsQuality capacitors High Quality inductorsHigh Quality inductors

Resistor, Capacitor values drift with:Resistor, Capacitor values drift with: Age, temperatureAge, temperature

Difficult to modelDifficult to model SPICESPICE

Page 16: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Digital FilterDigital Filter

Two classic digital filter Two classic digital filter implementations:implementations: FIR: Finite Impulse ResponseFIR: Finite Impulse Response IIR: Infinite Impulse ResponseIIR: Infinite Impulse Response

Page 17: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Use of delayUse of delay

All digital filters use delayAll digital filters use delay Order of a filterOrder of a filter

Corresponds to the longest delay usedCorresponds to the longest delay used

Page 18: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Finite Impulse Response Finite Impulse Response FilterFilter

Considers:Considers: Current sampleCurrent sample Past input samplesPast input samples

Does not employ feedbackDoes not employ feedback

Page 19: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Mathematical ExampleMathematical Example

2 point moving average filter:2 point moving average filter: yynn=0.5 * (x=0.5 * (xnn + x + xn-1n-1))

Consider:Consider: Order of this filterOrder of this filter It’s impulse responseIt’s impulse response

Page 20: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

FIR Filter DiagramFIR Filter Diagram

Page 21: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

FIR FilterFIR Filter

AdvantagesAdvantages Easy to designEasy to design StableStable Easily have flat phase responseEasily have flat phase response

DisadvantagesDisadvantages Less efficient than IIR filterLess efficient than IIR filter

Page 22: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Infinite Impulse Response Infinite Impulse Response FilterFilter

AKA IIR FilterAKA IIR Filter Considers:Considers:

Current sampleCurrent sample Past input and output samplesPast input and output samples

Employs feedbackEmploys feedback

Page 23: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Mathematical ExampleMathematical Example

Simple recursive filter:Simple recursive filter: yynn==g xg xnn + + r yr yn-1n-1

Consider:Consider: Order of this filterOrder of this filter It’s impulse responseIt’s impulse response

Page 24: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

IIR Impulse ResponseIIR Impulse Response

For non-zero For non-zero rr Exponential decayExponential decay Output never reaches zeroOutput never reaches zero

For negative For negative rr Output will oscillateOutput will oscillate

For For rr > 1 > 1 Output will grow w/o boundOutput will grow w/o bound

Page 25: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

IIR Filter DiagramIIR Filter Diagram

Page 26: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

IIR FilterIIR Filter

AdvantagesAdvantages Low computational requirementsLow computational requirements Low memory requirementsLow memory requirements

DisadvantagesDisadvantages Can be unstableCan be unstable Requires precision calculationsRequires precision calculations

Page 27: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Z Transform RepresentationZ Transform Representation

Delay operator: Delay operator: Z Z -1-1

Corresponds to 1 sample of delayCorresponds to 1 sample of delay To transform a filter using Z To transform a filter using Z

transform:transform: Capitalize all Capitalize all x, y x, y variablesvariables Replace all time indices (Replace all time indices (nn – – aa) with ) with

appropriate appropriate Z Z ––aa

Page 28: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Z transform exampleZ transform example

FilterFilter yynn==g xg xnn + + r yr yn-1n-1

BecomesBecomes YY==g Xg X + + r Yr Y Z Z –1–1

Page 29: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

The Transfer Function: The Transfer Function: HH

Useful classification of digital filtersUseful classification of digital filters Solve for the ratio of output (Y) to Solve for the ratio of output (Y) to

input (X) in Z-transformed filterinput (X) in Z-transformed filter H H is the Z transform of the time is the Z transform of the time

domain impulse response function domain impulse response function h(n)h(n)

Page 30: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

A filter’s Zeros and PolesA filter’s Zeros and Poles

ZerosZeros The values of The values of Z Z –1 –1 that make the that make the

numerator of transfer fn zeronumerator of transfer fn zero PolesPoles

The values of The values of Z Z –1 –1 that make the that make the denominator of transfer fn zerodenominator of transfer fn zero

Page 31: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

ImplicationsImplications

Values on the complex planeValues on the complex plane ZerosZeros

Correspond to signal cancellationCorrespond to signal cancellation PolesPoles

Correspond to infinite gainCorrespond to infinite gain

Page 32: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

ExampleExample

Our simple moving average filter:Our simple moving average filter: yynn==gg * (x * (xnn + + aaxxn-1n-1)) Y/X = gY/X = g(1+ (1+ aZ aZ –1–1)) Zero: Zero:

Z Z = -= -aa Max gain: Max gain:

gg (1+| (1+|aa|)|)

Page 33: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

CoefficientsCoefficients

Changing value of Changing value of aa causes frequency causes frequency response of filter to shiftresponse of filter to shift Positive values of Positive values of aa

Cause filter to favor low freqsCause filter to favor low freqs Low pass filterLow pass filter

Negative values of Negative values of aa High pass filterHigh pass filter

Values of Values of a a near 1near 1 Yield fastest roll offYield fastest roll off Versus fractional valuesVersus fractional values

Page 34: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Filter design packagesFilter design packages

Used to set coefficients based on Used to set coefficients based on requirementsrequirements

Packages:Packages: MATLABMATLAB QEDesignQEDesign PtolemyPtolemy DSPlayDSPlay

Page 35: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

Next ClassNext Class

Physical ModelingPhysical Modeling

Page 36: Copyright 2004 Ken Greenebaum Introduction to Interactive Sound Synthesis Lecture 20:Spectral Filtering Ken Greenebaum.

Copyright 2004 Ken GreenebaumCopyright 2004 Ken Greenebaum

ReadingsReadings

Audio AnecdotesAudio Anecdotes Into to Physical ModelingInto to Physical Modeling

Audio File FormatsAudio File Formats For the finalFor the final Want everybody to understand the Want everybody to understand the

challenges of exchanging binary data challenges of exchanging binary data between different architecturesbetween different architectures