Home > Articles > Programming > Java

Adding Sound to Applications with the MIDP 2.0 Media API

  • Print
  • + Share This
With the MIDP 2.0 Media API, you can add sound to your games and other applications, playing tones, tone sequences, and different kinds of audio in MIDP devices.
Like this article? We recommend

Like this article? We recommend


Almost as soon as the Mobile Information Device Profile (MIDP) 1.0 was out, the first simple video player (by a third party) was also released. It was made for MPEG and wasn't very sophisticated, but it showed that being able to watch and use media (video, in this case), was something that interested developers. But this early video player wasn't designed for developers, so anyone who wanted to use video in his software had to either copy the code (ethically questionable) or write all the routines himself. The need for an API was obvious, but creating it only for video wouldn't have accomplished much for the effort of creating the code.

When the Mobile Media API (MMAPI) Expert Group started to work on the concept of mobile media, they needed to provide media capabilities for very different kinds of devices, ranging from simple cell phones to PDAs and Web tablets. As a result, they ended up with two distinct API sets:

  • Mobile Media API (MMAPI), designed for devices with advanced sound and multimedia capabilities

  • MIDP 2.0 Media API, intended for more restricted devices (audio only)

After the history related above, it may seem amusing that the first version of the API doesn't support video at all, but there's a good reason: Some MIDP devices have very restricted memory and processor capabilities.

The requirements for the MIDP 2.0 Media API were quite easy to outline. It had to provide support for all of the following:

  • Generation of tone sequences

  • Low-footprint audio

  • Basic controls such as start, stop, pause, and so on

  • Media-specific controls such as volume

  • Capability queries

The MIDP 2.0 Media API lets you create and play simple melodies (tone sequences) and some sort of audio. The first sounds that usually come to mind when thinking about cell phones and simple music are ring tones, but the API has the same restrictions as the whole concept of MIDP: It has to stay inside the Java environment, so you can't compose new ring tones for your phone. But for games and other applications that need more sophisticated sound than a beep, the API offers great advantages.

  • + Share This
  • 🔖 Save To Your Account