ECE 598: The Speech Chain

advertisement
ECE 598: The Speech Chain
Lecture 5: Room Acoustics; Filters
Today






Room = A Source of Echoes
Echo = Delayed, Scaled Copy
Addition and Subtraction of Scaled Cosines
Frequency Response
Impulse Response
Filter = A System with Echoes
Room Acoustics Sample Application:
The Beckman Cube
Virtual Reality Theater
Room Acoustics Test Laboratory:
the Plywood Cube
Measuring the Frequency Response
of a Room: 2X2 Locations
Direct Sound
Direct Sound: Mathematical
Notation
x(t) = (rs/r0) s(t-t0)





x(t) = Recorded sound pressure (Pascals)
s(t) = Sound at the source (Pascals)
rs = radius of the source (lips, loudspeaker, …)
r0 = distance from source to microphone
t0=r0/c = time it takes for sound to travel from
source to microphone
s(t) = s ejwt
x(t) = x ejwt
x = s (rs/r0) e-jwt
0
Direct Sound + First Echo
Direct Sound + First Echo
x(t) = a0 s(t-t0) + a1 s(t-t1)



t1=r1/c = time it takes for the first echo to travel
from source to microphone
a0 = rs/r0 (the “1/r scaling” of the direct sound)
a1 = g(w) rs/r1


g(w) = amount by which echo amplitude is reduced
when it bounces off the wall = “reflection coefficient”
g(w) depends on the material: g≈1 for hardwood,
g≈0.1 for carpet
s(t) = s ejwt
x(t) = x ejwt
x = s ( a0e-jwt + a1e-jwt )
0
1
Direct Sound + Lots of Echoes
The Image Source Method for
Simulating the Room Response
(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.
Image Source Method: Lots of
Echoes
An echo that
bounces off
multiple walls
behaves as if
it had come
from several
rooms away.
Direct Sound + Lots of Echoes
∞
x(t) =  an s(t-tn)
n=0


a0s(t-t0) = direct sound
ans(t-tn) = nth echo
s(t) = s ejwt
x(t) = x ejwt
x = H(w) s

H(w) is called the “frequency response” of
the room, at frequency w:
∞
H(w) =  an e-jwt
n=0
n
Example: Starter Pistol
• Direct sound: an “impulse” (a very short, very loud sound: s(t)=d(t))
• An impulse has energy at all frequencies; we say s(w)=1 regardless of w
Impulse response:
a series of delayed,
scaled impulse echoes,
x(t) =  an d(t-tn)
Frequency response: the
frequency “coloration”
you hear is the frequency
response of the room:
x(w) = H(w) s(w)
= H(w)
=  an e-jwtn
Example: Sweep Tone
• Direct sound is a cosine, s(t) = ejwt, with w changing slowly
• Recorded sound is a scaled, phase-shifted cosine, x(t) = H(w) ejwt
• H(w) of the room (the
subject of today’s lecture)
• Spectrum of the
background noise
• Signal to noise ratio, as
a function of frequency
Today’s Important Math Fact:
Cosine + Cosine Echo =
Scaled, Shifted Cosine
Cosine + Cosine Echo:
Phasor Notation
x(t) = a0 ejw(t-t ) + a1 ejw(t-t )
= ejwt (a0 e-jwt + a1 e-jwt )
= ejwt (a0 e-jf + a1 e-jf )
0
1
0
0


1
1
f0 = Phase shift caused by traveling from
source to microphone, direct sound (in
radians)
f1 = Phase shift, first echo (radians)
Cosine + Cosine Echo:
Phasor Notation
H(w) = a0 e-jf + a1 e-jf
= {a0cos(f0)+a1cos(f1)} j{a0sin(f0)+a1sin(f1)} )
0
1
= axcos(fx) - jaxsin(fx)

So H(w) = axe-jf for some ax and fx
x
If s(t) is a cosine, then x(t) is a
scaled shifted cosine
x(t) = H(w) s(t)
= ax e-jf ejwt
= ax ej(wt-f )
Re{x(t)} = ax cos(wt-fx)
x
x



If s(t)=cos(wt), then x(t) is a scaled, shifted
cosine at the same frequency!
The scaling factor ax and the phase shift fx
depend on frequency in some way (remember
that f0=wt0 and f1=wt1)
Next question: how can we calculate ax and fx?
ONAMI (Oh No! Another Math Idea!)*:
Magnitude and Phase of a Complex Number
Suppose z=zR+jzI
zR = Re{z}
zI=Im{z}
We can also write z=Aejf = Acosf+jAsinf
A = |z| (“magnitude of z”)
f = arg(z) (“phase of z”)
Obviously, zR=Acosf; zI=Asinf
* “oonami” (“oo”=long /o/) means “big wave” in Japanese. Curiously enough, “onami”
(short /o/) means “little wave.” Meaningless but entertaining question for the reader:
is the magnitude and phase of complex numbers a big wave, or a little wave?
Finding the Magnitude and Phase



Finding the magnitude: A2=zR2+zI2
Proof: zR2+zI2=A2cos2f+A2sin2f
= A2(cos2f+sin2f) = A2
Finding the phase if zR > 0: f=tan-1(zI/zR)
Proof: zI/zR=sinf/cosf=tanf
Finding the phase if zR < 0: f=tan-1(zI/zR) -p
The Problem: q = tan-1(zI/zR) is always between –p/2 and p/2
so cos(q) is always positive!
The Solution: assume, instead, that q = tan-1(-zI/-zR)
so Aejq = Acosq+Asinq = -zR-jzI = -z = -Aejf = Aejpejf = Aej(f+p)
Imagining the Magnitude and Phase of a
Complex Number: Four Examples
Imaginary
Part
zI
A
Imaginary
Part
z=zR+jzI
f
zR
zR
Real
Part
f
zI
Imaginary
Part
zR
A
-zR
f = q-p
zI
A
Imaginary
Part
zI
-zI
q
Real
Part
Real
Part
f = q+p
-zR
A
zR
q
-zI
Real
Part
Magnitude and Phase of A
Frequency Response
∞
H(w) =  an e-jwt = HR+jHI = A ejf
n
n=0



A2 = HR2+HI2
f = tan-1(HI/HR), possibly ±p
Here’s what it means:

If:


s(t) = ejwt ; Re{s(t)} = cos(wt)
Then:

x(t) = H(w) ejwt ; Re{x(t)} = A cos(wt+f)
Filters

A “filter” is any system that adds its input to scaled,
shifted copies of itself


n=0
In order to find x(t), we need two pieces of information:



∞
x(t) =  an s(t-tn)
The input, s(t)
The sequence of echo times, tn, and echo amplitudes, an. This
whole sequence of information is often summarized
by the
∞
“impulse response” of the system, h(t) =  an d(t-tn).
n=0
Remember that d(t) is a very short, very loud sound, like a
gunshot. h(t) is the output of the system if the input is d(t)
Given s(t) and h(t), we find x(t) using “convolution:”


∞
x(t) = s(t)*h(t) =  an s(t-tn)
n=0
In matlab,



s=wavread(‘speechsound.wav’);
h=wavread(‘impulseresponse.wav’);
x=conv(s,h); or x=filter(h,1,s);
Summary: Filters


A “filter” is any system that adds the direct
sound together with any number of echoes.
There are two methods for simulating a filter in
software:
Impulse response:
∞


Given h(t) =  an d(t-tn), compute
n=0
∞
x(t) = s(t)*h(t) =  an s(t-tn)
Frequency response:


n=0
Break down s(t) into a sum of cosines, s(t)=s ejwt
Then, for each cosine, compute
x(t) = H(w) s(t) = H(w) s ejwt
Download