<?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 ] Spectrogram Art</name>
  <metadata>
  <md:version>1.1</md:version>
  <md:created>2007/08/31 10:47:48.419 GMT-5</md:created>
  <md:revised>2007/10/31 16:13:36.493 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>additive synthesis</md:keyword>
    <md:keyword>amplitude trajectory</md:keyword>
    <md:keyword>frequency trajectory</md:keyword>
    <md:keyword>LabVIEW</md:keyword>
    <md:keyword>partial</md:keyword>
    <md:keyword>spectrogram</md:keyword>
  </md:keywordlist>

  <md:abstract>In this project you will create an oscillator whose output tracks a specified amplitude
and frequency trajectory. With this general-purpose oscillator you can define multiple frequency/amplitude trajectories that can be combined to create complex sounds. In particular, you will design the sound so that its spectrogram makes a recognizable picture!</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>Objective</name>

<para id="par2">
Additive synthesis builds up complex sounds from simple sounds (sinusoids). Additive synthesis implies more than just doing Fourier series, though: each sinusoidal component is assigned its own frequency and amplitude trajectory (resulting in a partial), so complex, time-varying sounds can be generated by summing these partials together.</para>

<para id="par3">In this project you will create an oscillator whose output tracks a specified amplitude and frequency trajectory. With this general-purpose oscillator you can define multiple frequency/amplitude trajectories that can be combined to create complex sounds. In particular, you will design the sound so that its spectrogram makes a recognizable picture! 
</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="m15444">Additive Synthesis Concepts</cnxn> and
<cnxn document="m15445">Additive Synthesis Techniques</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: General-Purpose Sinusoidal Oscillator</name>

<para id="par9">
Develop a subVI called <term>gposc.vi</term> that accepts a frequency trajectory (in Hz), an amplitude trajectory, and a sampling frequency (in Hz) to produce a sinusoidal output whose amplitude and frequency tracks the two input trajectories, respectively. The two trajectories are arrays that should be of the same length.</para>

<para id="par10">Demonstrate that your oscillator works properly by showing the output of your VI (spectrogram and .wav file) for the amplitude and frequency trajectories produced by a LabVIEW MathScript node that contains the following code:
</para>

<code type="block">
ff=[linspace(200,1600,2.5*fs) ...
   linspace(1600,800,1.5*fs)];

aa=[linspace(1,0,3*fs) ...
   linspace(0,0.75,fs)];
</code>

<para id="par11">
where <code type="inline">fs</code> is the sampling frequency in Hz, <code type="inline">ff</code> is the output frequency trajectory (also in Hz), and <code type="inline">aa</code> is the amplitude trajectory (between 0 and 1). Use a sampling frequency of 5 kHz when you make the spectrogram and soundfile.</para>

<para id="par12">Plot the trajectories <code type="inline">ff</code> and <code type="inline">aa</code> and compare to your spectrogram.</para>

<para id="par13">Remember, the instantaneous frequency of your general-purpose sinusoidal oscillator is related to the time-varying phase of the sine function. That is, if the sinusoidal signal is defined as
<m:math>
 <m:semantics>
  <m:mrow>
   <m:mi>y</m:mi><m:mo stretchy="false">(</m:mo><m:mi>t</m:mi><m:mo stretchy="false">)</m:mo><m:mo>=</m:mo><m:mi>sin</m:mi><m:mo>⁡</m:mo><m:mo stretchy="false">(</m:mo><m:mi>θ</m:mi><m:mo stretchy="false">(</m:mo><m:mi>t</m:mi><m:mo stretchy="false">)</m:mo><m:mo stretchy="false">)</m:mo>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 </m:annotation>
 </m:semantics>
 </m:math>,
 then the instantaneous frequency of the sinusoid is
<m:math>
 <m:semantics>
  <m:mrow>
   <m:mi>ω</m:mi><m:mo stretchy="false">(</m:mo><m:mi>t</m:mi><m:mo stretchy="false">)</m:mo><m:mo>=</m:mo><m:mrow><m:mrow>
    <m:mi>d</m:mi><m:mi>θ</m:mi><m:mo stretchy="false">(</m:mo><m:mi>t</m:mi><m:mo stretchy="false">)</m:mo>
   </m:mrow><m:mo>/</m:mo><m:mrow>
    <m:mi>d</m:mi><m:mi>t</m:mi>
   </m:mrow></m:mrow>
   
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 </m:annotation>
 </m:semantics>
</m:math>
radians per second. Because you are given a frequency trajectory that relates to
<m:math>
 <m:semantics>
  <m:mrow>
   <m:mi>ω</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 mathematical operation yields the phase function
<m:math>
 <m:semantics>
  <m:mrow>
   <m:mi>θ</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>?</para>

<para id="par14">Here's a LabVIEW coding tip: You will find the built-in VI  "Mathematics | Integ and Diff | Integral x(t)" to be essential for this part of the project.
</para>

</section>

<section id="sec15">
<name>Part 2: Frequency Trajectory Design</name>

<para id="par16">
		You can make your spectrogram art project sound more musically appealing when you design the frequency trajectories to account for frequency <emphasis>perception</emphasis>; refer to 
		<cnxn document="m15439">Perception of Sound</cnxn> for a detailed treatment of this subject. 
		Design your trajectories in "log space" (using logarithmic graph paper) and then convert to actual frequency just before invoking your general-purpose sinusoidal oscillator.</para>

<para id="par17">Review <cnxn document="m15445">Additive Synthesis Techniques</cnxn> to learn how to create your frequency trajectories for this part of the project.
</para>

</section>

<section id="sec18">
<name>Part 3: Amplitude Trajectory Design</name>

<para id="par19">
		The discussion of Part 2 pertains to the design of your amplitude trajectories, as well. Perception of intensity (loudness) is also logarithmic (refer to
		<cnxn document="m15439">Perception of Sound</cnxn> and review the section on intensity perception). In this part you will design your amplitude trajectory in "log space," but now using traditional decibels (dB). An intensity trajectory can be converted to amplitude by "undoing" the equation that relates a value to the same value expressed in decibels:
<m:math>
 <m:semantics>
  <m:mrow>
   <m:msub>
    <m:mi>X</m:mi>
    <m:mrow>
     <m:mtext>dB</m:mtext>
    </m:mrow>
   </m:msub>
   <m:mo>=</m:mo><m:mn>20</m:mn><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:mo stretchy="false">(</m:mo><m:mi>X</m:mi><m:mo stretchy="false">)</m:mo>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 </m:annotation>
 </m:semantics>
</m:math>.</para>

<para id="par20">Experiment with your spectrogram display device to learn the intensity-to-color mapping. Specifically, you could produce a sinusoidal signal with increasing intensity values over time, then match up the plotted colors to the known intensity values.
</para>

</section>

<section id="sec21">
<name>Part 4: Spectrogram Art</name>

<para id="par22">
Design a spectrogram picture using multiple frequency/amplitude trajectories. Include your paper-and-pencil drawing of the spectrogram as part of your deliverables. Use your creativity to make an interesting and recognizable picture.</para>

<para id="par23">Better designs will go beyond straight lines to include curved lines such as arcs, exponentials, parabolas, sinusoids, polynomials, spline interpolations, and so on.</para>

<para id="par24">Include a .wav file of the sound associated with your spectrogram picture.
</para>

</section>

</content>
</document>
