Jim's
Tutorials

Spring 2012
course
navigation

Signals and Systems - Final Project

My plan for this project was to create a tool for dynamically creating and testing digital filters. I had originally been picturing a giant user interface with drag and drop block diagram filter creation, which is the reason I decided to go with a web framework. I figured javascript and HTML would be the simplest way to create the graphics I was after. Unfortunately, I was never able to get even close to the graphical interface I wanted, as the project was becoming about 90% about javascript and 10% about digital signal processing. I ended up abandoning the graphical approach entirely, and settled on a simple form based interface. There are two components to the application: the signal generation and the signal filtering. Both are based around the Audiolet audio synthesis library for javascript.
The signal is generated using Audiolet's oscillator objects. The interface allows the creation of any number of parallel sine, triangle, or square wave oscillators of any frequency. Audiolet is running at 44.1 kHz, so in theory the oscillators can be run at up to 22 kHz without aliasing issues.
Audiolet uses a straightforward audio path routing scheme, which makes it fairly simple to create custom nodes to be handled by its router. I created the filters by inheriting from the AudioletNode object, which is provided as a node framework. I've written a finite impulse response filter and an infinite impulse response filter. The interface allows for the dynamic creation of either, and the signal is routed through them in the order they are created.
The finite impulse response filter is defined by the function: \[y[n] = \sum\limits_{i=0}^N c_i x[n-i]\] where \(x\) is the input signal, \(y\) is the output signal, \(c_i\) is a defined coefficient, and \(N\) is the length of the filter including the current sample, that is x[n]. FIR filters are generally described in terms of their order, which is the number of \(Z^{-1}\) shifts or memory registers, which is \(N-1\). Filter coefficients can be calculated given a desired frequency response \(D(\omega)\) using the formula: \[c_i = \frac{1}{2\pi} \int_{-\pi}^{\pi} D(\omega) e^{j\omega i} d\omega\] So, for the simple example of a low-pass filter with a cutoff at \(\omega_c\): \[D(\omega) = \left\{ \begin{array}{11} 1 & \mbox{if } -\omega_c \leq x \leq \omega_c\\ 0 & \text{otherwise} \end{array}\right.\] \[c_i = \frac{1}{2\pi} \int_{-\omega_c}^{\omega_c} e^{j\omega i} d\omega\] And, as the number of coefficients approaches \(\infty\), the filter response approaches the ideal low-pass filter. The FIR filter requires a very large number of coefficients to have anywhere near a smooth response.
The IIR filter is given by the equation: \[y[n] = \sum\limits_{i=0}^N c_i x[n-i] - \sum\limits_{i=0}^M k_i y[n-i] \] where \(x\) is the input signal, \(y\) is the output signal, the \(c\)s are the coefficients of the forward shift register, and the \(k\)s are the coefficients of the feedback shift register. By using negative feedback, the IIR produces a much smoother response than the FIR. It also makes it much more difficult to calculate the coefficients.
The application is HERE and the source files HERE.
Analysis would be the next step for this application. It wouldn't be all that difficult to implement visual analysis using the Audiolet node model, and this will be my next step if I continue with this project.
Resources:
http://cs.marlboro.edu/ courses/ spring2012/jims_tutorials/ alex/ SignalsProject
last modified Monday May 7 2012 10:49 pm EDT