0

MAX9814 - Sound Analyzing?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

MAX9814 - Sound Analyzing?

by awleonard1 on Wed Sep 20, 2017 3:41 pm

I'm trying to wrap my head around the sample program. I understand we take a 50 ms sample of data and then find the max/min values and call the difference the peak to peak value. So, what does that mean exactly? I'm working on a sound to light box to make Christmas tree lights flash to Christmas music (I know, I know...how original, right?). It is working. I made a zero cross box and use that to control a triac via an optocoupler. I just got to wondering about the data and how best to sync it to the lights. Why not just find the max value and use that? I've never analyzed audio, so I'm not really up on the terms or the angles of attack. Also looking at the "sound sensors" out there and the MSGEQ7 chips for 7 band frequency analysis for future projects. For this, I just thought it would be fun to have a couple of strings of lights on the tree flashing to the music - Merry Disco Christmas! ha!

Thanks,

Tony
awleonard1
 
Posts: 21
Joined: Wed Jul 07, 2010 2:17 pm

Re: MAX9814 - Sound Analyzing?

by adafruit_support_bill on Wed Sep 20, 2017 4:10 pm

Why not just find the max value and use that?

The reading for total silence would be at about 1/2 scale (512 on an Arduino). Any sound will be in the form of oscillations around that value. The louder the sound, the wider the oscillation. By subtracting the minimum from the maximum reading, we get the 'peak-to-peak' amplitude of that oscillation.

adafruit_support_bill
 
Posts: 62246
Joined: Sat Feb 07, 2009 10:11 am

Re: MAX9814 - Sound Analyzing?

by awleonard1 on Thu Sep 21, 2017 9:39 am

Thank you. I think I get that. I am pretty ignorant of analyzing sound. Appreciate the help.

Tony
awleonard1
 
Posts: 21
Joined: Wed Jul 07, 2010 2:17 pm

Re: MAX9814 - Sound Analyzing?

by awleonard1 on Mon Oct 09, 2017 11:59 am

So, I've been messing around with the MAX 9814. I am reading the signal and using that to control an AC string of lights (using the PowerSwitch Tail ZC/SSR. Things aren't working well. I tried the cheapie sound sensors that are out there too. I know the ac control is working as I can control the dimming of the lights with a pot. I get some reaction to the sound signal, but not real good. Any ideas? I'm still working on it (this work thing tends to be annoying and get in the way of the fun stuff darn-it!). I think one key item is to properly map the sound signal level to the dim value. I'm using the AC control code that has been out there for a long time - zero cross to an interrupt.

Thanks,

Tony
awleonard1
 
Posts: 21
Joined: Wed Jul 07, 2010 2:17 pm

Re: MAX9814 - Sound Analyzing?

by adafruit_support_bill on Mon Oct 09, 2017 12:30 pm

Please post the code that you have so far - and describe exactly what the symptoms of the problem are.

adafruit_support_bill
 
Posts: 62246
Joined: Sat Feb 07, 2009 10:11 am

Re: MAX9814 - Sound Analyzing?

by awleonard1 on Mon Oct 09, 2017 4:59 pm

Will do. Thanks!

I worked on this last night and made some progress. One thing I think I learned is that this is all happening pretty fast - no time to print to serial or to an LCD. I turned all of that off and that seemed to make things work better. I also figured out that my sound sensor goes low when there is sound above the threshold (LED on board is on) which seems backwards. I also figured out that the LED I was using was connected to a non-PWN pin! So, a few oopsies and lack of knowledge on my part has made things better.

The sound sensor works, but you have to adjust it for the current conditions. Not very practical. I am working on code to use the MAX9814 to see if it works better. It did pretty well with the LED, but I have not connected it to the AC lights yet. I'm wondering if the autogain will be more practical for different situations (placement of mic, sound level, etc.)? Eventually, I'll try and get fancy and analyze the sound and pick out the lower frequencies....someday.

I hated to post code for evaluation that I had not given enough effort to. Don't want to be lazy and use up all my "help cards!"

Thanks again,

Tony
awleonard1
 
Posts: 21
Joined: Wed Jul 07, 2010 2:17 pm

Please be positive and constructive with your questions and comments.