Create a decibel meter for my game. Please

Hi guys!
I am currently creating a game with a background with music rythm.
So i want to calculate amplitude/decibel value from a mp3 file.
I am currently playing music with SDL2_mixer engine. But if i can't do this with sdl2, i will use another engine.
Please help
You can use ffmpeg to determine max_volume and mean_volume:
ffmpeg -i sample.mp3 -af volumedetect -f null /dev/null

Another way would be to decode mp3 files to wav. It's not hard to find description of wav format.
Example of parsing wav file in C:
http://truelogic.org/wordpress/2015/09/04/parsing-a-wav-file-in-c/
You need data_in_channel variable - it's an amplitude of audio sample.




Topic archived. No new replies allowed.