ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

25
ECE 598: The Speech ECE 598: The Speech Chain Chain Lecture 5: Room Lecture 5: Room Acoustics; Filters Acoustics; Filters

Transcript of ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Page 1: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

ECE 598: The Speech ECE 598: The Speech ChainChain

Lecture 5: Room Acoustics; Lecture 5: Room Acoustics; FiltersFilters

Page 2: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

TodayToday Room = A Source of EchoesRoom = A Source of Echoes Echo = Delayed, Scaled CopyEcho = Delayed, Scaled Copy Addition and Subtraction of Scaled Addition and Subtraction of Scaled

CosinesCosines Frequency ResponseFrequency Response Impulse ResponseImpulse Response Filter = A System with EchoesFilter = A System with Echoes

Page 3: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Room Acoustics Sample Room Acoustics Sample Application: The Beckman Cube Application: The Beckman Cube

Virtual Reality TheaterVirtual Reality Theater

Page 4: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Room Acoustics Test Room Acoustics Test Laboratory: the Plywood CubeLaboratory: the Plywood Cube

Page 5: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Measuring the Frequency Measuring the Frequency Response of a Room: 2X2 Response of a Room: 2X2

LocationsLocations

Page 6: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Direct SoundDirect Sound

Page 7: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Direct Sound: Mathematical Direct Sound: Mathematical NotationNotationx(t) = (rx(t) = (rss/r/r00) s(t) s(t00))

x(t) = Recorded sound pressure (Pascals)x(t) = Recorded sound pressure (Pascals) s(t) = Sound at the source (Pascals)s(t) = Sound at the source (Pascals) rrss = radius of the source (lips, loudspeaker, = radius of the source (lips, loudspeaker,

…)…) rr00 = distance from source to microphone = distance from source to microphone 00=r=r00/c = time it takes for sound to travel from /c = time it takes for sound to travel from

source to microphone source to microphone s(t) = s(t) = ss e ejjtt

x(t) = x(t) = xx e ejjtt xx = = s s (r(rss/r/r00) e) ejj00

Page 8: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Direct Sound + First EchoDirect Sound + First Echo

Page 9: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Direct Sound + First EchoDirect Sound + First Echo

x(t) = ax(t) = a00 s(t s(t00) + a) + a11 s(t s(t11)) 11=r=r11/c = time it takes for the first echo to travel /c = time it takes for the first echo to travel

from source to microphonefrom source to microphone aa00 = r = rss/r/r0 0 (the “1/r scaling” of the direct sound) (the “1/r scaling” of the direct sound) aa11 = = r rss/r/r11

= amount by which echo amplitude is reduced = amount by which echo amplitude is reduced when it bounces off the wall = “reflection coefficient”when it bounces off the wall = “reflection coefficient”

depends on the material: depends on the material: ≈1 for hardwood, ≈1 for hardwood, ≈0.1 for carpet≈0.1 for carpet

s(t) = s(t) = ss e ejjtt

x(t) = x(t) = xx e ejjtt

xx = = ss ( a ( a00eejj00 + a + a11eejj11 ))

Page 10: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Direct Sound + Lots of Direct Sound + Lots of EchoesEchoes

Page 11: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

The Image Source Method for The Image Source Method for Simulating the Room ResponseSimulating the Room Response

(Berkeley and Allen, 1979)(Berkeley and Allen, 1979)

Key Observation:

An echo arrives at the microphone from the same direction, having traveled exactly the same distance, as if it had come from an “image source” located behind the wall.

The location of the “image source” is the “mirror image” of the location of the true source, after reflection through the wall.

Page 12: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Image Source Method: Lots of Image Source Method: Lots of EchoesEchoes

An echo that bounces off multiple walls behaves as if it had come from several rooms away.

Page 13: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Direct Sound + Lots of Direct Sound + Lots of EchoesEchoes

x(t) = x(t) = aann s(t s(tnn) )

aa00s(t-s(t-00) = direct sound ) = direct sound aanns(t-s(t-nn) = n) = nthth echo echo

s(t) = s(t) = ss e ejjtt

x(t) = x(t) = xx e ejjtt

xx = H( = H() ) ss HH is called the “frequency is called the “frequency

response” of the room, at frequency response” of the room, at frequency ::H(H() = ) = aann e ejjnn

n=0

n=0

Page 14: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Example: Starter PistolExample: Starter Pistol• Direct sound: an “impulse” (a very short, very loud sound: s(t)=(t))• An impulse has energy at all frequencies; we say s()=1 regardless of

Impulse response: a series of delayed, scaled impulse echoes, x(t) = an (t-n)

Frequency response: the frequency “coloration” you hear is the frequency response of the room:x() = H() s() = H() = an ejn

Page 15: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Example: Sweep ToneExample: Sweep Tone• Direct sound is a cosine, s(t) = ejt, with changing slowly• Recorded sound is a scaled, phase-shifted cosine, x(t) = H() ejt

• H() of the room (the subject of today’s lecture)

• Spectrum of the background noise

• Signal to noise ratio, as a function of frequency

Page 16: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Today’s Important Math Fact: Today’s Important Math Fact: Cosine + Cosine Echo = Cosine + Cosine Echo = Scaled, Shifted CosineScaled, Shifted Cosine

Page 17: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Cosine + Cosine Echo: Cosine + Cosine Echo: Phasor NotationPhasor Notation

x(t) = ax(t) = a0 0 eejj(t(t00)) + a + a1 1 eejj(t(t11) )

= e= ejjtt (a (a0 0 eejj00 + a + a1 1 eejj11))

= e= ejjtt (a (a0 0 eejj00 + a + a1 1 eejj11))

00 = Phase shift caused by traveling = Phase shift caused by traveling from source to microphone, direct from source to microphone, direct sound (in radians)sound (in radians)

11 = Phase shift, first echo (radians) = Phase shift, first echo (radians)

Page 18: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Cosine + Cosine Echo: Cosine + Cosine Echo: Phasor NotationPhasor NotationH(H() = a) = a0 0 eejj00 + a + a1 1 eejj11

= {a= {a00cos(cos(00)+a)+a11cos(cos(11)} )} j{aj{a00sin(sin(00)+a)+a11sin(sin(11)} ))} )

= a= axxcos(cos(xx) ) jajaxxsin(sin(xx))

So H(So H() = a) = axxeejjxx for some a for some axx and and xx

Page 19: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

If s(t) is a cosine, then x(t) is a If s(t) is a cosine, then x(t) is a scaled shifted cosinescaled shifted cosine

x(t) = H(w) s(t)x(t) = H(w) s(t)

= a= ax x eejjxx eejjtt

= a= ax x eej(j(ttxx))

Re{x(t)} = aRe{x(t)} = ax x cos(cos(ttxx) )

If s(t)=cos(If s(t)=cos(t), then x(t) is a scaled, shifted t), then x(t) is a scaled, shifted cosine at the same frequency!cosine at the same frequency!

The scaling factor aThe scaling factor axx and the phase shift and the phase shift xx depend on frequency in some way (remember depend on frequency in some way (remember that that 00==00 and and 11==11))

Next question: how can we calculate aNext question: how can we calculate axx and and xx??

Page 20: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

ONAMI (Oh No! Another Math Idea!)*: ONAMI (Oh No! Another Math Idea!)*: Magnitude and Phase of a Complex Magnitude and Phase of a Complex

NumberNumberSuppose z=zSuppose z=zRR+jz+jzII

zzRR = Re{z} = Re{z}

zzII=Im{z}=Im{z}

We can also write z=AeWe can also write z=Aejj = Acos = Acos+jAsin+jAsinA = |z| (“magnitude of z”)A = |z| (“magnitude of z”)

= arg(z) (“phase of z”)= arg(z) (“phase of z”)

Obviously, zObviously, zRR=Acos=Acos; z; zII=Asin=Asin* “oonami” (“oo”=long /o/) means “big wave” in Japanese. Curiously * “oonami” (“oo”=long /o/) means “big wave” in Japanese. Curiously

enough, “onami” (short /o/) means “little wave.” Meaningless but enough, “onami” (short /o/) means “little wave.” Meaningless but entertaining question for the reader: is the magnitude and phase of entertaining question for the reader: is the magnitude and phase of

complex numbers a big wave, or a little wave?complex numbers a big wave, or a little wave?

Page 21: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Finding the Magnitude and PhaseFinding the Magnitude and Phase

Finding the magnitude: AFinding the magnitude: A22=z=zRR22+z+zII

22

Proof: zProof: zRR22+z+zII

22=A=A22coscos22+A+A22sinsin22= A= A22(cos(cos22+sin+sin22) = A) = A22

Finding the phase if zFinding the phase if zR R > 0: > 0: =tan=tan-1-1(z(zII/z/zRR))

Proof: zProof: zII/z/zRR=sin=sin/cos/cos=tan=tan

Finding the phase if zFinding the phase if zR R < 0: < 0: =tan=tan-1-1(z(zII/z/zRR) ) The Problem: The Problem: = tan= tan-1-1(z(zII/z/zRR) is always between –) is always between –/2 and /2 and /2/2

so cos(so cos() is always positive!) is always positive!

The Solution: assume, instead, that The Solution: assume, instead, that = tan= tan-1-1((zzII//zzRR) )

so Aeso Aejj= Acos= Acos+Asin+Asin= = zzRRjzjzI I = = z = z = eejj= Ae= Aejjeejj= Ae= Aej(j())

Page 22: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Imagining the Magnitude and Phase of Imagining the Magnitude and Phase of a Complex Number: Four Examplesa Complex Number: Four Examples

RealPart

ImaginaryPart

zR

zIz=zR+jzI

A RealPart

ImaginaryPart

zR

zI

A

RealPart

ImaginaryPart

zR

zI

A

RealPart

ImaginaryPart

zR

zI

A

zI

zR

zI

zR

Page 23: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Magnitude and Phase of A Magnitude and Phase of A Frequency ResponseFrequency ResponseH(H() = ) = aann e ejjnn = H = HRR+jH+jHI I = A= A eejj

AA22 = H = HRR22+H+HII

22

= tan= tan-1-1(H(HII/H/HRR), possibly ), possibly ±± Here’s what it means:Here’s what it means:

If: If: s(t) = es(t) = ejjtt ; Re{s(t)} = cos( ; Re{s(t)} = cos(t)t)

Then: Then: x(t) = H(x(t) = H() e) ejjtt ; Re{x(t)} = A cos( ; Re{x(t)} = A cos(t+t+))

n=0

Page 24: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

FiltersFilters A “filter” is any system that adds its input to scaled, A “filter” is any system that adds its input to scaled,

shifted copies of itselfshifted copies of itself x(t) = x(t) = aann s(t s(tnn) )

In order to find x(t), we need two pieces of In order to find x(t), we need two pieces of information:information: The input, s(t)The input, s(t) The sequence of echo times, The sequence of echo times, nn, and echo amplitudes, a, and echo amplitudes, ann. .

This whole sequence of information is often summarized by This whole sequence of information is often summarized by the “impulse response” of the system, h(t) = the “impulse response” of the system, h(t) = aann (t(tnn). ). Remember that Remember that (t) is a very short, very loud sound, like a (t) is a very short, very loud sound, like a gunshot. h(t) is the output of the system if the input is gunshot. h(t) is the output of the system if the input is (t)(t)

Given s(t) and h(t), we find x(t) using “convolution:”Given s(t) and h(t), we find x(t) using “convolution:” x(t) = s(t)x(t) = s(t)h(t) = h(t) = aann s(t s(tnn)) In matlab, In matlab,

s=wavread(‘speechsound.wav’);s=wavread(‘speechsound.wav’); h=wavread(‘impulseresponse.wav’);h=wavread(‘impulseresponse.wav’); x=conv(s,h); or x=filter(h,1,s);x=conv(s,h); or x=filter(h,1,s);

n=0

n=0

n=0

Page 25: ECE 598: The Speech Chain Lecture 5: Room Acoustics; Filters.

Summary: FiltersSummary: Filters A “filter” is any system that adds the A “filter” is any system that adds the

direct sound together with any number of direct sound together with any number of echoes. There are two methods for echoes. There are two methods for simulating a filter in software:simulating a filter in software:

Impulse response: Impulse response: Given h(t) = Given h(t) = aann (t(tnn), compute), compute

x(t) = s(t)x(t) = s(t)h(t) = h(t) = aann s(t s(tnn))

Frequency response: Frequency response: Break down s(t) into a sum of cosines, s(t)=Break down s(t) into a sum of cosines, s(t)=s s

eejjtt

Then, for each cosine, computeThen, for each cosine, compute

x(t) = H(x(t) = H() s(t) = H() s(t) = H() ) ss e ejjtt

n=0

n=0