<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN" "http://cnx.rice.edu/technology/cnxml/schema/dtd/0.5/cnxml_mathml.dtd">
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:bib="http://bibtexml.sf.net/" xmlns:m="http://www.w3.org/1998/Math/MathML" id="new">
  <name>Reverberation</name>
  <metadata>
  <md:version>1.2</md:version>
  <md:created>2007/10/04 08:59:16 GMT-5</md:created>
  <md:revised>2008/03/18 11:24:29.473 GMT-5</md:revised>
  <md:authorlist>
      <md:author id="doering">
      <md:firstname>Ed</md:firstname>
      
      <md:surname>Doering</md:surname>
      <md:email>doering@rose-hulman.edu</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist>
    <md:maintainer id="doering">
      <md:firstname>Ed</md:firstname>
      
      <md:surname>Doering</md:surname>
      <md:email>doering@rose-hulman.edu</md:email>
    </md:maintainer>
    <md:maintainer id="eluther">
      <md:firstname>Erik</md:firstname>
      <md:othername>B</md:othername>
      <md:surname>Luther</md:surname>
      <md:email>erik.luther@ni.com</md:email>
    </md:maintainer>
    <md:maintainer id="SShearman">
      <md:firstname>Sam</md:firstname>
      <md:othername>D.</md:othername>
      <md:surname>Shearman</md:surname>
      <md:email>sam.shearman@ni.com</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist>
    <md:keyword>audio</md:keyword>
    <md:keyword>comb filter</md:keyword>
    <md:keyword>delay line</md:keyword>
    <md:keyword>echo</md:keyword>
    <md:keyword>impulse response</md:keyword>
    <md:keyword>LabVIEW</md:keyword>
    <md:keyword>loop time</md:keyword>
    <md:keyword>reverberation</md:keyword>
    <md:keyword>reverb time</md:keyword>
  </md:keywordlist>

  <md:abstract>Reverberation is a property of concert halls that greatly adds to the enjoyment of a musical performance. Sound waves propagate directly from the stage to the listener, and also reflect from the floor, walls, ceiling, and back wall of the stage to create myriad copies of the direct sound that are time-delayed and reduced in intensity. In this module, learn about the concept of reverberation in more detail and ways to emulate reverberation using a digital filter structure known as a comb filter.</md:abstract>
</metadata>

<content>

<table id="labview_banner" frame="none"><tgroup cols="2">
<colspec rowsep="0" colsep="0"/> <colspec colwidth="6in" rowsep="0" colsep="0"/>
<tbody>
  <row>
    <entry morerows="3"><media type="image/png" src="LabVIEWq.png"/></entry>
    <entry> This module refers to LabVIEW, a software development environment that features a graphical programming language.
       Please see the <cnxn document="m15428">LabVIEW QuickStart Guide</cnxn> module for tutorials and documentation that will help you:</entry>
  </row>
  <row> <entry>• Apply LabVIEW to Audio Signal Processing </entry> </row>
  <row> <entry>• Get started with LabVIEW</entry> </row>
  <row> <entry>• Obtain a fully-functional evaluation edition of LabVIEW</entry> </row>
</tbody>
</tgroup>
</table>


<section id="sec1">
<name>Introduction</name>

<para id="par2">
		<term>Reverberation</term> is a property of concert halls that greatly adds to the enjoyment of a musical performance.
		The on-stage performer generates sound waves that propagate directly to the listener's ear. However, sound waves
		also bounce off the floor, walls, ceiling, and back wall of the stage, creating myriad copies of the direct sound that are
		time-delayed and reduced in intensity.</para>

<para id="par3">		In this module, learn about the concept of reverberation in more detail and ways to emulate
		reverberation using a digital filter structure known as a <term>comb filter</term>.</para>

<para id="par4">		The <cnxn target="video-reverb"/> screencast video continues the discussion by visualizing the sound paths
		in a reverberant environment. The <term>impulse response</term> of the reverberant environment is also introduced.
		Understanding the desired impulse response is the first step toward emulating reverberation with a digital filter.
</para>

<figure id="video-reverb">
<media type="image/png" src="snd_reverb-concept.html">
   <param name="thumbnail" value="snd_reverb-concept.png"/>
   </media>
<caption>
   [video] Sound paths in a reverberant environment and impulse response model
</caption>
</figure>

</section>

<section id="sec6">
<name>Comb Filter Theory</name>

<para id="par7">
		The <term>comb filter</term> is a relatively simple digital filter structure based on a <term>delay line</term> 
		and <term>feedback</term>. Watch the <cnxn target="video-combfilter-theory"/> screencast video  
		to learn how you can develop the comb filter structure by considering an idealized version of the impulse
		response of a reverberant environment.
</para>

<figure id="video-combfilter-theory">
<media type="image/png" src="snd_reverb-combfilter-theory.html">
   <param name="thumbnail" value="snd_reverb-combfilter-theory.png"/>
   </media>
<caption>
   [video] Development of the <term>comb filter</term> structure as a way to implement an idealized reverberant
		impulse response
</caption>
</figure>

<para id="par9">
		The <term>difference equation</term> of the comb filter is required in order to implement the filter in LabVIEW. In
		general, a difference equation states the filter output y(n) as a function of the past and present input values as well
		as past output values.</para>

<para id="par10">		Take some time now to derive the comb filter difference equation as requested by the following exercise.
</para>

<exercise id="exer11">
<problem>
<para id="par12">Derive the difference equation of the comb filter structure shown at the end of the
			<cnxn target="video-combfilter-theory"/> video.</para>
</problem>
<solution>
<para id="par13"/>
</solution>
</exercise>
</section>

<section id="sec14">
<name>Comb Filter Implementation</name>

<para id="par15">
		Once the difference equation is available, you can apply the coefficients of the equation to the LabVIEW "IIR" (infinite impulse response) digital
		filter. The <cnxn target="video-combfilter-build"/> screencast video walks through the complete process you need to convert the 
		comb filter difference equation into a LabVIEW VI. The LabVIEW <term>MathScript node</term> creates the coefficient vectors. Once the comb
		filter is complete, its impulse response is explored for different values of delay line length and feedback gain.</para>

<para id="par16">		Please follow along with the video and create your own version of the comb filter in LabVIEW.
		Refer to <cnxn document="m15430">TripleDisplay</cnxn> to install the 
		front-panel indicator used to view the signal spectrum.
</para>

<figure id="video-combfilter-build">
<media type="image/png" src="snd_reverb-combfilter-build.html">
   <param name="thumbnail" value="snd_reverb-combfilter-build.png"/>
   </media>
<caption>
   [video] Implementing the comb filter in LabVIEW; exploration of the impulse response as a function of delay line length and feedback gain
</caption>
</figure>

</section>

<section id="sec18">
<name>Loop Time and Reverb Time</name>

<para id="par19">
		As you have learned in previous sections, the comb filter behavior is determined by the delay line length N and the feedback coefficient g. From
		a user's point of view, however, these two parameters are not very intuitive. Instead, the comb filter behavior is normally specified by
		<term>loop time</term>
<!-- MathType@Translator@5@5@MathML2 (m namespace).tdl@MathML 2.0 (m namespace)@ -->
<m:math>
 <m:semantics>
  <m:mi>τ</m:mi>
 <m:annotation encoding="MathType-MTEF">
 MathType@MTEF@5@5@+=feaagaart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaeqiXdqhaaa@3701@</m:annotation>
 </m:semantics>
</m:math>
<!-- MathType@End@5@5@ --> and <term>reverb time</term> denoted
<!-- MathType@Translator@5@5@MathML2 (m namespace).tdl@MathML 2.0 (m namespace)@ -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:msub>
    <m:mi>T</m:mi>
    <m:mrow>
     <m:mn>60</m:mn>
    </m:mrow>
   </m:msub>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 MathType@MTEF@5@5@+=feaagaart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamivamaaBaaaleaacaaI2aGaaGimaaqabaaaaa@37BB@</m:annotation>
 </m:semantics>
</m:math>. Reverb time may also be written as 
<!-- MathType@Translator@5@5@MathML2 (m namespace).tdl@MathML 2.0 (m namespace)@ -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:msub>
    <m:mi>R</m:mi>
    <m:mrow>
     <m:mi>T</m:mi><m:mn>60</m:mn>
    </m:mrow>
   </m:msub>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 MathType@MTEF@5@5@+=feaagaart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamOuamaaBaaaleaacaWGubGaaGOnaiaaicdaaeqaaaaa@3892@</m:annotation>
 </m:semantics>
</m:math>
<!-- MathType@End@5@5@ -->. Loop time indicates the amount of time necessary for a given sample to pass through the delay line, and is therefore the delay line length N times the
sampling interval. The sampling interval is the reciprocal of sampling frequency, so the loop time may be expressed as in <cnxn target="eqn-looptime"/>:
</para>

<equation id="eqn-looptime">


<!-- MathType@Translator@5@5@MathML2 (m namespace).tdl@MathML 2.0 (m namespace)@ -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:mi>τ</m:mi><m:mo>=</m:mo><m:mfrac>
    <m:mi>N</m:mi>
    <m:mrow>
     <m:msub>
      <m:mi>f</m:mi>
      <m:mi>S</m:mi>
     </m:msub>
    </m:mrow>
   </m:mfrac>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 MathType@MTEF@5@5@+=feaagaart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaeqiXdqNaeyypa0ZaaSaaaeaacaWGobaabaGaamOzamaaBaaaleaacaWGtbaabeaaaaaaaa@3AD8@</m:annotation>
 </m:semantics>
</m:math>
<!-- MathType@End@5@5@ -->

</equation>

<para id="par21">
		Reverb time indicates the amount of time required for the reverberant signal's intensity to drop by 60 dB (dB = decibels), effectively to silence. 
		Recall from the 
		<cnxn target="video-combfilter-theory"/> video that the comb filter's impulse response looks like a series of decaying impulses spaced by a delay 
		of N samples; this impulse response is plotted in <cnxn target="fig-impulseresponse"/> with the independent axis measured in time rather than
		samples.
</para>

<figure id="fig-impulseresponse">
<media type="image/png" src="snd_reverb-impulseresponse.png">
   </media>
<caption>
   Comb filter impulse response
</caption>
</figure>

<para id="par23">
		Take a few minutes to derive an equation for the comb filter feedback gain "g" as a function of the loop time and the reverb time. The following
		pair of exercises guide you through the derivation.
</para>

<exercise id="exer24">
<problem>
<para id="par25">Given the comb filter impulse response pictured in <cnxn target="fig-impulseresponse"/>, derive an
			equation for the reverb time
<!-- MathType@Translator@5@5@MathML2 (m namespace).tdl@MathML 2.0 (m namespace)@ -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:msub>
    <m:mi>T</m:mi>
    <m:mrow>
     <m:mn>60</m:mn>
    </m:mrow>
   </m:msub>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 MathType@MTEF@5@5@+=feaagaart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamivamaaBaaaleaacaaI2aGaaGimaaqabaaaaa@37BB@</m:annotation>
 </m:semantics>
</m:math>
<!-- MathType@End@5@5@ --> in terms of the loop time
<!-- MathType@Translator@5@5@MathML2 (m namespace).tdl@MathML 2.0 (m namespace)@ -->
<m:math>
 <m:semantics>
  <m:mi>τ</m:mi>
 <m:annotation encoding="MathType-MTEF">
 MathType@MTEF@5@5@+=feaagaart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaeqiXdqhaaa@3701@</m:annotation>
 </m:semantics>
</m:math>
<!-- MathType@End@5@5@ --> and the comb filter's feedback constant g. Hint: Recall the basic equation to express the ratio of two amplitudes in decibels, i.e., use the form with a factor of 20.
	</para>
</problem>
<solution>
<para id="par26">
<!-- MathType@Translator@5@5@MathML2 (m namespace).tdl@MathML 2.0 (m namespace)@ -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:msub>
    <m:mi>T</m:mi>
    <m:mrow>
     <m:mn>60</m:mn>
    </m:mrow>
   </m:msub>
   <m:mo>=</m:mo><m:mfrac>
    <m:mrow>
     <m:mo>−</m:mo><m:mn>3</m:mn><m:mi>τ</m:mi>
    </m:mrow>
    <m:mrow>
     <m:msub>
      <m:mrow>
       <m:mi>log</m:mi><m:mo>⁡</m:mo>
      </m:mrow>
      <m:mrow>
       <m:mn>10</m:mn>
      </m:mrow>
     </m:msub>
     <m:mi>g</m:mi>
    </m:mrow>
   </m:mfrac>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 MathType@MTEF@5@5@+=feaagaart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamivamaaBaaaleaacaaI2aGaaGimaaqabaGccqGH9aqpdaWcaaqaaiabgkHiTiaaiodacqaHepaDaeaaciGGSbGaai4BaiaacEgadaWgaaWcbaGaaGymaiaaicdaaeqaaOGaam4zaaaaaaa@41B0@</m:annotation>
 </m:semantics>
</m:math>
<!-- MathType@End@5@5@ -->
	</para>
</solution>
</exercise>
<exercise id="exer27">
<problem>
<para id="par28">Based on your previous derivation, develop an equation for the comb filter gain "g" in terms of the desired loop time
	and reverb time.</para>
</problem>
<solution>
<para id="par29">
<!-- MathType@Translator@5@5@MathML2 (m namespace).tdl@MathML 2.0 (m namespace)@ -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:mi>g</m:mi><m:mo>=</m:mo><m:msup>
    <m:mrow>
     <m:mn>10</m:mn>
    </m:mrow>
    <m:mrow>
     <m:mo>−</m:mo><m:mfrac>
      <m:mrow>
       <m:mn>3</m:mn><m:mi>τ</m:mi>
      </m:mrow>
      <m:mrow>
       <m:msub>
        <m:mi>T</m:mi>
        <m:mrow>
         <m:mn>60</m:mn>
        </m:mrow>
       </m:msub>
      </m:mrow>
     </m:mfrac>
    </m:mrow>
   </m:msup>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 MathType@MTEF@5@5@+=feaagaart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaam4zaiabg2da9iaaigdacaaIWaWaaWbaaSqabeaacqGHsisldaWcaaqaaiaaiodacqaHepaDaeaacaWGubWaaSbaaWqaaiaaiAdacaaIWaaabeaaaaaaaaaa@3ECE@</m:annotation>
 </m:semantics>
</m:math>
<!-- MathType@End@5@5@ -->
</para>
</solution>
</exercise>
<exercise id="exer30">
<problem>
<para id="par31">To finish up, derive the equation for the comb filter delay "N" in terms of the desired loop time.</para>
</problem>
<solution>
<para id="par32">
<!-- MathType@Translator@5@5@MathML2 (m namespace).tdl@MathML 2.0 (m namespace)@ -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:mi>N</m:mi><m:mo>=</m:mo><m:mi>τ</m:mi><m:msub>
    <m:mi>f</m:mi>
    <m:mi>S</m:mi>
   </m:msub>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 MathType@MTEF@5@5@+=feaagaart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamOtaiabg2da9iabes8a0jaadAgadaWgaaWcbaGaam4uaaqabaaaaa@3AC8@</m:annotation>
 </m:semantics>
</m:math>
<!-- MathType@End@5@5@ -->
</para>
</solution>
</exercise>
<para id="par33">
		Now, return to your own comb filter VI and modify the front-panel controls and LabVIEW MathScript node to use loop time and reverb time as the primary user inputs.
		Experiment with your modified system to ensure that the spacing between impulses does indeed match the specified loop time, and that the impulse decay rate makes
		sense for the specified reverb time.
</para>

</section>

<section id="sec34">
<name>Comb Filter Implementation for Audio Signals</name>

<para id="par35">
		In this section, learn how to build a comb filter in LabVIEW that can process an audio signal,
		specifically, an impulse source. Follow along with the <cnxn target="video-combfilter-audio"/> screencast video
		to create your own VI. The video includes an
		audio demonstration of the finished result. As a bonus, the video also explains where
	       the "comb filter" gets its name.
</para>

<figure id="video-combfilter-audio">
<media type="image/png" src="snd_reverb-combfilter-audio.html">
   <param name="thumbnail" value="snd_reverb-combfilter-audio.png"/>
   </media>
<caption>
   [video] Building a LabVIEW VI of a comb filter that can process an audio signal
</caption>
</figure>

<para id="par37">
		Next, learn how you can replace the impulse source with an audio .wav file. Speech makes a good test signal, and
		the <cnxn target="video-combfilter-wav"/> screencast video shows how to modify your
		VI to use a .wav audio file as the signal source. The speech clip used as an example in the video is available
		here: <link src="speech.wav">speech.wav</link> (audio courtesy of the Open Speech Repository,
		<link src="http://www.voiptroubleshooter.com/open_speech">www.voiptroubleshooter.com/open_speech</link>; the sentences are two of the many phonetically balanced <term>Harvard Sentences</term>, an important standard
	       for the speech processing community).
</para>

<figure id="video-combfilter-wav">
<media type="image/png" src="snd_reverb-combfilter-wav.html">
   <param name="thumbnail" value="snd_reverb-combfilter-wav.png"/>
   </media>
<caption>
   [video] Modifying the LabVIEW VI of a comb filter to process a .wav audio signal
</caption>
</figure>

</section>

<section id="sec39">
<name>References</name>

<list id="list40" type="bulleted">

<item> Moore, F.R., "Elements of Computer Music," Prentice-Hall, 1990, ISBN 0-13-252552-6. </item>
<item> Dodge, C., and T.A. Jerse, "Computer Music: Synthesis, Composition, and Performance," 2nd ed., Schirmer Books, 1997,
			ISBN 0-02-864682-7. </item>

</list>

</section>

</content>
</document>
