neverenouph2002
Posts: 2
Joined: Sun Sep 23, 2018 8:32 pm

db or noise level of file RPi is playing

Sun Sep 23, 2018 8:40 pm

Hello.

I have a project I am working on where when a sensor is tripped, a random audio file is played (sound effect) and I want to turn on an LED when the sound file reaches a certain db level or noise level. Think ,,,light an LED when a gun shot is played sort of thing. I am currently using python to play the audio file in a callback by using os.system and sending it to mpg123.

The question is, does anyone know of a way to get the db or noise level of a file the raspberry pi is playing? Im sending the sound out the 3.5 jack if that matters.

LTolledo
Posts: 3585
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: db or noise level of file RPi is playing

Sun Sep 23, 2018 10:15 pm

Light up a LED based on sound amplitude?

the closest thing I have in mind is using a VU meter based on LM3914 or LM3915 (for 10 LED) or KA2284 (for 5 LED), using the signal from the audio jack.

have both of those...

a simple transistor circuit to drive a single LED might do the same job.....
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

neverenouph2002
Posts: 2
Joined: Sun Sep 23, 2018 8:32 pm

Re: db or noise level of file RPi is playing

Wed Sep 26, 2018 2:51 am

I could probably get that to work. I was hoping to be able to do it in software so I wouldn't need to add the additional hardware circuit . Thanks.

LTolledo
Posts: 3585
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: db or noise level of file RPi is playing

Wed Sep 26, 2018 11:44 am

neverenouph2002 wrote:
Wed Sep 26, 2018 2:51 am
I could probably get that to work. I was hoping to be able to do it in software so I wouldn't need to add the additional hardware circuit . Thanks.
try this at you favorite search engine
Raspberry Pi sound reactive LEDs
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

Return to “Beginners”