<?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>Band-Limited Pulse Generator</name>
  <metadata>
  <md:version>1.3</md:version>
  <md:created>2007/09/28 10:09:11 GMT-5</md:created>
  <md:revised>2008/03/17 21:35:45.317 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>aliasing</md:keyword>
    <md:keyword>band-limited pulse</md:keyword>
    <md:keyword>LabVIEW</md:keyword>
    <md:keyword>pulse train</md:keyword>
    <md:keyword>subtractive synthesis</md:keyword>
    <md:keyword>truncated Fourier series</md:keyword>
  </md:keywordlist>

  <md:abstract>Subtractive synthesis techniques often require a wideband excitation source such as a pulse train to drive a time-varying digital filter. Traditional rectangular pulses have theoretically infinite bandwidth, and therefore always introduce aliasing noise into the input signal. A band-limited pulse (BLP) source is free of aliasing problems, and is more suitable for subtractive synthesis algorithms. The mathematics of the band-limited pulse is presented, and a LabVIEW VI is developed to implement the BLP source. An audio demonstration is included.</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>Subtractive synthesis</term> techniques apply a filter (usually time-varying) to a 
		wideband excitation source such as noise or a pulse train. The filter 
		shapes the wideband spectrum into the desired spectrum. The excitation/filter technique describes
		the sound-producing mechanism of many types of physical instruments as well as the human voice, making
		subtractive synthesis an attractive method for <term>physical modeling</term> of real instruments.</para>

<para id="par3">		A <term>pulse train</term>, a repetitive series of pulses, provides an excitation source that has
		a perceptible pitch, so in a sense the excitation spectrum is "pre-shaped" before applying it to a filter.
		Many types of musical instruments use some sort of pulse train as an excitation, notably wind instruments such
		as brass (e.g., trumpet, trombone, and tuba) and woodwinds (e.g., clarinet, saxophone, oboe, and bassoon). Likewise, the human
		voice begins as a series of pulses produced by vocal cord vibrations, which can be considered
		the "excitation signal" to the vocal and nasal tract that acts as a resonant cavity to amplify and filter
		the "signal."</para>

<para id="par4">		Traditional rectangular pulse shapes have significant spectral energy contained in harmonics that extend beyond 
		the <term>folding frequency</term> (half of the sampling frequency). These harmonics are subject to <term>aliasing</term>,
		and are "folded back" into the <term>principal alias</term>, i.e., the spectrum between 0 and
<m:math>
 <m:semantics>
  <m:mrow>
   <m:msub>
    <m:mi>f</m:mi>
    <m:mi>s</m:mi>
   </m:msub>
   <m:mo>/</m:mo><m:mn>2</m:mn>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 </m:annotation>
 </m:semantics>
</m:math>. The aliased harmonics are distinctly audible as high-frequency tones that, since undesired, qualify as noise.</para>

<para id="par5">		The <term>band-limited pulse</term>, however, is free of aliasing problems because its maximum harmonic can be
		chosen to be below the folding frequency. In this module the mathematics of the band-limited pulse are
		developed, and a band-limited pulse generator is implemented in LabVIEW.
</para>

</section>

<section id="sec6">
<name>Mathematical Development of the Band-Limited Pulse</name>

<para id="par7">
		By definition, a <term>band-limited pulse</term> has zero spectral energy beyond some determined frequency.
		You can use a truncated Fourier series to create a series of harmonics, or sinusoids, as in 
		<cnxn target="eqn-fs"/>:
</para>

<equation id="eqn-fs">



<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:mo>=</m:mo><m:mstyle displaystyle="true">
    <m:munderover>
     <m:mo>∑</m:mo>
     <m:mrow>
      <m:mi>k</m:mi><m:mo>=</m:mo><m:mn>1</m:mn>
     </m:mrow>
     <m:mi>N</m:mi>
    </m:munderover>
    <m:mrow>
     <m:mi>sin</m:mi><m:mo>⁡</m:mo><m:mo stretchy="false">(</m:mo><m:mn>2</m:mn><m:mi>π</m:mi><m:mi>k</m:mi><m:msub>
      <m:mi>f</m:mi>
      <m:mn>0</m:mn>
     </m:msub>
     <m:mi>t</m:mi><m:mo stretchy="false">)</m:mo>
    </m:mrow>
   </m:mstyle>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 MathType@MTEF@5@5@+=feaagaart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamiEaiaacIcacaWG0bGaaiykaiabg2da9maaqahabaGaci4CaiaacMgacaGGUbGaaiikaiaaikdacqaHapaCcaWGRbGaamOzamaaBaaaleaacaaIWaaabeaakiaadshacaGGPaaaleaacaWGRbGaeyypa0JaaGymaaqaaiaad6eaa0GaeyyeIuoaaaa@49C4@</m:annotation>
 </m:semantics>
</m:math>

</equation>

<para id="par9">
		The <cnxn target="video-blp-tonenoise"/> screencast video shows how to implement <cnxn target="eqn-fs"/> in LabVIEW by
		introducing the "Tones and Noise" built-in subVI that is part of the "Signal Processing" palette. The video includes a demonstration that relates
		the time-domain pulse shape, spectral behavior, and audible sound of the band-limited pulse. 
</para>

<para id="par10"><media type="image/png" src="LabVIEW.png"/> Download the finished VI from the video: <link src="blp_demo.vi">blp_demo.vi</link>.
		This VI requires installation of the <cnxn document="m15430">TripleDisplay</cnxn> front-panel indicator.
</para>

<figure id="video-blp-tonenoise">
<media type="image/png" src="sub_blp-tonenoise.html">
   <param name="thumbnail" value="sub_blp-tonenoise.png"/>
   </media>
<caption>
   [video] Band-limited pulse generator in LabVIEW using "Tones and Noise" built-in subVI
</caption>
</figure>

<para id="par12">
		The truncated Fourier series approach works fine for off-line or batch-mode signal processing. However, in a real-time
		application the computational cost of generating individual sinusoids becomes prohibitive, especially when a fairly dense spectrum
		is required (for example, 50 sinusoids).</para>

<para id="par13">		A closed-form version of the truncated Fourier series equation is presented in <cnxn target="eqn-closedform"/> (refer to
		Moore in "References" section below):
</para>

<equation id="eqn-closedform">



<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:mo>=</m:mo><m:mstyle displaystyle="true">
    <m:munderover>
     <m:mo>∑</m:mo>
     <m:mrow>
      <m:mi>k</m:mi><m:mo>=</m:mo><m:mn>1</m:mn>
     </m:mrow>
     <m:mi>N</m:mi>
    </m:munderover>
    <m:mrow>
     <m:mi>sin</m:mi><m:mo>⁡</m:mo><m:mo stretchy="false">(</m:mo><m:mi>k</m:mi><m:mi>θ</m:mi><m:mo stretchy="false">)</m:mo><m:mo>=</m:mo><m:mi>sin</m:mi><m:mo>⁡</m:mo><m:mrow><m:mo>[</m:mo> <m:mrow>
      <m:mo stretchy="false">(</m:mo><m:mi>N</m:mi><m:mo>+</m:mo><m:mn>1</m:mn><m:mo stretchy="false">)</m:mo><m:mfrac>
       <m:mi>θ</m:mi>
       <m:mn>2</m:mn>
      </m:mfrac>
     </m:mrow> <m:mo>]</m:mo></m:mrow>
    </m:mrow>
   </m:mstyle><m:mfrac>
    <m:mrow>
     <m:mi>sin</m:mi><m:mo>⁡</m:mo><m:mrow><m:mo>(</m:mo>
      <m:mrow>
       <m:mi>N</m:mi><m:mfrac>
        <m:mi>θ</m:mi>
        <m:mn>2</m:mn>
       </m:mfrac>
      </m:mrow>
     <m:mo>)</m:mo></m:mrow>
    </m:mrow>
    <m:mrow>
     <m:mi>sin</m:mi><m:mo>⁡</m:mo><m:mrow><m:mo>(</m:mo>
      <m:mrow>
       <m:mfrac>
        <m:mi>θ</m:mi>
        <m:mn>2</m:mn>
       </m:mfrac>
      </m:mrow>
     <m:mo>)</m:mo></m:mrow>
    </m:mrow>
   </m:mfrac>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 MathType@MTEF@5@5@+=feaagaart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamiEaiaacIcacaWG0bGaaiykaiabg2da9maaqahabaGaci4CaiaacMgacaGGUbGaaiikaiaadUgacqaH4oqCcaGGPaGaeyypa0Jaci4CaiaacMgacaGGUbWaamWaaeaacaGGOaGaamOtaiabgUcaRiaaigdacaGGPaWaaSaaaeaacqaH4oqCaeaacaaIYaaaaaGaay5waiaaw2faaaWcbaGaam4Aaiabg2da9iaaigdaaeaacaWGobaaniabggHiLdGcdaWcaaqaaiGacohacaGGPbGaaiOBamaabmaabaGaamOtamaalaaabaGaeqiUdehabaGaaGOmaaaaaiaawIcacaGLPaaaaeaaciGGZbGaaiyAaiaac6gadaqadaqaamaalaaabaGaeqiUdehabaGaaGOmaaaaaiaawIcacaGLPaaaaaaaaa@60FB@</m:annotation>
 </m:semantics>
</m:math>

</equation>

<para id="par15">
		where</para>

<para id="par16"><m:math>
 <m:semantics>
  <m:mrow>
   <m:mi>θ</m:mi><m:mo>=</m:mo><m:mn>2</m:mn><m:mi>π</m:mi><m:msub>
    <m:mi>f</m:mi>
    <m:mn>0</m:mn>
   </m:msub>
   <m:mi>t</m:mi>
  </m:mrow>
 <m:annotation encoding="MathType-MTEF">
 MathType@MTEF@5@5@+=feaagaart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYb1uaebbnrfifHhDYfgasaacH8YjY=vipgYlh9vqqj=hEeeu0xXdbba9frFj0=OqFfea0dXdd9vqai=hGuQ8kuc9pgc9q8qqaq=dir=f0=yqaiVgFr0xfr=xfr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaeqiUdeNaeyypa0JaaGOmaiabec8aWjaadAgadaWgaaWcbaGaaGimaaqabaGccaWG0baaaa@3D44@</m:annotation>
 </m:semantics>
 </m:math>. The closed-form version of the summation requires only three sinusoidal oscillators yet can produce an arbitrary number of sinusoidal components.</para>

<para id="par17"> Implementing <cnxn target="eqn-closedform"/> contains one significant challenge, however. Note the ratio of two sinusoids on the far right
 of the equation. The denominator sinusoid periodically passes through zero, leading to a divide-by-zero error. However, because the numerator sinusoid
 operates at a frequency that is N times higher, the numerator sinusoid also approaches zero whenever the lower-frequency denominator sinusoid
 approaches zero. This "0/0" condition converges to either N or -N; the sign can be inferred by looking at adjacent samples.
</para>

</section>

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

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

<item> Moore, F.R., "Elements of Computer Music," Prentice-Hall, 1990, ISBN 0-13-252552-6. </item>

</list>

</section>

</content>
</document>
