Thursday, October 13, 2011

Convolution of Two .wav Sound Files in Linux and Matlab

Convolution is the very basic and main operation in Signal Processing. My professor said that Convolution is the heart of signal processing. If we has two .wav sound files how to convolute them?

In Linux, first download the bash file here. Then follow the instruction below,

1. Ubuntu and other distribution> Unzip and untar the download by typing 
    $ gunzip fconv.tar.gz
    $ tar -xvf fconv.tar
    
2. If you are in the same directory as the program, it will run. Just type "fconv" at the command line. SLACKWARE INSTALLATION:
1. Unzip and untar the download by typing
       gunzip fconv.tar.gz
       tar -xvf fconv.tar
    
2. Verify that there is no file or folder in your computer's /usr/local/bin directory with the name fconv. If the file or folder does exist, give the file you just untarred a new name. If you don't /usr/local/bin/fconv will be destroyed in the following steps.
3. Change to root.
4. Type:
       cp fconv /usr/local/bin
       chmod 0755 /usr/local/bin/fconv
       exit
    
5. cd to another directory and type "fconv" to test it. If you see "FCONV: Fast Convolution" then the program is installed properly.

The next is how to use the code. Refer to code below for example how to use the program/code.

1. To implement a simple filter type,
 fconv filter.wav soundIn.wav soundOut.wav 
The filter "filter.wav" will be applied to the file "soundIn.wav.". The output file will be written to disk with the name "soundOut.wav."
2. The output of fconv is automatically normalized to 0 dB. To normalize the output to some other value type,
   fconv filter.wav soundIn.wav soundOut.wav -norm 50 
This will normalize the output to 50%. Likewise to normalize the output to -3 dB one would type,
  fconv filter.wav soundIn.wav soundOut.wav -norm -3 
3. FCONV will also write .WAV files at bit depths other than that of the input files. To set the output to 24 bits type,
   fconv filter.wav soundIn.wav soundOut.wav -bits 24 
For Matlab, you can download the code here. Put the code in your matlab directory and type "help fconv" at the Matlab command prompt.
Related Posts Plugin for WordPress, Blogger...