Git Product home page Git Product logo

biquad-filter's Introduction

Biquad Filter

Course: CSCB09: Software Tools and Systems Programming Summer 2019

Professor: Albert Lai

Assignment: 3

An implementation of a biquad filter that suppresses high frequencies while preserving low frequencies using Unix pipes to chain program instances together.

Graph

Plotted with gnuplot showing the frequencies of the "ugly.wav" file pre-filtering (ugly.txt), and the resulting suppression of high frequencies as "out.wav" (out.txt).

Files

Work supplied by, and credited to Professor Albert Lai:

  • towav.c
    • converts WAV files to readable input for the program
  • unwav.c
    • converts output of program to a WAV file
  • ugly.wav
    • starting frequency to work with
  • All shell commands and pipelines

Personal Work

  • biquad.c
    • an implementation of the difference equation given by :

      Difference Equation

  • cascade.c
    • utilizes biquad.c to create multiple pipelines of biquad.c for use in filtering
  • run.sh
    • a file created from provided commands for ease of compiling

Compilation

To run the files, I have created a small shell script to ease the compiling process.

Options

-b runs the biquad pipeline

-c runs the cascade file

-g graphs the plot above (requires gnuplot installation)

E.g.

$ ./run.sh -b

Notes about the file compilation and compiling separately with different arguments is provided below, this script is only for working with the ugly.wav file we are provided here.

About Compilation

Requires a C compiler and *nix Environment before you can play around with arguments

Listen to ugly.wav

Compilation with GCC compiler:

$ gcc biquad.c -o biquad
$ gcc cascade.c -o cascade
$ gcc towav.c -o towav
$ gcc unwav.c -o unwav

Piping biquad instances:

$ ./unwav < ugly.wav | ./biquad 1 0 1 -0.7 0 | ./biquad 1 1.18 1 -1.58 0.81 | ./biquad 4.42e-3 1 0 0 0 | ./towav > out.wav

Then listen to out.wav and see if you can spot the frequency difference!

Alternatively, we can use cascade.c to implement the pipeline instead which will create the same result:

$ ./unwav < ugly.wav | ./cascade 1 0 1 -0.7 0 1 1.18 1 -1.58 0.81 4.42e-3 1 0 0 0 | ./towav > out.wav

The plot in the first section was generated by:

$ ./unwav < ugly.wav | head -300 > ugly.txt
$ ./unwav < out.wav | head -300 > out.txt
$ 
$ gnuplot
$ plot 'ugly.txt' with lines, 'out.txt' with lines

biquad-filter's People

Contributors

eric-li18 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.