17
Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

Embed Size (px)

Citation preview

Page 1: Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

Echo Generationand

Simulated Reverberation

R.C. Maher

ECEN4002/5002 DSP Laboratory

Spring 2003

Page 2: Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

ECEN4002 Spring 2003 Echo and Reverb R. C. Maher 2

Recirculating Delay Line

• Recall that a simple delay FIFO (first-in, first-out) queue can be implemented using a modulo buffer

• Now, consider a recirculating buffer:+

Delay Line (z-N)k

output can also be taken here

Page 3: Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

ECEN4002 Spring 2003 Echo and Reverb R. C. Maher 3

Recirculating Delay (cont.)

+

Delay Line (z-N)k

x[n] y[n]

kz

z

kzzX

zY

zYkzzXzY

N

N

N

N

−=

−=

+=

11

)()(

)()()( N poles equally spaced

around circle (radius k1/N)

Page 4: Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

ECEN4002 Spring 2003 Echo and Reverb R. C. Maher 4

Recirculating Delay (cont.)• Example: unit sample response (N=8, k=0.8)

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0 8 16 24 32 40 48 56 64 72 80 88 96

Page 5: Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

ECEN4002 Spring 2003 Echo and Reverb R. C. Maher 5

Recirculating Delay (cont.)• Frequency response of system

• A “comb” filter

0

1

2

3

4

5

6

0 0.1 0.2 0.3 0.4 0.5

Normalized Frequency (/fs)

Magnitude (linear scale)

Page 6: Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

ECEN4002 Spring 2003 Echo and Reverb R. C. Maher 6

Echo Generator

• If length N is short, comb filter effect (audio coloration) is noticeable

• If length N corresponds to a time delay of 200ms or more, output perceived as an echo of the input

• Scaling of input is typically needed to prevent overflow

Page 7: Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

ECEN4002 Spring 2003 Echo and Reverb R. C. Maher 7

Acoustics

• Sound propagates through air as a longitudinal wave

• Speed of sound:– 343 m/s @ 20°C (331 m/s @ 0°C)– About 1125 ft/s– About 1 ft/ms (light travels about 1 ft/ns)– About 5 seconds per mile

• Audible wavelengths: 1.7cm to 17m

Page 8: Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

ECEN4002 Spring 2003 Echo and Reverb R. C. Maher 8

Human Hearing Characteristics• Frequency sensitivity roughly 20 Hz – 20kHz

– 3 decades, or 10 octaves– Compares to less than one octave for human visual system

(wavelengths: 3800 – 7600 angstroms)

• Amplitude sensitivity roughly 20Pa – 20Pa– Atmospheric pressure: 105 Pa– Minimum audible sound corresponds to motion a fraction

of diameter of hydrogen atom!– Any better, and we would “hear” thermal noise

• Difference judgments good, absolute judgments poor

Page 9: Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

ECEN4002 Spring 2003 Echo and Reverb R. C. Maher 9

Acoustical Transfer Function

• Linear Time-Invariant (LTI) systems can be fully described by an impulse response

• Fourier Transform of the impulse response is the transfer function

• Acoustical path from a sound source to the listener’s ear is LTI, so we can describe the acoustical system with a transfer function

Page 10: Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

ECEN4002 Spring 2003 Echo and Reverb R. C. Maher 10

Reflections and Reverberation

• Direct sound arrival is followed by reflections from room surfaces

• Overlapping reflections are heard as reverberation

• Direct-to-Reverberant ratio gives cues to size of room, type of room surfaces, and distance from source

Page 11: Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

ECEN4002 Spring 2003 Echo and Reverb R. C. Maher 11

Direct Sound and Reflections

Sound Source

Page 12: Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

ECEN4002 Spring 2003 Echo and Reverb R. C. Maher 12

Reverb Simulation

• Method 1: obtain impulse response of real room, then convolve with input signal– Results can be good, but computation and

storage requirements are high: impulse response sequence for 3-5 seconds is ~200k

• Method 2: use recirculating delay lines to create an artificial impulse response– Less computation and storage, but tricky to get

satisfactory sound quality

Page 13: Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

ECEN4002 Spring 2003 Echo and Reverb R. C. Maher 13

Reverb Simulation (cont.)

• For good reverb:– echo density (echoes per second) must increase

as time goes on– response should be quasi-random (no spectral

coloration)– high frequencies typically decay faster than low

frequencies

Page 14: Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

ECEN4002 Spring 2003 Echo and Reverb R. C. Maher 14

Reverb Simulation (cont.)

• Plan: use parallel recirculating delay lines with incommensurate delays

+ Delay Line (z-N1)

k1

+

+ Delay Line (z-N2)

k2

Page 15: Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

ECEN4002 Spring 2003 Echo and Reverb R. C. Maher 15

Other Improvements

• Cascade of all pass recirculators

+ Delay Line (z-N)

k

+

-k

N

N

kz

zkzH −

++

=1

)(

N poles and zeroes equally spaced around

circle(pole radius k1/N, zero radius k-1/N)

Page 16: Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

ECEN4002 Spring 2003 Echo and Reverb R. C. Maher 16

Other Improvements (cont.)

• Add lowpass filter to feedback path: shortens high frequency reverb time: more like natural reverberation

+ Delay Line (z-N)

kLPF

Page 17: Echo Generation and Simulated Reverberation R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003

ECEN4002 Spring 2003 Echo and Reverb R. C. Maher 17

EVM Note: External Memory

• To use external memory on EVM, need to program the bus control register and the address attribute register 0 (see 56300 Family Manual)movep #$040821,x:M_AAR0 ;Compare 8 most significant bits

;Look for a match with address ;Y:0000 0100 xxxx xxxx xxxx xxxx

;No pack, no mux, Y enabled ;P and X disabled

;AAR0 pin active lowmovep #$012421,x:M_BCR ;One ext. wait state

• Access to external memory is slower than internal memory: wait state stalls processor