C language project on convolution

Discussion in 'The Projects Forum' started by kenny-one, Jun 28, 2011.

  1. kenny-one

    Thread Starter Member

    Apr 21, 2010
    37
    0
    I am working on this project right now in which I want to convolve two audio files together into one and then filter any noise in it using c programming language.

    For example, I have an audio file of a person speaking, and then I have a filter audio file from a parking garage, and I convolve them together to make it sound like the person is speaking inside of a parking garage.

    Any ideas of how to begin with this project?
    thanks.
     
  2. russpatterson

    Member

    Feb 1, 2010
    351
    16
    I did some convolving for filtering noise from an optical heart rate monitor. Fun stuff. Adding two sounds together is easy. Make sure both audio files are sampled at the same rate and bit depth (e.g. both sampled at 16 bit, 20Khz). If they're not use a program like Audacity (get to know this free program) and make change them to be the same sample rate. I'd also make both of them mono to make things easier.

    Then just fopen() the files, read them in a sample at a time (byte for 8bit sample, two bytes for 16 bit, etc.). Then apply your formula/function. If you were just mixing them it would be: add the two samples together and divide by two. Make sure the variable you store the sum in is big enough so it doesn't overflow when you add them together.

    There's a decent article here: http://en.wikipedia.org/wiki/Convolution
     
Loading...