2
votes

What is difference between Sound and Music types in LibGDX? This worked both on desktop and Android:

Music gameMusic = Gdx.audio.newMusic(Gdx.files.internal("sound/gamemusic.mp3"));
gameMusic.play();:

Sound gameMusic = Gdx.audio.newSound(Gdx.files.internal("sound/gamemusic.mp3"));
gameMusic.play();
1

1 Answers

5
votes

Music is streamed, while Sound is loaded into memory. (Because Android with libgdx has limit of 1mb file for 'sound', Music can be of greater size)

It is said so here:

https://github.com/libgdx/libgdx/wiki/Sound-effects

https://github.com/libgdx/libgdx/wiki/Streaming-music

And according to another question on SO, you must wait a frame before you can play a Sound directly after loading: No Sound in Android Application with Libgdx