The Java Media API In Practice
In my last article, I described the contents of Media API in MIDP 2.0 and gave some simple examples of how to use it. This time, I show you how to design and add sounds into applications.
Although adding sounds to any application can make the user's experience more pleasant, the sounds must be well designed and suit the nature of the application. And the user should always be able to turn sounds off.
First, you'll get a brief look at sound design; then you'll add sounds to an existing game. You also learn about the game in general and discover some sources for further reading.
Designing Sounds for Applications
Adding sounds to a game requires some design, and there are various places where sound or music is desired or reasonable:
When browsing the menus
During game play (the music can change when the player gets to the upper levels)
When something happens (collisions, explosions, rocket fire, and so on)
At the end
A good game requires at least one good theme or melody, and composing the melody might be the most difficult part of adding music to your application. On the other hand, composing your first theme or melody might also make a very interesting night or weekend for you.
The Media API is part of MIDP 2.0, so all devices that have MIDP 2.0 have to implement it. But this doesn't mean that all media types (such as MIDI, WAV, and MP3) are necessarily supported. So always remember to check the support or include the music (or sounds) in a very safe format (such as tone sequences).