×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    30

    What audio formats does J2ME support

    I have some voice audio I want to play through an application, and I was reading that J2ME supports only WAV and MIDI in one of my J2ME books. Is this true? I also read on this forum that it might support AMR and MMF as well. Are these only through manufactuers SDKs?

    What's the scoop with supported audio formats?

  2. #2
    Super Contributor
    Join Date
    Nov 2003
    Location
    Bangalore , India
    Posts
    4,429

    Re: What audio formats does J2ME support

    J2ME supports different formats like WAV, MIDI, AMR, MP3, AAC etc.. Please go through this doc "MIDP: Mobile Media API Support In Nokia Devices
    " available in this link http://www.forum.nokia.com/info/sw.n..._0_en.pdf.html

    Hope this helps!

    Regards
    Gopal

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    30

    Re: What audio formats does J2ME support

    Quote Originally Posted by balagopalks
    J2ME supports different formats like WAV, MIDI, AMR, MP3, AAC etc.. Please go through this doc "MIDP: Mobile Media API Support In Nokia Devices
    " available in this link http://www.forum.nokia.com/info/sw.n..._0_en.pdf.html

    Hope this helps!

    Regards
    Gopal

    Cool thanks!

  4. #4
    Registered User
    Join Date
    Jan 2007
    Posts
    4

    Re: What audio formats does J2ME support

    How come the following program does not play the myown.wav in Carbide.j emulator or in my N70 phone which should support WAVs and many other things.

    Code:
    package kone;
    import javax.microedition.media.control.VolumeControl;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.media.*;
    import java.io.*;
    
    public class Mp3testiMidlet extends MIDlet implements CommandListener {
      static Mp3testiMidlet instance;
      Mp3testiMidlet main; 
      private Command play;
      private Display display;
      private Form mainForm;
      public Mp3testiMidlet() {
      instance = this;
      mainForm = new Form("WAVTest");
      mainForm.setCommandListener(this);
      play = new Command("Play", Command.SCREEN, 0);		
      mainForm.addCommand(play);
      mainForm.addCommand(new Command("Exit", Command.EXIT, 0));		
      mainForm.setCommandListener(this);		
      display = Display.getDisplay(this);
      }
    
      public void startApp() {
        
       display.setCurrent(mainForm);
        
        
      }
      
    
      public void pauseApp() {
      }
    
      public void destroyApp(boolean unconditional) {
      }
      
    public void commandAction(Command c, Displayable d) {		
    
      if (c.getCommandType() == Command.EXIT) {		
    
    notifyDestroyed();		
    
    } else if (c == play) {		
    
    playSound();		
    }		
    
    }
    
      public static void quitApp() {
        instance.destroyApp(true);
        instance.notifyDestroyed();
        instance = null;
      }
      public void playSound()
    {
      try
      {
        InputStream is = getClass().getResourceAsStream("/myown.wav");
        Player player = Manager.createPlayer(is,"audio/x-wav");
        player.setLoopCount(1);
        player.realize();
        // get volume control for player and set volume to max
        VolumeControl vc = (VolumeControl) player.getControl("VolumeControl");
        if(vc != null)
        {
          vc.setLevel(100);
        }
        player.prefetch();
        player.start();
      }
      catch(Exception e)
      {}
    }
    
    }
    Thanks!

  5. #5
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: What audio formats does J2ME support

    Which exception do you get? Is the wav-file included in the JAR-file. Is the wav file a working audio file?

    In the MIDP2 spec it is stated that the implementations "MUST support 8-bit, 8 KHz, mono linear PCM wav format IF any sampled sound support is provided."

    Hartti

  6. #6
    Registered User
    Join Date
    Mar 2004
    Posts
    3

    Re: What audio formats does J2ME support

    Try using:

    System.getProperty("audio.encodings");

    System.getProperty("supports.audio.capture");

    System.getProperty("supports.recording");

    http://stromat.hit.bg

  7. #7
    Registered User
    Join Date
    Sep 2010
    Posts
    3

    Re: What audio formats does J2ME support

    hey..guys..
    I am getting java.lang.IllegalArgumentException while I run the MIDLet
    can anyone tell me why such error occurs.. The wav file is 8-bit, 8 KHz, mono linear PCM wav format.
    Last edited by dhrt; 2010-11-08 at 06:44.

  8. #8
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: What audio formats does J2ME support

    yiou actually called a method and passed a wrong argument, so you should check that out...
    Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them.

  9. #9
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: What audio formats does J2ME support

    Quote Originally Posted by dhrt View Post
    hey..guys..
    I am getting java.lang.IllegalArgumentException while I run the MIDLet
    can anyone tell me why such error occurs.. The wav file is 8-bit, 8 KHz, mono linear PCM wav format.
    You must check that which is the exact line which is the root cause of the exception, kindly put the code inside the proper and appropriate try-catch handler and let us know the code segment.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  10. #10
    Registered User
    Join Date
    Feb 2010
    Posts
    25

    Re: What audio formats does J2ME support

    Hello sir

    Some problem ;

    private AudioPlayer parent;


    public AudioPlayerCanvas(AudioPlayer parent) {
    this.parent = parent;
    form.append(gauge);
    form.addCommand(parent.exitCommand);
    form.addCommand(parent.backCommand);
    form.setCommandListener(parent);

    form.setItemStateListener(this);
    }


    Error:


    cannot find symbol
    symbol : class AudioPlayer
    location: class AudioPlayerCanvas

    private AudioPlayer parent;
    ^
    C:\WTK22\apps\AudioExample\src\J2MEAudioPlayer.java:28: cannot find symbol
    symbol : class AudioPlayer
    location: class AudioPlayerCanvas
    public AudioPlayerCanvas(AudioPlayer parent) {

  11. #11
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: What audio formats does J2ME support

    you did import your AudioPlayer class right ?
    Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them.

  12. #12
    Registered User
    Join Date
    Dec 2010
    Posts
    8

    Re: What audio formats does J2ME support

    hello i got some error in my player code:-(prefetch error : -5)

    import java.io.InputStream;
    import javax.microedition.media.Manager;
    import javax.microedition.media.MediaException;
    import javax.microedition.media.Player;
    import javax.microedition.media.PlayerListener;
    import javax.microedition.midlet.*;

    /**
    * @author Virus99
    */
    public class check extends MIDlet implements PlayerListener {
    private Player player;

    public check(){

    }


    public void startApp() {

    InputStream in1 = null;
    System.out.println("ABout to play voice:");
    try {
    System.out.println("Getting the resource as stream.");
    in1 = getClass().getResourceAsStream("/ashole.wav");
    System.out.println("Got the resouce. Moving to get a player");
    }
    catch(Exception e) {
    e.printStackTrace();
    }
    try {
    try {
    player = Manager.createPlayer(in1, "audio/x-wav");
    System.out.println("Created audio/x-wav player.");
    } catch (MediaException e) {
    player = Manager.createPlayer(in1, "audio/wav");
    System.out.println("Created audio/wav player.");
    }
    player.addPlayerListener(this);
    System.out.println("Created player.");
    int state = player.getState();
    if(state == player.UNREALIZED) {
    System.out.println("System is in unrealized state. Realizing it.");
    try{
    player.realize();
    } catch (MediaException e) {
    System.out.println(e.toString());
    System.out.println("Caught an error in realizing the player.");
    } catch (IllegalStateException e) {
    System.out.println("Illegal state exception thrown.");
    } catch (SecurityException e) {
    System.out.println("Security exception thrown.");
    }
    }
    if(state == player.REALIZED) {
    System.out.println("The player has been realized.");
    player.prefetch();
    System.out.println("The player was prefetched.");
    }
    System.out.println("Fetched player. Now starting to play sound.");
    player.start();
    in1.close();
    }
    catch(Exception e) {
    e.printStackTrace();
    }
    }


    i'm using
    netbeans 6.9.1
    sdk s60 3rd edition FP 2

    and error in detail is:-


    MIDlet: check
    ABout to play voice:
    Getting the resource as stream.
    Got the resouce. Moving to get a player
    JVMJNCK038E JNI error in FromReflectedMethod: Argument #2 (0x3AEBEDD0) is not a valid object reference. It's type is: unknown
    JVMJNCK080E Error detected in the outermost frame of an attached thread
    JVMJNCK023E JNI error detected. Continuing...
    Created audio/x-wav player.
    Created player.
    System is in unrealized state. Realizing it.
    Fetched player. Now starting to play sound.
    javax.microedition.media.MediaException: Prefetch error: -5
    at com.nokia.microedition.media.PlayerImpl.doPrefetch(Unknown Source)
    at com.nokia.microedition.media.SourcePlayer.doPrefetch(Unknown Source)
    at com.nokia.microedition.media.PlayerBase.prefetch(Unknown Source)
    at com.nokia.microedition.media.PlayerImpl.start(Unknown Source)
    at check.startApp(Unknown Source)
    at javax.microedition.midlet.MIDletInvoker.invokeStartApp(MIDletInvoker.java:30)
    at com.symbian.j2me.midp.runtimeV2.Application.startAction(Application.java:518)
    at com.symbian.j2me.midp.runtimeV2.Application.startRequest(Application.java:445)
    at com.symbian.j2me.midp.runtimeV2.Application.event(Application.java:296)
    at com.symbian.j2me.midp.runtimeV2.ApplicationEvent.dispatch(ApplicationEvent.java:90)
    at com.symbian.j2me.midp.runtimeV2.ApplicationThread.run(ApplicationThread.java:30)



    plz any one help me out
    thanx..
    Last edited by Virus99; 2010-12-12 at 12:41.

Similar Threads

  1. N91 J2ME MP3 support?
    By jatal in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2005-12-13, 22:17
  2. What devices support rtp-protocol in J2ME?
    By nikita_unique in forum Streaming and Video
    Replies: 3
    Last Post: 2005-11-07, 14:32
  3. Replies: 0
    Last Post: 2005-10-21, 14:06
  4. Audio capture support for Nokia models?
    By kbellare in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2005-09-13, 23:38
  5. Replies: 1
    Last Post: 2005-01-25, 06:32

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×