Bandpass filters for color organ

Started by Ord Millar October 17, 2011
Hello all,

I am working on a project that plays MP3 or WAV files, and part of it
involved having LED's that vary in intensity according to the audio
level in 4 bands.

The bands are to be adjustable by the user during operation. There is
no need for great precision, but I will need to keep the bands
relatively constant even if a file at a different sample rate is
played.

I have read all I can find about other people who have done this, and
they either used a FFT or some type of digital filter. The FFT seems
like it will take a lot of data memory - I will have only about 2K of
code space and 4K of ram free after the other functions are loaded.
Also, as I understand it the spectrum is divided into equal bandwidth
buckets, but for my application it would probably be best to have
smaller bandwidth at the lower frequencies.

Filtering seems like it would be less calculation, but I am not sure
what is involved in calculating the values at run time based on the
sample rate and center frequency - all the filter design software I
have found assumes a constant sample rate and filter frequency.

Can anyone point me in the right direction?

Thanks,

Ord
Hi,

Some time ago I had to dinamically calculate filter coefficients of very simple user configurable audio filters. I guess it was something similar to what you want to implement. I got the theory from this book which is quite good and simple:

http://www.amazon.com/Digital-Signal-Processing-Primer-Applications/dp/0805316841

Regrads
Juan
----- Original Message -----
From: Ord Millar
To: a...
Sent: Tuesday, October 11, 2011 11:16 PM
Subject: [audiodsp] Bandpass filters for color organ

Hello all,

I am working on a project that plays MP3 or WAV files, and part of it
involved having LED's that vary in intensity according to the audio
level in 4 bands.

The bands are to be adjustable by the user during operation. There is
no need for great precision, but I will need to keep the bands
relatively constant even if a file at a different sample rate is
played.

I have read all I can find about other people who have done this, and
they either used a FFT or some type of digital filter. The FFT seems
like it will take a lot of data memory - I will have only about 2K of
code space and 4K of ram free after the other functions are loaded.
Also, as I understand it the spectrum is divided into equal bandwidth
buckets, but for my application it would probably be best to have
smaller bandwidth at the lower frequencies.

Filtering seems like it would be less calculation, but I am not sure
what is involved in calculating the values at run time based on the
sample rate and center frequency - all the filter design software I
have found assumes a constant sample rate and filter frequency.

Can anyone point me in the right direction?

Thanks,

Ord
In case of mp3 decoding, you decode MDCT co-efficients. if you dont need
high precision, you can directly use a combination these for LED. no
filters, no FFT.

.

On Tue, Oct 11, 2011 at 4:16 PM, Ord Millar wrote:

> **
> Hello all,
>
> I am working on a project that plays MP3 or WAV files, and part of it
> involved having LED's that vary in intensity according to the audio
> level in 4 bands.
>
> The bands are to be adjustable by the user during operation. There is
> no need for great precision, but I will need to keep the bands
> relatively constant even if a file at a different sample rate is
> played.
>
> I have read all I can find about other people who have done this, and
> they either used a FFT or some type of digital filter. The FFT seems
> like it will take a lot of data memory - I will have only about 2K of
> code space and 4K of ram free after the other functions are loaded.
> Also, as I understand it the spectrum is divided into equal bandwidth
> buckets, but for my application it would probably be best to have
> smaller bandwidth at the lower frequencies.
>
> Filtering seems like it would be less calculation, but I am not sure
> what is involved in calculating the values at run time based on the
> sample rate and center frequency - all the filter design software I
> have found assumes a constant sample rate and filter frequency.
>
> Can anyone point me in the right direction?
>
> Thanks,
>
> Ord
>
>
http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt

I've used this numerous times to get biquad filter coefficients. You can
use the band pass filter equations and calculate the coefficients at run
time with your user selected center frequency

Baek

On Tue, Oct 11, 2011 at 2:16 PM, Ord Millar wrote:

> **
> Hello all,
>
> I am working on a project that plays MP3 or WAV files, and part of it
> involved having LED's that vary in intensity according to the audio
> level in 4 bands.
>
> The bands are to be adjustable by the user during operation. There is
> no need for great precision, but I will need to keep the bands
> relatively constant even if a file at a different sample rate is
> played.
>
> I have read all I can find about other people who have done this, and
> they either used a FFT or some type of digital filter. The FFT seems
> like it will take a lot of data memory - I will have only about 2K of
> code space and 4K of ram free after the other functions are loaded.
> Also, as I understand it the spectrum is divided into equal bandwidth
> buckets, but for my application it would probably be best to have
> smaller bandwidth at the lower frequencies.
>
> Filtering seems like it would be less calculation, but I am not sure
> what is involved in calculating the values at run time based on the
> sample rate and center frequency - all the filter design software I
> have found assumes a constant sample rate and filter frequency.
>
> Can anyone point me in the right direction?
>
> Thanks,
>
> Ord
>
>

--
-baeksanchang
Thanks Pradeep. Unfortunately, I cannot use this method because of where my
filter gets installed - I only receive the stream of decoded samples on
their way to the DAC buffer, and don't have access to the decoding
coefficients. This is to be a plug in that gets installed in a VS1053
decoder.

On Mon, Oct 17, 2011 at 11:05 AM, Pradeep Hegde wrote:

>
> In case of mp3 decoding, you decode MDCT co-efficients. if you dont need
> high precision, you can directly use a combination these for LED. no
> filters, no FFT.
>
> .
>
> On Tue, Oct 11, 2011 at 4:16 PM, Ord Millar wrote:
>
>> **
>> Hello all,
>>
>> I am working on a project that plays MP3 or WAV files, and part of it
>> involved having LED's that vary in intensity according to the audio
>> level in 4 bands.
>>
>> The bands are to be adjustable by the user during operation. There is
>> no need for great precision, but I will need to keep the bands
>> relatively constant even if a file at a different sample rate is
>> played.
>>
>> I have read all I can find about other people who have done this, and
>> they either used a FFT or some type of digital filter. The FFT seems
>> like it will take a lot of data memory - I will have only about 2K of
>> code space and 4K of ram free after the other functions are loaded.
>> Also, as I understand it the spectrum is divided into equal bandwidth
>> buckets, but for my application it would probably be best to have
>> smaller bandwidth at the lower frequencies.
>>
>> Filtering seems like it would be less calculation, but I am not sure
>> what is involved in calculating the values at run time based on the
>> sample rate and center frequency - all the filter design software I
>> have found assumes a constant sample rate and filter frequency.
>>
>> Can anyone point me in the right direction?
>>
>> Thanks,
>>
>> Ord
>>
>>
Thanks! This is pretty much exactly what I was looking for.

On Mon, Oct 17, 2011 at 1:18 PM, Baek Chang wrote:

> http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
>
> I've used this numerous times to get biquad filter coefficients. You can
> use the band pass filter equations and calculate the coefficients at run
> time with your user selected center frequency
>
> Baek
>
> On Tue, Oct 11, 2011 at 2:16 PM, Ord Millar wrote:
>
>> **
>> Hello all,
>>
>> I am working on a project that plays MP3 or WAV files, and part of it
>> involved having LED's that vary in intensity according to the audio
>> level in 4 bands.
>>
>> The bands are to be adjustable by the user during operation. There is
>> no need for great precision, but I will need to keep the bands
>> relatively constant even if a file at a different sample rate is
>> played.
>>
>> I have read all I can find about other people who have done this, and
>> they either used a FFT or some type of digital filter. The FFT seems
>> like it will take a lot of data memory - I will have only about 2K of
>> code space and 4K of ram free after the other functions are loaded.
>> Also, as I understand it the spectrum is divided into equal bandwidth
>> buckets, but for my application it would probably be best to have
>> smaller bandwidth at the lower frequencies.
>>
>> Filtering seems like it would be less calculation, but I am not sure
>> what is involved in calculating the values at run time based on the
>> sample rate and center frequency - all the filter design software I
>> have found assumes a constant sample rate and filter frequency.
>>
>> Can anyone point me in the right direction?
>>
>> Thanks,
>>
>> Ord
>>
>> --
> -baeksanchang
>