<?xml version="1.0" encoding="utf-8"?>
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:bib="http://bibtexml.sf.net/" xmlns:q="http://cnx.rice.edu/qml/1.0" id="m10483" module-id="" cnxml-version="0.6">
  
  <title>Audio Effects: Real-Time Control with the Serial Port</title>
  <metadata xmlns:md="http://cnx.rice.edu/mdml/0.4">
  <!-- WARNING! The 'metadata' section is read only. Do not edit below.
       Changes to the metadata section in the source will not be saved. -->
  <md:content-id>m10483</md:content-id>
  <md:title>Audio Effects: Real-Time Control with the Serial Port</md:title>
  <md:version>2.24</md:version>
  <md:created>2002/02/01</md:created>
  <md:revised>2009/06/01 09:34:19.399 GMT-5</md:revised>
  <md:authorlist>
    <md:author id="dljones">
        <md:firstname>Douglas</md:firstname>
        <md:othername>L.</md:othername>
        <md:surname>Jones</md:surname>
        <md:fullname>Douglas L. Jones</md:fullname>
        <md:email>dl-jones@uiuc.edu</md:email>
    </md:author>
    <md:author id="appadwed">
        <md:firstname>Swaroop</md:firstname>
        <md:surname>Appadwedula</md:surname>
        <md:fullname>Swaroop Appadwedula</md:fullname>
        <md:email>appadwed@uiuc.edu</md:email>
    </md:author>
    <md:author id="mjberry">
        <md:firstname>Matthew</md:firstname>
        <md:othername>J.</md:othername>
        <md:surname>Berry</md:surname>
        <md:fullname>Matthew Berry</md:fullname>
        <md:email>mjberry@uiuc.edu</md:email>
    </md:author>
    <md:author id="markhaun">
        <md:firstname>Mark</md:firstname>
        <md:othername>A.</md:othername>
        <md:surname>Haun</md:surname>
        <md:fullname>Mark Haun</md:fullname>
        <md:email>markhaun@uiuc.edu</md:email>
    </md:author>
    <md:author id="moussa">
        <md:firstname>Dima</md:firstname>
        <md:surname>Moussa</md:surname>
        <md:fullname>Dima Moussa</md:fullname>
        <md:email>dmoussa@uiuc.edu</md:email>
    </md:author>
    <md:author id="dsachs">
        <md:firstname>Daniel</md:firstname>
        <md:othername>Grobe</md:othername>
        <md:surname>Sachs</md:surname>
        <md:fullname>Daniel Sachs</md:fullname>
        <md:email>sachs@uiuc.edu</md:email>
    </md:author>
  </md:authorlist>
  <md:maintainerlist>
    <md:maintainer id="dljones">
        <md:firstname>Douglas</md:firstname>
        <md:othername>L.</md:othername>
        <md:surname>Jones</md:surname>
        <md:fullname>Douglas L. Jones</md:fullname>
        <md:email>dl-jones@uiuc.edu</md:email>
    </md:maintainer>
    <md:maintainer id="appadwed">
        <md:firstname>Swaroop</md:firstname>
        <md:surname>Appadwedula</md:surname>
        <md:fullname>Swaroop Appadwedula</md:fullname>
        <md:email>appadwed@uiuc.edu</md:email>
    </md:maintainer>
    <md:maintainer id="mjberry">
        <md:firstname>Matthew</md:firstname>
        <md:othername>J.</md:othername>
        <md:surname>Berry</md:surname>
        <md:fullname>Matthew Berry</md:fullname>
        <md:email>mjberry@uiuc.edu</md:email>
    </md:maintainer>
    <md:maintainer id="markhaun">
        <md:firstname>Mark</md:firstname>
        <md:othername>A.</md:othername>
        <md:surname>Haun</md:surname>
        <md:fullname>Mark Haun</md:fullname>
        <md:email>markhaun@uiuc.edu</md:email>
    </md:maintainer>
    <md:maintainer id="dsachs">
        <md:firstname>Daniel</md:firstname>
        <md:othername>Grobe</md:othername>
        <md:surname>Sachs</md:surname>
        <md:fullname>Daniel Sachs</md:fullname>
        <md:email>sachs@uiuc.edu</md:email>
    </md:maintainer>
    <md:maintainer id="mrussell">
        <md:firstname>Mike</md:firstname>
        <md:surname>Russell</md:surname>
        <md:fullname>Mike Russell</md:fullname>
        <md:email>merussel@uiuc.edu</md:email>
    </md:maintainer>
    <md:maintainer id="butala">
        <md:firstname>Mark</md:firstname>
        <md:othername>D.</md:othername>
        <md:surname>Butala</md:surname>
        <md:fullname>Mark Butala</md:fullname>
        <md:email>butala@uiuc.edu</md:email>
    </md:maintainer>
    <md:maintainer id="rlmorris">
        <md:firstname>Robert</md:firstname>
        <md:othername>L.</md:othername>
        <md:surname>Morrison</md:surname>
        <md:fullname>Robert Morrison</md:fullname>
        <md:email>rlmorris@uiuc.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  <md:license href="http://creativecommons.org/licenses/by/1.0"/>
  <md:licensorlist>
    <md:licensor id="dljones">
        <md:firstname>Douglas</md:firstname>
        <md:othername>L.</md:othername>
        <md:surname>Jones</md:surname>
        <md:fullname>Douglas L. Jones</md:fullname>
        <md:email>dl-jones@uiuc.edu</md:email>
    </md:licensor>
    <md:licensor id="appadwed">
        <md:firstname>Swaroop</md:firstname>
        <md:surname>Appadwedula</md:surname>
        <md:fullname>Swaroop Appadwedula</md:fullname>
        <md:email>appadwed@uiuc.edu</md:email>
    </md:licensor>
    <md:licensor id="mjberry">
        <md:firstname>Matthew</md:firstname>
        <md:othername>J.</md:othername>
        <md:surname>Berry</md:surname>
        <md:fullname>Matthew Berry</md:fullname>
        <md:email>mjberry@uiuc.edu</md:email>
    </md:licensor>
    <md:licensor id="markhaun">
        <md:firstname>Mark</md:firstname>
        <md:othername>A.</md:othername>
        <md:surname>Haun</md:surname>
        <md:fullname>Mark Haun</md:fullname>
        <md:email>markhaun@uiuc.edu</md:email>
    </md:licensor>
    <md:licensor id="moussa">
        <md:firstname>Dima</md:firstname>
        <md:surname>Moussa</md:surname>
        <md:fullname>Dima Moussa</md:fullname>
        <md:email>dmoussa@uiuc.edu</md:email>
    </md:licensor>
    <md:licensor id="dsachs">
        <md:firstname>Daniel</md:firstname>
        <md:othername>Grobe</md:othername>
        <md:surname>Sachs</md:surname>
        <md:fullname>Daniel Sachs</md:fullname>
        <md:email>sachs@uiuc.edu</md:email>
    </md:licensor>
    <md:licensor id="jake">
        <md:firstname>Jake</md:firstname>
        <md:surname>Janevitz</md:surname>
        <md:fullname>Jake Janovetz</md:fullname>
        <md:email>jake@janovetz.com</md:email>
    </md:licensor>
    <md:licensor id="kramer">
        <md:firstname>Michael</md:firstname>
        <md:othername>L.</md:othername>
        <md:surname>Kramer</md:surname>
        <md:fullname>Michael Kramer</md:fullname>
        <md:email>kramer@ifp.uiuc.edu</md:email>
    </md:licensor>
    <md:licensor id="bwade">
        <md:firstname>Brian</md:firstname>
        <md:surname>Wade</md:surname>
        <md:fullname>Brian Wade</md:fullname>
        <md:email>bwade@uiuc.edu</md:email>
    </md:licensor>
  </md:licensorlist>
  <md:keywordlist>
    <md:keyword>delay</md:keyword>
    <md:keyword>DSP</md:keyword>
    <md:keyword>echo</md:keyword>
    <md:keyword>feedback</md:keyword>
    <md:keyword>graphical user interface</md:keyword>
    <md:keyword>serial port</md:keyword>
  </md:keywordlist>
  <md:subjectlist>
    <md:subject>Science and Technology</md:subject>
  </md:subjectlist>
  <md:abstract>You will implement a feedback-echo effect and adjust its parameters in real time with a MATLAB graphical user interface.</md:abstract>
  <md:language>en</md:language>
  <!-- WARNING! The 'metadata' section is read only. Do not edit above.
       Changes to the metadata section in the source will not be saved. -->
</metadata>

<content>
    <section id="sec5">
      <title>Implementation</title>
      <para id="para15">
	For this exercise, you will extend the system from <link document="m10480">Audio Effects: Using External Memory</link>
	to generate a feedback-echo effect. You will then extend this
	echo effect to use the serial port on the DSP EVM. The serial
	interface will receive data from a MATLAB GUI that allows the
	two system gains and the echo delay to be changed using
	on-screen sliders.
      </para>
      <section id="subsec2">
	<title>Feedback system implementation</title>
	<figure id="fig1">
	  <media id="id8648873" alt="">
            <image src="system.png" mime-type="image/png"/>
            <image src="system.eps" mime-type="application/postscript"/>
          </media>
	  <caption>Feedback System with Test Points</caption>
	</figure>
	<para id="para17">
	  First, modify code from <link document="m10480">Audio
	  Effects: Using External Memory</link> to create the
	  feedback-echo system shown in <link target-id="fig1"/>. A
	  one-tap feedback-echo is a simple audio effect that sounds
	  remarkably good.  You will use both channels of input by
	  summing the two inputs so that either or both may be used as
	  an input to the system. Also, send several test signals to
	  the six-channel board's D/A converters:
	</para>
	<list id="list3">
	  <item>The summed input signal</item>
	  <item>The input signal after gain stage 
	    <m:math>
	      <m:ci><m:msub>
		  <m:mi>G</m:mi>
		  <m:mn>1</m:mn>
		</m:msub></m:ci>
	    </m:math>
	  </item>
	  <item>The data going into the long delay</item>
	  <item>The data coming out of the delay</item>
	</list>
	<para id="para18">
	  You will also need to set both the
	  input gain
	  <m:math>
	    <m:ci><m:msub>
		<m:mi>G</m:mi>
		<m:mn>0</m:mn>
	      </m:msub></m:ci>
	  </m:math> and the feedback gain
	  <m:math>
	    <m:ci><m:msub>
		<m:mi>G</m:mi>
		<m:mn>1</m:mn>
	      </m:msub></m:ci>
	  </m:math>
	  to prevent overflow. 
	</para>
	<para id="para19">
	  As you implement this code, ensure that the delay
	  <code>n</code> and the gain values
	  <m:math>
	    <m:ci><m:msub>
		<m:mi>G</m:mi>
		<m:mn>1</m:mn>
	      </m:msub></m:ci> 
	  </m:math> and
	  <m:math>
	    <m:ci><m:msub> 
		<m:mi>G</m:mi> 
		<m:mn>2</m:mn>
	      </m:msub></m:ci> 
	  </m:math> are stored in memory and can be easily changed
	  using the debugger. If you do this, it will be easier to
	  extend your code to accept its parameters from MATLAB in
	  <link target-id="subsec3">MATLAB Interface
	  Implementation</link>.
	</para>
	<para id="para20">
	  To test your echo, connect a CD player or microphone to the
	  input of the DSP EVM, and connect the output of the DSP EVM
	  to a loudspeaker.  Verify that an input signal echoes
	  multiple times in the output and that the spacing between
	  echoes matches the delay length you have chosen.
	</para>

      </section>
      <section id="subsec3">
	<title>MATLAB interface implementation</title>
	<para id="para21">
	  After studying the MATLAB interface outlined at the end of <link document="m12062">Using the Serial Port with a MATLAB GUI</link>, write MATLAB code
	  to send commands to the serial interface based on three
	  sliders: two gain sliders (for
	  <m:math>
	    <m:ci><m:msub>
		<m:mi>G</m:mi>
		<m:mn>1</m:mn>
	      </m:msub></m:ci> 
	  </m:math> and
	  <m:math>
	    <m:ci><m:msub>
		<m:mi>G</m:mi>
		<m:mn>2</m:mn>
	      </m:msub></m:ci> 
	  </m:math>) and one delay slider (for <code>n</code>). Then
	  modify your code to accept those commands and change the
	  values for
	  <m:math>
	    <m:ci><m:msub>
		<m:mi>G</m:mi>
		<m:mn>1</m:mn>
	      </m:msub></m:ci> 
	  </m:math>,
	  <m:math>
	    <m:ci><m:msub>
		<m:mi>G</m:mi>
		<m:mn>2</m:mn>
	      </m:msub></m:ci> 
	  </m:math> and <code>n</code>. Make sure that <code>n</code>
	  can be set to values spanning the full range of 0 to
	  131,072, although it is not necessary that every number in
	  that range be represented.

	</para>
      </section>
    </section>

  </content>
  
</document>
