A.6.1 simple tones, A.6.2 simple player, A.6.1 – Sun Microsystems J2ME User Manual

Page 100: Simple tones, A.6.2, Simple player

Advertising
background image

88

J2ME Wireless Toolkit User’s Guide • October 2004

A.6.1

Simple Tones

The Simple Tones example demonstrates how to use interactive synthetic tones.
The first menu entries play tones with different pitch and duration using

Manager.playTone()

. Choosing the third menu item will play a chord on the

interactive MIDI device (locator

"device://midi"

). The

shortMidiEvent()

method of

MIDIControl

is used to trigger the notes of the chord.

A.6.2

Simple Player

The Simple Player application demonstrates the range of audio and video
capabilities of the emulator. It includes example files in a variety of formats and
can play files from the emulator's persistent storage or from HTTP URLs.

The player portion uses a generic

javax.microedition.media.Player

interface. The player displays duration, media time, and controls for running the
media file. If metadata is available in a file, the player enables you to view the
information, such as author and title. In the case of MIDI files, if karaoke text is
present in the file, it displays on the screen during play. Graphical user interface
controls can be viewed on the display screen if applicable. You can access these
controls by selecting one of the media samples in Simple Player, then pressing the
Menu

button to view and select the desired command.

The demo includes the following media samples:

Bong

plays a short WAV file. You can adjust certain playback features, as

described later in this document. The display shows the duration of the sound in
minutes:seconds:tenths of a second, for example 00:17:5. This audio sample is a
resource file in the MIDlet suite JAR file.

MIDI Scale

plays an example musical scale. The display shows the title of the

selected music file, the duration of the song, the elapsed time during playback,
and the current tempo in beats per minute (bpm). This MIDI file is stored in the
MIDlet suite JAR file.

Simple Ring Tone

plays a short sequence of Beethoven's Fifth Symphony.

The display shows the title of the selected music file, the duration of the song,
the elapsed time in seconds and tenths of a second during playback, and the
current tempo in beats per minute (bpm). This ringtone file (

.jts

format) is

stored in the MIDlet suite JAR file.

WAV Music

plays a brief audio file. The display shows the title of the audio file,

the duration of the audio the elapsed time during playback, and the playback
rate in percent. This WAV file is retrieved from an HTTP server.

MIDI Scale

plays a MIDI file that is retrieved from an HTTP server.

The

Animated GIF

example shows an animated GIF that counts from 1 to 5.

The file is stored in the MIDlet suite JAR.

Audio Capture

from a default device lets you capture audio from the

microphone or connected device. The sound is captured and played back on the
speaker. To avoid feedback, use a headset.

Advertising