<?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>[ mini-project ] Ring Modulation and Pitch Shifting</name>
  <metadata>
  <md:version>1.1</md:version>
  <md:created>2007/09/11 08:28:12.019 GMT-5</md:created>
  <md:revised>2007/11/06 08:52:15.606 US/Central</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>amplitude modulation</md:keyword>
    <md:keyword>LabVIEW</md:keyword>
    <md:keyword>pitch shifter</md:keyword>
    <md:keyword>ring modulation</md:keyword>
    <md:keyword>single-sideband modulation</md:keyword>
  </md:keywordlist>

  <md:abstract>Create a LabVIEW VI to experiment with ring modulation (also called amplitude modulation, or AM), and develop a LabVIEW VI to shift the pitch of a speech signal using the single-sideband modulation technique.</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>Overview</name>

<para id="par2">
		<term>Ring modulation (AM)</term> is an audio special effect that produces two frequency-shifted replicas of the spectrum of a
		source signal, with one replica shifted to higher frequency and the other replica to a lower frequency. <term>Single-sideband AM (SSB-AM)</term>  
		provides a way to shift the source signal's spectrum higher or lower but without the additional replica. SSB-AM provides one way to
		implement a <term>pitch shifter</term>, an
		audio special effect that shifts the frequency of speech, singing, or a musical instrument to a higher or lower frequency.</para>

<para id="par3">		In this project, use LabVIEW to implement several types of ring modulators and a pitch shifter.
</para>

</section>

<section id="sec4">
<name>Prerequisite Modules</name>

<para id="par5">
		If you have not done so already, please study the prerequisite modules <cnxn document="m15447">AM Mathematics</cnxn>
		and <cnxn document="m15467">Pitch Shifting</cnxn>.
		If you are relatively new to LabVIEW, consider taking the course <cnxn document="col10440">LabVIEW Techniques for Audio Signal Processing</cnxn> which provides 
		the foundation you need to complete this mini-project activity, including working with arrays, creating subVIs, playing an array to the soundcard, and saving an array as a .wav sound file.
</para>

</section>

<section id="sec6">
<name>Deliverables</name>

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

<item> All LabVIEW code that you develop (block diagrams and front panels) </item>
<item> All generated sounds in .wav format </item>
<item> Any plots or diagrams requested </item>
<item> Summary write-up of your results </item>

</list>

</section>

<section id="sec8">
<name>Part 1: Multiple Modulators</name>

<para id="par9">
Consider an original signal 
<!-- x(t) -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:mi>x</m:mi><m:mo stretchy="false">(</m:mo><m:mi>t</m:mi><m:mo stretchy="false">)</m:mo>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 </m:annotation>
 </m:semantics>
</m:math>, which is a sinusoid of frequency
<!-- f0 -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:msub>
    <m:mi>f</m:mi>
    <m:mn>0</m:mn>
   </m:msub>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 </m:annotation>
 </m:semantics>
</m:math>. The original signal is modulated by a cosine function of frequency
<!-- f0/2 -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:mrow><m:mrow>
    <m:msub>
     <m:mi>f</m:mi>
     <m:mn>0</m:mn>
    </m:msub>
   </m:mrow><m:mo>/</m:mo><m:mn>2</m:mn></m:mrow>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 </m:annotation>
 </m:semantics>
</m:math> to produce
<!-- x1(t) -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:msub>
    <m:mi>x</m:mi>
    <m:mn>1</m:mn>
   </m:msub>
   <m:mo stretchy="false">(</m:mo><m:mi>t</m:mi><m:mo stretchy="false">)</m:mo>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 </m:annotation>
 </m:semantics>
</m:math>, which is in turn modulated by a cosine function of frequency 
<!-- f0/5 -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:mrow><m:mrow>
    <m:msub>
     <m:mi>f</m:mi>
     <m:mn>0</m:mn>
    </m:msub>
   </m:mrow><m:mo>/</m:mo><m:mn>5</m:mn></m:mrow>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 </m:annotation>
 </m:semantics>
</m:math> to produce
<!-- x2(t) -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:msub>
    <m:mi>x</m:mi>
    <m:mn>2</m:mn>
   </m:msub>
   <m:mo stretchy="false">(</m:mo><m:mi>t</m:mi><m:mo stretchy="false">)</m:mo>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 </m:annotation>
 </m:semantics>
</m:math>,  which is in turn modulated by a cosine function of frequency 
<!-- f0/9 -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:mrow><m:mrow>
    <m:msub>
     <m:mi>f</m:mi>
     <m:mn>0</m:mn>
    </m:msub>
   </m:mrow><m:mo>/</m:mo><m:mn>9</m:mn></m:mrow>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 </m:annotation>
 </m:semantics>
</m:math> to produce
<!-- x3(t) -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:msub>
    <m:mi>x</m:mi>
    <m:mn>3</m:mn>
   </m:msub>
   <m:mo stretchy="false">(</m:mo><m:mi>t</m:mi><m:mo stretchy="false">)</m:mo>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 </m:annotation>
 </m:semantics>
</m:math>. Sketch the frequency-domain version of the four signals, i.e., sketch
<!-- X(f) -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:mi>X</m:mi><m:mo stretchy="false">(</m:mo><m:mi>f</m:mi><m:mo stretchy="false">)</m:mo>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 </m:annotation>
 </m:semantics>
</m:math>,
<!-- X1(f) -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:msub>
    <m:mi>X</m:mi>
    <m:mn>1</m:mn>
   </m:msub>
   <m:mo stretchy="false">(</m:mo><m:mi>f</m:mi><m:mo stretchy="false">)</m:mo>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 </m:annotation>
 </m:semantics>
</m:math>, 
<!-- X2(f) -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:msub>
    <m:mi>X</m:mi>
    <m:mn>2</m:mn>
   </m:msub>
   <m:mo stretchy="false">(</m:mo><m:mi>f</m:mi><m:mo stretchy="false">)</m:mo>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 </m:annotation>
 </m:semantics>
</m:math>, and
<!-- X3(f) -->
<m:math>
 <m:semantics>
  <m:mrow>
   <m:msub>
    <m:mi>X</m:mi>
    <m:mn>3</m:mn>
   </m:msub>
   <m:mo stretchy="false">(</m:mo><m:mi>f</m:mi><m:mo stretchy="false">)</m:mo>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 </m:annotation>
 </m:semantics>
</m:math>.</para>

<para id="par10">Create a LabVIEW implementation of the above arrangement and plot the spectrum of each of the four signals. Compare your LabVIEW results to your prediction.
</para>

</section>

<section id="sec11">
<name>Part 2: Multiple Modulators with Soundfile Input</name>

<para id="par12">
		Create a LabVIEW implementation of the multiple modulation scheme of Part 1 that can process a .wav 
		audio file as the input signal. Use controls for the three modulators that will allow you to easily 
		change their modulation frequencies. Experiment with various choices of modulation frequencies to make 
		an interesting effect. Create two .wav files using different parameter choices.
</para>

</section>

<section id="sec13">
<name>Part 3: Pitch Shifter</name>

<para id="par14">
		<media type="image/png" src="LabVIEW.png"/> Implement the pitch shifting algorithm based on the single-sideband AM technique discussed in 
<cnxn document="m15467">Pitch Shifter with Single-Sideband AM</cnxn>.  Use a design 
similar to that of "am_demo3.vi" provided at the bottom of the page of <cnxn document="m15447">AM
Mathematics</cnxn> which accepts a .wav file as input and plays the sound. The sound clip should be relatively short 
(on the order of several seconds). For this part of the project, do <emphasis>not</emphasis> implement the pre-filter;
you will do this in Part 4.
</para>

<para id="par15">
Evaluate the quality of your pitch shifter by presenting some written discussion and suitable spectrogram plots. 
Especially indicate whether you can find audible and visual evidence of aliasing.</para>

<para id="par16">The <term>fast Hilbert transform</term> built-in subVI is available in the "Signal Processing | Transforms" pallet.
</para>

</section>

<section id="sec17">
<name>Part 4: Pitch Shifter with Anti-Aliasing Filter</name>

<para id="par18">
Modify your pitch shifter to include a bandpass filter. State how you will compute the bandpass filter's upper and 
lower corner frequencies, given that you want to preserve as much of the original signal's bandwidth as possible.</para>

<para id="par19">Evaluate the quality of your modified pitch shifter by presenting some written discussion and suitable spectral plots. 
Compare your results with those you obtained in Part 3.</para>

<para id="par20">A variety of digital filters are available in the "Signal Processing | Filters" pallet.
</para>

</section>

<section id="sec21">
<name>Optional Part 5: Real-Time Processor</name>

<para id="par22">
Choose one of the previous LabVIEW implementations and make it work in real time with a signal input (microphone)
and interactive front-panel controls.
</para>

<para id="par23">
<media type="image/png" src="LabVIEW.png"/> Evaluate the interrupt-driven approach using an event structure (see "am_demo1.vi" described in 
<cnxn document="m15447">AM Mathematics</cnxn>, as well as the polled approach used by
<link src="mic_in_speaker_out.vi">mic_in_speaker_out.vi</link>). Use whichever technique you prefer.
</para>

<para id="par24">
Submit your finished LabVIEW implementation as a distinct .zip file.
</para>

</section>

</content>
</document>
