O'Reilly logo

Beginning Android Tablet Games Programming by Jeremy Kerfs

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding Music

Music for Android is exciting. Some interesting technology provides amazing functionality. Before you look into these options, let’s play a MIDI song file during game play. Your old friend the MediaPlayer class performs this perfectly because it’s designed to play all the media files in Android.

Although music is generally longer than a sound effect, and you use a different file format, it’s handled nearly identically to the sound effects in the previous sections.

To get free sound effects, you went to www.freesounds.org. For MIDI audios, I use www.midiworld.com. The site provides a large library of .midi files that you can use in your own creations. Under the Pop category, I found “Take a Chance on Me” by ABBA. Let’s add it to your ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required