Dragomirus
Dragomirus

Reputation: 449

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.

Upvotes: 2

Views: 584

Answers (2)

jevon
jevon

Reputation: 3274

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 😂

Upvotes: 0

m.antkowicz
m.antkowicz

Reputation: 13581

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)

Upvotes: 4

Related Questions