Archive for the 'j2me sound' Category

Playing local MP3

The method below creates player and play mp3 file.public void run(){ try { InputStream is = getClass().getResourceAsStream(”/your.mp3″); player = Manager.createPlayer(is,”audio/mpeg”);
player.realize(); // get volume control for player and set volume to max vc = (VolumeControl) player.getControl(”VolumeControl”); […]

Play Sound in midlet

javax.microedition.media package is introduced in MIDP2.0 profile. This package supports sound and upward compatibility with MultiMedia API.It has Manager, Player and Control as main objects.Different audio files, from various locations can be played on mobile.
Simple Media Playback try { Player p = Manager.createPlayer(”http://webserver/music.wav”); p.start(); […]