Search code examples
audiolibgdx

Libgdx music/sound effect with reverb


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.


Solution

  • 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

      1. making copy of sound
      2. slowering it a little
      3. lowering the volume
      4. 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)