1
votes

I have an app which plays music (mp3) from a server, created playlists etc.

The problem is that the sound/volume/db of some songs is higher or lower than others... Thus i am looking into a way to implement a DSP (Digital Sound Processing) into my app while playing music. I need a Sound Compressor which lowers the db output if this goes beyond a threshold or increases the db output if it is under some threshold.

Does anyone have an idea how this could be done??? I found some DSP app on Google Play so it is possible but how to implement it?

I found a possible solution called "Automatic Gain Control" which should actually do this but as i read it, it is meant for the INPUT sound while recording and not OUTPUT as with playing a song from server!

Any ideas, suggestions, examples?

Thanks

1

1 Answers

0
votes

There is a built-in LoudnessEnhancer effect starting from Android KitKat. It will compress sounds that otherwise would clip with the specified gain setting. See the docs, and here is an example.

Probably, the solution you are looking for is called "Replay Gain", and it uses tags embedded into mp3 files for matching the resulting sound levels. So your player can lower the gain for tracks that are louder than needed, and increase gain for silent tracks. And with LoudnessEnhancer in place, you should not be experiencing clipping. Thus you don't actually need to implement any DSP code yourself.