Is it possible to add specific reverb to my sound effect/music track in libgdx? I want to add outdoor/indoor reverb to make all tracks sounded the same.
2 Answers
I don't think that Libgdx has a mechanism to adding effects to sound. The Sound class delivers no function for this.
I see three solutions here:
- Prepare two kinds of sounds (one with reverb one without - it is easy to do using software like Audacity - and play one or another due to environment of player's current being
Try to implement it yourself
I see that in the Sound class there is
setPitch(long soundId, float pitch)
method. Due to Wikipedia the reverb is just a kind of echo so maybe (but not for sure) you could achieve the effect by- making copy of sound
- slowering it a little
- lowering the volume
- playing simultaneously with original sound
- Find 3rd part library that will do it for you - the Google returns some examples of libs working with libgdx like SoundTouch Audio Processing Library - maybe you will find something usefull
First one is the easiest and if you are not afraid of space problems I would strongly recommend it to you (althought why not to try implementing it)
-
If you know Pure data, there is a recent libGDX extension here : github.com/mgsx-dev/gdx-pd– mgsx-devApr 25, 2017 at 20:00
I've implemented reverb, positional audio, and arbitrary filters using OpenAL against the latest libgdx 1.10+/lwjgl 3+ with this demo code, based off of gdx-sfx (which only works with lwjgl 2) and libgdx-audio-effects.
I'd like to promote this into a fully fledged library at some point 😂