How to measure audio frequecy?

Hey,

for quite a while i was wanting to do a music light show that works with any song, but for now i am trying to find how to read an audio frequency with the LM358 sound module a picture is attached

i have an arduino mega 256.

thanks.

The easiest solution is a [u]MSGEQ7[/u] chip. All of the "work" is done in hardware.

Or you can use FFT or FHT to do it in software. (If you search you can find software libraries so you don't have to write the code yourself, but you will have to study a bit to understand how it works and how to use it.)


...I've done several lighting effects simply using "loudness" and some crude beat detection.

You might want to start with "the worlds simplest effect". It turns the light on whenever the volume is above average (a moving-average) and off whenever it's below average. That gives you lots of "action" because it automatically adjusts to the average loudness (something I do with all of my effects). A simple addition to that basic effect is a second light that works the opposite way (it goes off with loud sounds). And, one of the lights is always on.

Just to give you some ideas, I've made chase-effects that reverse or change-speed with the loudness, an "inverted" chase effect based on a concept called a [u]Johnson Counter[/u]*, a giant VU meter effect, one that pops-up a random pattern with the beat, there's a version of the "Knight Rider" effect, and a few others. I've got enough effects and enough variations (with the same lights) that I don't get bored. For example, the VU meter randomly reverses (so it's upside-down) and/or inverts (so with silence all of the LEDs are on and with loud sounds no LEDs are on). ...All of my effects can reverse or invert.

(Unfortunately, I can't share any of that code with you because my hard drive crashed and that computer wasn't backed-up.)

  • the Johnson Counter logic is done in software with bit-shifting, not in hardware.

I'll try that thanks :slight_smile: