Help with frequencies!

Hello everyone.

Currently working on a color organ build and i am using the MSGEQ7 ic.

Here is the data sheet. https://www.sparkfun.com/datasheets/Components/General/MSGEQ7.pdf

This chip breaks the audio input into 7 frequency bins.

I would only like to split the sound up into bass, mid, and high (treble).

If you refer to the graph on the data sheet, you'll see that there is a bit of overlap on these different bins.

What I am trying to figure out is how to combine the bottom 2 bins, the middle 3 bins, and the top 2 bins. I can't tell if I am just overthinking it, or what the solution is.

Any suggestions would be greatly appreciated.

I would start by averaging them. Add the bottom two together and divide by two, add the next three and divide by three etc.
If that doesn't give you what you want, you might try weighting them. For example, to make the bottom two "lean" more to the higher one, multiply the bottom one by 0.5, multiply the next one by 1.5, add together and divide by two. And do the same kind of thing with the others.

Pete

I was considering doing an average. I just feel as if it's going to mess with the levels a little ya know. When my parts arrive I think I'll just have to trial and error it to see what works best. Thanks for the input.

I just feel as if it's going to mess with the levels a little ya know

Is that not the point of combining two bands?

Averaging or simply summing seems like the best solution. You may have to adjust the sensitivity of the various bands anyway, since there tends to be more energy in the lower frequency range than in the high range.

You might actually get a better visual effect if you use only 3-bands, leaving gaps in-between. I assume you are making an effect rather than to accurately represent the music.

I've make some lighting effects (nothing with the MSGEQ7 or frequency-related) and one trick I use is make it "auto-calibrate". I do that by taking a "reading" once per second and saving it in a 20-element array configured as a circular buffer. (Take a look at the "Smoothing Example".) From that array I can get a maximum or an average to automatically adjust my reference/threshold to the loudness. The maximum isn't the true maximum, since I'm only saving a reading once per second but it's close-enough. For example, one of my effects is a "Giant VU Meter" and the maximum value in the array represents the top (maximum) meter reading... I get good "meter action" with quiet or loud songs, or if I adjust the volume.

In your case, you could make 3 separate auto-calibration levels for lots of "color action". If you set the threshold for each channel at it's own average, you'll get lots of "action" with each light on half the time and off half the time.

A couple of other software suggestions-
If you get bored* with the basic color organ effect, you can make it randomly switch the colors around (so sometimes red represents bass and other times represents treble, etc.) and/or you can randomly invert it (so that loudness turns the lamps off instead of on). i.e. If you independently randomize inversion of the 3-channels, you'll have 8 variations.

  • I got bored with my color ogran in the 1970s. :wink: I converted it to a random-color effect that pops-up a different pattern with each beat. Later, I added a 4th color. That was done without a microcontroller... With the Arduino, I can add do all kinds of random or sequencing/chasing effects, etc.

DVDdoug:
Averaging or simply summing seems like the best solution. You may have to adjust the sensitivity of the various bands anyway, since there tends to be more energy in the lower frequency range than in the high range.

You might actually get a better visual effect if you use only 3-bands, leaving gaps in-between. I assume you are making an effect rather than to accurately represent the music.

I've make some lighting effects (nothing with the MSGEQ7 or frequency-related) and one trick I use is make it "auto-calibrate". I do that by taking a "reading" once per second and saving it in a 20-element array configured as a circular buffer. (Take a look at the "Smoothing Example".) From that array I can get a maximum or an average to automatically adjust my reference/threshold to the loudness. The maximum isn't the true maximum, since I'm only saving a reading once per second but it's close-enough. For example, one of my effects is a "Giant VU Meter" and the maximum value in the array represents the top (maximum) meter reading... I get good "meter action" with quiet or loud songs, or if I adjust the volume.

In your case, you could make 3 separate auto-calibration levels for lots of "color action". If you set the threshold for each channel at it's own average, you'll get lots of "action" with each light on half the time and off half the time.

A couple of other software suggestions-
If you get bored* with the basic color organ effect, you can make it randomly switch the colors around (so sometimes red represents bass and other times represents treble, etc.) and/or you can randomly invert it (so that loudness turns the lamps off instead of on). i.e. If you independently randomize inversion of the 3-channels, you'll have 8 variations.

  • I got bored with my color ogran in the 1970s. :wink: I converted it to a random-color effect that pops-up a different pattern with each beat. Later, I added a 4th color. That was done without a microcontroller... With the Arduino, I can add do all kinds of random or sequencing/chasing effects, etc.

You sir, have set off an explosion of ideas in my brain.

Since I may never meet a color organ guru such as yourself again, I figure I should pick your brain. :slight_smile:

So I have a couple questions:

1.) The calibration you're referring to.

I have been trying to think of a way to solve this problem for a couple days now, considering doing one of those auto gain circuits or whatever they are called, but your idea sounds a lot better. Just wondering if I am understanding it correctly. For example, the output of the ic I am using is a number between 0 and 1024 for each of the 7 bands. You suggest taking a periodic measurement of these values and if for a while the values for one band didn't reach above 300, 300 would become the new maximum?

2.) Could you describe the chasing idea? Specifically, how I could approach this problem, and the type of code (basic idea) to achieve such an effect.

If it helps, I'm using the ic aforementioned, an arduino Leonardo, leds, transistors, and such.

The arduino simply just writes a pwm to the base of the transistor to control the leds.

As far as the leds go, I've ordered 6 red diodes, 6 blue, and 6 green.

Planning on setting them up in groups of three, so 6 groups total, having 2 for bass, 2 for mid, and 2 for treble. Any input or suggestions?