NagyI
NagyI

Reputation: 5997

Simple audio filter-bank

I'm new to audio filters so please excuse me if i'm saying something wrong.

I like to write a code which can split up audio stored in PCM samples into two or three frequency bands and do some manipulation (like modifying their audio levels) or analysis on them then reconstruct audio samples from the output.

As far as i read on the internet for this task i could use FFT-IFFT and do manipulation on the complex form or use a time domain based filterbank which for example is used by the MP2 audio encoding format. Maybe a filter-bank is a better choice, at least i read somewhere it can be more CPU usage friendly in real time streaming environments. However i'm having hard times understanding the mathematical stuff behind a filterbank. I'm trying to find some source code (preferably in Java or C/C++) about this topic, so far with no success.

Can somebody provide me tips or links which can get me closer to an example filter bank?

Upvotes: 6

Views: 4180

Answers (3)

Nils Pipenbrinck
Nils Pipenbrinck

Reputation: 86363

Using FFT to split an Audio signal into few bands is overkill.

What you need is one or two Linkwitz-Riley filters. These filters split a signal into a high and low frequency part.

A nice property of this filter is, that if you add the low and high frequency parts you get almost the original signal back. There will be a little bit of phase-shift but the ear will not be able to hear this.

If you need more than two bands you can chain the filters. For example if you want to separate the signal at 100 and 2000Hz it would in pseudo-code somewhat like this:

low  = linkwitz-riley-low (100, input-samples)
temp = linkwitz-riley-high (100, input-samples)

mids = linkwitz-riley-low (2000, temp)
highs = linkwitz-riley-high (2000, temp);

and so on..

After splitting the signal you can for example amplifiy the three output bands: low, mids and highs and later add them together to get your processed signal.

The filter sections itself can be implemented using IIR filters. A google search for "Linkwitz-Riley digital IIR" should give lots of good hits.

http://en.wikipedia.org/wiki/Linkwitz-Riley_filter

Upvotes: 8

Phonon
Phonon

Reputation: 12737

You should look up wavelets, especially Daubechies wavelets. They will let you do the trick, they're FIR filters and they're really short.

Update Downvoting with no explanation isn't cool. Additionally, I'm right. Wavelets are filter banks and their job is to do precisely what is described in the question. IMHO, that is. I've done it many times myself.

Upvotes: 5

Han
Han

Reputation: 2037

There's a lot of filter source code to be found here

Upvotes: 3

Related Questions