<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN" "http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="id6881189">
  <name>Primary Detection Methods for Laugh Tracks</name>
  <metadata>
  <md:version>1.2</md:version>
  <md:created>2007/12/16 20:10:07 US/Central</md:created>
  <md:revised>2007/12/19 16:12:35.441 US/Central</md:revised>
  <md:authorlist>
      <md:author id="kwilhelm">
      <md:firstname>Keith</md:firstname>
      
      <md:surname>Wilhelm</md:surname>
      <md:email>kwilhelm@rice.edu</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist>
    <md:maintainer id="kwilhelm">
      <md:firstname>Keith</md:firstname>
      
      <md:surname>Wilhelm</md:surname>
      <md:email>kwilhelm@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="goodhart">
      <md:firstname>Taylor</md:firstname>
      
      <md:surname>Goodhart</md:surname>
      <md:email>goodhart@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="oleg">
      <md:firstname>Oleg</md:firstname>
      
      <md:surname>Pesok</md:surname>
      <md:email>oleg@rice.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist>
    <md:keyword>Canned Laughter</md:keyword>
    <md:keyword>Classification</md:keyword>
    <md:keyword>Filtering</md:keyword>
    <md:keyword>Laugh Track</md:keyword>
    <md:keyword>Signal Analysis</md:keyword>
  </md:keywordlist>

  <md:abstract>This module discusses discusses the primary detection methods used in a real-time laugh track removal system. It is part of a larger series discussing the implementation of this system.</md:abstract>
</metadata>
  <content>
    <section id="id-263901985839">
      <name>Introduction</name>
      <para id="id7291289">Based on the distinct time-domain characteristics of a laugh track, it is possible to use a simple method to detect such sounds. Our primary detection method uses the envelope of the input signal to find laughs.</para>
    </section>
    <section id="id-789596815452">
      <name>Finding the Envelope</name>
      <section id="id-0755998478863">
        <name>Method 1</name>
        <para id="id6878085">We used two methods of finding and smoothing the envelope of the input signal. In the first method, the magnitude of the input signal is fed into a low pass filter and then squared to obtain the envelope. The filter is a 1000-point fir, linear phase filter generated by MATLAB. The method is simple and easy to implement, but not very efficient.</para>
      </section>
      <section id="id-675475778637">
        <name>Method 2</name>
        <para id="id8153360">Another method of finding the envelope of a signal is by using the Hilbert Transform. The Hilbert Transform shifts all the positive frequencies in a signal forward by pi/2 and all the negative frequencies backward by the same amount. The envelope may then be calculated by taking the square root of the sum of the squares of the Hilbert transform and the original signal. The Hilbert Transform is calculated by taking the FFT of the input signal, multiplying the positive frequencies by j and the negative frequencies by –j, and taking the inverse FFT. As in the first method, the envelope needs to be smoothed for further processing by low-pass filtering.</para>
      </section>
    </section>
    <section id="id-371455931254">
      <name>Locating Laughs</name>
      <para id="id5031735">Once the envelope of the signal is found, laughs are detected by a threshold system. The location routine iterates through the samples of the envelope looking for values above a given amplitude threshold. Once this threshold is reached, the routine continues, tracking how long the envelope stays above a second amplitude threshold (lower than the first). If this width reaches a given threshold, the part of the signal from where its envelope rises above the first amplitude threshold to the part where its envelope drops below the second amplitude threshold is flagged as a laugh.</para>
      <figure id="id6771065"><media type="image/png" src="graphics1.png">
          <param name="height" value="302"/>
          <param name="width" value="511"/>
        </media>
      <caption>Original signal with laughs highlighted</caption></figure>
      <figure id="id6726210"><media type="image/png" src="graphics2.png">
          <param name="height" value="358"/>
          <param name="width" value="600"/>
        </media>
      <caption>Envelope of signal with amplitude thresholds</caption></figure>
      <figure id="id7292197"><media type="image/png" src="graphics3.png">
          <param name="height" value="117"/>
          <param name="width" value="600"/>
        </media>
      <caption>Regions of input signal flagged as laughs</caption></figure>
      <figure id="id8131928"><media type="image/png" src="graphics4.png">
          <param name="height" value="369"/>
          <param name="width" value="600"/>
        </media>
      <caption>Signal with laughs removed</caption></figure>
    </section>
    <section id="id-375153204248">
      <name>Results</name>
      <para id="id7120738">Our primary detection method gave us good results for the sound clips we used (sitcoms with audio tracks consisting mostly of dialogue and laughs). It does however have a few shortcomings. This method has trouble detecting laughs of low volume, and tends to cut out other sounds that overlap with the laughs. Additionally, it has trouble finding precisely the beginning and end of laughs, due to variations in the envelope shapes of different laughs. We had very little trouble with false positives in the clips we tested, however more sophisticated methods would be required to distinguish between laughter and other sounds with similar time-domain characteristics (such as applause).</para>
    </section>
  </content>
</document>
