Im trying to get my Raspberry do stuff, based on the audio level of a played song. The song shouldn't neccessarily be a local mp3 file on the Raspberry. Let me explain it like this:

If (audio level above threshold): do something..

I've found this http://freshfoo.com/posts/pulseaudio_monitoring/ and Real time audio input/output in Python with PyAudio which is pretty much what im looking for i guess, but i have to be able, reading single samples in order to compare it with thresholds ill be using. https://stackoverflow.com/questions/604453/analyze-audio-using-fast-fourier-transform is also a topic that could help, if there was a code on how the creater got those numbers. I hope u can help me out with this, for further informations just ask :)

  • 1
    Majority of StackExchange users chime here to read more or less challenging questions and answering them. Very few users, if any, come here to get advice on how to spend their free time by reading articles that someone (like you) read and to ask those users (like you) questions.
    – techraf
    Dec 9, 2016 at 10:51
  • well i see your point but my problem is that i dont have any aproach and all im asking for is if there is any library or function that i can use for my purpose. im sorry if u got me wrong here.. and i also wrote that i could give further information for my question, if needed..
    – Slowmo
    Dec 9, 2016 at 12:01

1 Answer 1


Try sox library, I don't find it necessary to implement your own fft code for that, sox has easy tool for stuff like this, here is the link. https://linux.die.net/man/1/sox you probably just need "silence" but try it with high threshold. If you want to use it in .py file you just need to import a sox implemented library like https://pypi.python.org/pypi/sox

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.