<< Chapter < Page Chapter >> Page >

The actual threshold test are performed by means of a finite state machine. Here is an overview of the FSM :

State diagram

This is the state diagram for the real time Laugh Track Assassinator filter.

As soon as the amplitude threshold for the low-passed signal is met, the filter enters the Possible Laugh state. From here, if the signal falls below the falling amplitude threshold, the machine returns to the Initial State . If the width threshold is reached, then the machine enters the Laugh Detected state, and continually suppress the output audio. During this transition, the last second of audio is also eliminated from the output buffer. Since the filter is delayed by at least 1 second, as long as the width threshold is less than this value, the output will reflect the proper changes. Finally, as soon as the falling amplitude threshold is passed, the machine again returns to its Initial State .

Optimization

The scheme described above generates a working laugh track removal filter. One big problem, however, is speed. Though the above system works on a high-end computer for a real time video signal, any moderate computer will not be able to run it. The chief problem is in the low pass filtering phase.

The low pass filter takes 1000 samples to calculate 1 sample of the low passed signal. This means there are roughly 2000 operations (1000 additions and 1000 multiplications) per sample. With a standard sampling rate of 44.1 kHz, that means the filter uses 44.1 million operations per second. This is generally unacceptable when accounting for the overhead in the filtering process.

To speed the filter up, we must first realize that we do not need an accurate low pass signal value for every sample. In fact, if we took every 1000 samples of the low pass signal, we would only need to perform 2 operations per sample to get the same results. Using this method gives us a speed increase of 1000x by effectively sampling the low pass filter output. Generally, strictly sampling a signal like this produces rather severe aliasing. But, since the signal is already low-pass-filtered, the signal has already gone anti-aliasing processing, and the optimization works out.

Download and installation

The Laugh Track Assassinator filter source code can be downloaded here . The Hamming filter we used can be downloaded here . This is not a complete source listing, but rather the function that handles the actual laughtrack filtering. This code is suitable to be ported to any system that operates on PCM audio streams.

The Laugh Track Assassinator filter can be downloaded here . Since this is implemented as a DirectShow filter, this will only run on Windows-based computers.

To install, follow these steps:

  • Copy the LaughTrackAssassinator.dll file into your C:\Windows\System32 folder.
  • Open a command prompt window (Start->Run->“cmd”).
  • Type “regsvr32 LaughTrackAssassinator.dll” and press enter in the command box.
  • The Laugh Track Assassinator is now registered with DirectShow.

Now that the filter is registered, most any DirectShow based media player should be able to use the filter on any media. We tested the filter with Media Player Classic , a free media player that can be downloaded here . Here are the steps to get it to work:

  • Open Media Player Classic.
  • Go to View->Options->External Filters.
  • Select “Add filter...”.
  • Select the Laugh Track Assassinator from the list of available filters.
  • Select the newly added filter, and select the “Prefer” radio button.

You can now view any media that has audio and it will automatically run the Laugh Track Assassinator . In order to get video back in sync with the audio, you can set the audio delay to 500ms in Media Player Classic by using the + and – keys on the numpad of your keyboard.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Elec 301 projects fall 2007. OpenStax CNX. Dec 22, 2007 Download for free at http://cnx.org/content/col10503/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Elec 301 projects fall 2007' conversation and receive update notifications?

Ask