Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove background noise from a WAV file in iPhone [closed]

Tags:

c++

c

iphone

I have a recorded WAV file. I want to remove the background noise and separate the speech alone. Is there any C/C++ code available for achieving that, so I can integrate in my project?

I have downloaded a code from Audacity but unable to integrate it. Is there is any third party library or C/C++ code available?

like image 893
Warrior Avatar asked Feb 26 '23 20:02

Warrior


1 Answers

You can do it yourself. Read about FIR and IIR filters. They are easy to implement in code (just some multiplications of current sample with weighted values of past samples from filter input and output).

Just to give you some head-start:

y(n) = b(1)*x(n) + b(2)*x(n-1) + ... + b(nb+1)*x(n-nb)
                 - a(2)*y(n-1) - ... - a(na+1)*y(n-na)

Above is the algorithm for IIR or FIR filter. y(n) is the filter output (filtered signal) x(n) is the input (your raw sound data), b and a are the filter coefs. You can find them in table form (for many different filter types and cut-off freqs).

If you still find it problematic, here you can design your own filter and the website will spit the code in the form I gave you above. You just implement it in your program and you're done.

http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html

From the site above, Butterworth LP filter with cutoff at 6kHz for a signal scanned at 46.1kHz (typical computer sound sampling frequency if I remember well):

y[n] = (  1 * x[n- 2])
     + (  2 * x[n- 1])
     + (  1 * x[n- 0])

     + ( -0.3193306290 * y[n- 2])
     + (  0.9022259824 * y[n- 1])

Have fun!

like image 89
bor Avatar answered Mar 07 '23 00:03

bor