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 For MIDI audios, I use 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 ...

Get Beginning Android Tablet Games Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.