Audio in J2ME (Palm)

Hi, is it possible to play audio in Palm by J2ME?
If it's possible, please give me some instructions.
Thanx

MIDP 1.0 Yes, but only five musicly sounds,
ALARM.playSound( currentDisplay );
CONFIRMATION.playSound( currentDisplay );
ERROR.playSound( currentDisplay );
INFO.playSound( currentDisplay );
WARNING.playSound( currentDisplay );MIDP 2.0 Yes.
From the API docs:
try {
     Player p = Manager.createPlayer("http://abc.wav");
     p.start();
} catch (MediaException pe) {
} catch (IOException ioe) {
}Palm however only currently has support for MIDP 1.0

Similar Messages

  • How to record an audio using j2me

    hello i'm new to this.
    i have some sample code to record audio in wireless toolkit
    but i got error in "setOutputStream()"
    this is my code.any one help me....................
    code :-
    ====
    try
    // create the Player object using amr encoding
    p = Manager.createPlayer("capture://audio?encoding=pcm");
    p.realize();
    // get the RecordControl over this Player
    RecordControl rc = (RecordControl)p.getControl("RecordControl");
    // create an OutputStream which the RecordControl will use
    // to write write the recorded data.
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    rc.setRecordStream(output);
    // start the recording
    rc.startRecord();
    p.start();
    messageItem.setText("recording...");
    Thread.currentThread().sleep(5000); // record for 5 seconds
    messageItem.setText("done!");
    rc.commit();
    // save the recordedData in a byte array
    recordedSoundArray = output.toByteArray();
    // close the player
    p.close();
    } //try
    catch (IOException ioe)
    errorItem.setLabel("Error");
    errorItem.setText(ioe.toString());
    catch (MediaException me)
    errorItem.setLabel("Error");
    errorItem.setText(me.toString());
    catch (InterruptedException ie)
    errorItem.setLabel("Error");
    errorItem.setText(ie.toString());
    }//if

    hai all,
    im new here ..i have problem in recording audio using j2me..my code is as below
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.media.control.RecordControl;
    import javax.microedition.media.Manager;
    import javax.microedition.media.MediaException;
    import javax.microedition.media.Player;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    public class recordMidlet extends MIDlet implements CommandListener
    private Form init = new Form("info");
    private Command rec = new Command("rec",Command.OK, 1),
    stop = new Command("stop",Command.STOP, 0),
    exit = new Command("exit",Command.EXIT, 0);
    private byte[] recordedSoundArray;
    private Player p;
    private RecordControl rc;
    private ByteArrayOutputStream output;
    public void startApp()
    init.addCommand(rec);
    init.addCommand(stop);
    //init.addCommand(exit);
    init.setCommandListener(this);
    Display.getDisplay(this).setCurrent(init);
    public void pauseApp()
    public void destroyApp(boolean unconditional)
    public void commandAction(Command com, Displayable dis)
    if(com == exit)
    notifyDestroyed();
    else if(com == stop)
    init.removeCommand(stop);
    init.addCommand(exit);
    try
    init.append("finish record... starting playback\n\n");
    rc.stopRecord();
    rc.commit();
    p.stop();
    p.close();
    init.append("playing...\n");
    recordedSoundArray = output.toByteArray();
    init.append("recorded sound = " +String.valueOf(recordedSoundArray.length)+"\n\n");
    ByteArrayInputStream recordedInputStream = new ByteArrayInputStream(recordedSoundArray);
    Player p2 = Manager.createPlayer(recordedInputStream,"audio/x-wav");
    p2.prefetch();
    p2.start();
    //init.append("finish playing...");
    catch (Exception e) {
    init.append("stop command: "+e.toString());
    else if(com == rec) {
    try {
    init.append("record voice ...\n\n");
    // Create a Player that captures live audio.
    p = Manager.createPlayer("capture://audio?encoding=pcm&rate=8000&bits=16");
    p.realize();
    // Get the RecordControl, set the record stream,
    rc = (RecordControl)p.getControl("RecordControl");
    output = new ByteArrayOutputStream();
    rc.setRecordStream(output);
    rc.startRecord();
    p.start();
    } catch (Exception ioe)
    init.append(ioe.toString());
    i get error from ktoolbar window..
    Warning: To avoid potential deadlock, operations that may block, such as
    networking, should be performed in a different thread than the
    commandAction() handler.
    Emulator is not working after that..and it jus shows text
    " RecordMidlet wants to record an audio clip.is it ok to record? then the emulator hangs..
    could someone help me to solve this problem..is there any setting problems in j2me wireless toolkit ?
    im using J2me wireless toolkit 2.5 for CLDC beta 2 .
    thanks to all.

  • Playing input stream audio in j2me

    want to make a text-to-speech synthesizer for mobile phones.
    for that i am using FreeTTS (text-to-speech synthesizer written in java)
    so i have made a client-server model where i have a midp client which is sending text to the FreeTTS acting as a server.... for this i am using socket...
    so basically -- client is sending text to server -- server processes the text and sends the audio stream back to client
    the problem is i dont know how to play the audio stream received on client side
    i tried to copy it in a buffer but its not working..
    do i need to save the file in some format before playing it?
    or can the player play the audio stream directly?
    this is how i am copying the contents in the buffer
    try
    InputStream is = socketConnection.openInputStream();
    byte[] buff = new byte[1024];
    int bytesIn = is.read(buff, 0, 1024);
    ByteArrayInputStream bis = new ByteArrayInputStream(buff);
    player = Manager.createPlayer(bis, "audio/x-wav" );
    player.start();
    but it gives an error saying
    javax.microedition.media.MediaException: Malformed wave media
    i tried to display the contents of bis on console it reads
    java.io.ByteArrayInputStream@d590dbc
    i tried the same with the Free TTS client and got the same output.
    so i think client socket is even receiving the audio stream properly...however, im not sure.
    is the whole client-server using socket idea correct?
    if yes, please tell me how to play this audio stream in j2me (the client)
    if it is wrong then please tell me a correct way to do this.
    can the input stream be stored as a WAV file and then played? if yes, then how can i store it as a WAV file? Can this be achieved by appending a WAV header?

    I once tried the similar thing, I ended up buffer all the content locally (from bluetooth), then play the wave file.
    Maybe someone else has better idea.

  • Is this possible (J2ME & Palm)?

    Using J2ME and Palm os emulator to simulate using a palm pilot to access web pages on my own server? What tools are out there for me to use? Do you know of any tutorials that may help me do this?
    Thank you for your reply.
    Luu

    I think you should be using the CLCD configuration and the MID Profile (there is and implementation of MIDP for Palm OS that will help you develope java applications for java).I never tried but I know that it's possible to make a MIDlet (a java application that uses MIDP) that interacts with servlets and jsp.

  • Extra bytes problem with audio capture,j2me

    hi there
    I m working on a J2ME application that captures live audio through microphone into a bytearrayoutputstream .
    i have supplied the capture time,sampling rate, bits per sample, no of channels info to the program.
    but when i check out the size of the byte array , i see that its greater than what it should be !!!
    if the size had been lesser than expected, i could guess that sum bytes are getting lost , but what attributes to the larger size.
    and everytime i run the program i c that the size is larger than expected though the number by which it exceeds is different everytime.
    can ne one help??

    Hi,
    Thank you very much for your help. I changed the code as you suggested. It minimizes the gap, but there is still part of missing voices.
    When you tried it, did you get really perfect (no gap) recording, as if it was recorded to one single stream?
    below is my recording code:
    for(int i=0;i<types.length;i++) {
                   rc.setRecordStream(baos);
    rc.startRecord();
    Thread.sleep(2000);
    rc.stopRecord();
    rc.commit();
    init.append("baos size after rec:" + baos[i].size()+"\n");
    }//end of for
    p.stop();
    p.close();
    and here is the code for playing back the voice:
    for(int i=0;i<3;i++) {
                bais[i] = new ByteArrayInputStream(baos.toByteArray());
    try {
    p = Manager.createPlayer(bais[i],types[i]);
    p.prefetch();
    p.start();
    Thread.sleep(p.getDuration());
    p.stop();
    p.close();
    catch(Exception e) {
    init.append("exception in playing back voice: "+e.toString()+"\n");
    e.printStackTrace();
    for playing back, we need to stop and close the player first, then create a new player to play the next input stream, dont we?
    Thanks
    - alfo

  • J2me-palm conversion

    I have converted j2me webservice client application into prc file using midp-palm converter given by sun,then i tried to execute the prc file using palm emulator.but i have got java.rmi.Remote class not found exception.How to overcome this?

    IBM has providede weme you download It and put those prc files in palm then you need to synchronize jad file it will convert into prc and display the file .............. try it out yar if you need any help regrding palm then chat me on this ID gopi_98 @yahoo.com

  • How can you get recorded audio from your palm to your computer?

    My friend has a palm treo 680 and we used it to record some stuff today, but he cannot figure out how to get it to his computer.
    Is this possible? If so, any help would be great because I really would like to get this to my computer.
    Thanks.
    -JT.
    Post relates to: Treo 680 (Cingular)

    With my TX, there was the option to "Copy to card" for voice memos (older version of the Voice Memo program that I copied to it).
    On my Centro, there is the option for sending the voice memo either by BlueTooth, Email, or SMS.  Does the 680 have either of these?
    WyreNut
    Post relates to: Centro (AT&T)
    I am a Volunteer here, not employed by HP.
    You too can become an HP Expert! Details HERE!
    If my post has helped you, click the Kudos Thumbs up!
    If it solved your issue, Click the "Accept as Solution" button so others can benefit from the question you asked!

  • Re: how can record video+audio on j2me and java also?

    You can capture video similar to the way you capture audio or images.
    Player p = Manager.createPlayer("capture://video");After you have the player you can get the RecordControl and VideoControl
    recordControl = (RecordControl) p.getControl("RecordControl");
    videoControl = (VideoControl) (p.getControl("VideoControl"));You can get the content type from the record control. Use rc.startRecord(); to begin the record process.
    There are some steps you will need to fill in, such as prefetching, setting the display location, etc. The snippets above should be enough for you to start your research though.

    You can capture video similar to the way you capture audio or images.
    Player p = Manager.createPlayer("capture://video");After you have the player you can get the RecordControl and VideoControl
    recordControl = (RecordControl) p.getControl("RecordControl");
    videoControl = (VideoControl) (p.getControl("VideoControl"));You can get the content type from the record control. Use rc.startRecord(); to begin the record process.
    There are some steps you will need to fill in, such as prefetching, setting the display location, etc. The snippets above should be enough for you to start your research though.

  • Streaming Live Audio on J2ME

    I am able to play the audio/video on my device using MMAPI , i am am confuse on how to access the data source to send to my destination , anyone can help me,how to do it?
    Thanks a lot for ur support!

    Removed; didn't notice the "live audio" when I made my suggestions.
    Message was edited by: Dave Sawyer.

  • Refreshing  a list

    hai
    I am doing an application in j2me for downloading and playing video file. It allow partial downloading of files. when the applicaton starts there will be list of file that can be downloaded and an icon to show status partial downloading. when an item in the list is selected for downloading the status icon will change
    I am getting that corredtly in nokia phones . but when comming to sony ericsson phones, as i select an item from the list the status icon is shown but along with that the previous icon appended to that. but when gone to another page and come back it is showning the icon normally how can i rectify that
    thank you

    hi .
    i m trying to develop an application that would download video and audio using j2me from any given url...
    could you please let me know how that can be accomplished ?
    thanks
    nirav

  • UnsatisfiedLinkError: javax.microedition.media.Manager.initMMedia()

    Hello all,
    I'm trying to develop an application recording audio on J2ME. The trouble is that every time I'm calling Manager.createPlayer(anything) method I get the following on my terminal:
    Failed to find configuration object - DefaultConfiguration is used!
    Exception in thread "main" java.lang.UnsatisfiedLinkError: javax.microedition.media.Manager.initMMedia()V
         at javax.microedition.media.Manager.initMMedia(Native Method)
         at javax.microedition.media.Manager.<clinit>(Manager.java:490)
         at local.Temp.run2(Temp.java:65)I tried with
    Player p = Manager.createPlayer("capture://audio");and
    Player p = Manager.createPlayer("oak.wav");and even
    Player p = Manager.createPlayer(Manager.TONE_DEVICE_LOCATOR); each and every time the execution stops on the line where createPlayer method is called. I'm running Eclipse version 3.3.2 with EclipseME 1.7.9 and Sun Java Wireless Toolkit for CLDC v 2.5.
    I am quite clueless currently so I would really appreciate a hint explaining what the error may mean.
    Thanks a lot,
    Simon
    ...and BTW: another think I dont get is that each time the exception is thrown the execution stops in spite of the fact, that createPlayer method is in try/catch block with catch catching every Exception (catch (Exception e) ), but that is just a curiosity question.

    Ok, first thing : you MUST NOT use a full system path for a ressource. Create a directory in your netbean project (rsc for instance) and do sthg like :
    player = Manager.createPlayer("/rsc/film.mpg");Second thing, to get supported formats, use :
    String protocols[] = Manager.getSupportedProtocols();
    for (int i=0;i<protocols.length;i++) {
      String contentTypes[] = Manager.getSupportedContentTypes(protocols);
    // Display all strings in the array ....

  • N8,where's the media server?

    hello
    Is there a media server app anywhere for the N8?
    My old N86 had one,why has a flagship model been realeased without one?
    Specifically,I want to share files from my N8 with my PS3 over my wifi,which my N86 used to do.
    Anybody?
    Thanks for looking

    Its also worth noting that users have reported 'mixed' success using the Media transfer between the Desktop and their device (regardless of Desktop or computer's OS) and it seems the best and fastest way to get Media (photos, video, audio) to the Palm is via a SD card and a reader/writer on your desktop computer.
    It seems transferring Media via HotSync can be a long (and often unstable) process.
    For the Palm to access photos on the SD card these must be copied into the DCIM folder your device creates there, while video and music can live in folders so named and created on the SD by you, with your files copied there. The appropriate device's programs then directed to these folders without issue. 
    I suppose one could then Move files over to the Palm proper, once the SD card is back in the device (and similarly, photos on the device copied/moved over to the card), but the advantage of leaving Media on the card is that you can quickly add/delete/swap this info as needed. 
    Post relates to: Palm TX
    Message Edited by Bazza on 09-07-2008 04:55 AM

  • How to play audio file in default player in j2me

    Hi ,
    I would like to implement Audio Streaming in Mobile application. I am record the voice using amr format and store
    local mobile memory and retrieve and play the file successfully, what is my requirements is, when i was play the
    file , i want to open the file in any default player in the mobile, the forward and backward control are use the default
    player control. is it possible to play the file in default player in j2me. please reply soon.
    With Regards,
    Ganesh Kumar
    Edited by: tlgkumar on Oct 23, 2008 11:55 AM

    Hi Ganesh,
    my suggestion to u is use existing streaming protocol that already support by MMAPI, thats RTSP/RTP protocol.
    u only need to configure existing streaming server like HELIX SERVER or DARWIN SERVER, and ENCODER like FFMPEG, HELIX PRODUCER, etc to encode ur live media / store file become RTP packet and then let server send that to ur client. u can use camera / TV turner also to capture live video and send that by streaming. So u dont need to make ur own server, except ur project need different protocol from that streaming server use.
    in client side, u can choose to use REAL MEDIA or make ur own player, Nokia already support RTSP protocol since S40 3rd edition and S50 2nd edition FP 3. so u dont need to parse by ur code RTSP message and RTP packet. u also can use forward and backward fiture too by that both streaming server.
    please read any RTSP / RTP standar protocol reference, i think it will be helpfull to u to make ur own system configuration ..
    -best regards-
    adek aidi

  • Streaming audio on Palm Pixi

    Is it possible to listen to streaming audio from a website on the Palm Pixi? I tried to listen to live audio from a radio station website and it wouldn't play. Do I need to download a player?

    Hello and welcome to the forums;
    WebOS devices support streaming music from websites, as long as the station streams in a supported audio format: MP3, AAC, or AAC+.
    When you try to stream the site, what happens? Do you get an error?
    Life moves fast. Don't miss a thing.
    TreoAide

  • Does j2me support jdbc for Palm Oracle Lite(8i/9i)

    I have a requirement to develop an application in Java for PALM OS with Oracle Lite 8i/9i connectivity. does j2me support jdbc for Palm Oracle Lite(8i/9i). Please help me to know what all java VM available in the market which have oracle connectivity(jdbc/odbc/whatever) for Oracle Lite for PALM.
    thanks
    dk

    Pleae some one reply, if j2me/kvm supports jdbc/odbc connectivity to oracle lite 9i/8i on palm
    thanks
    dk

Maybe you are looking for

  • Error While testing SAP Webservice build by RFC enabled function Module

    Hi All, Iam getting an error " You are not authorized to view the requested resource"., while Iam testing SAP Webservice using transaction WSADMIN or SOAMANAGER.I have succesfully tested for WSDL and done with required configurations and settings. Ca

  • Report of changes made by user to a material on a purticular date

    hi, i am working on report in which i have to display the changes made by user to a material on a purticular date. i am able to display he all fields but i want to 1 more field which is in tcode MM04 i.e. text field(which means discription of te acti

  • "Embed Text Data" Not Working

    When a user jumps around my finished DVD, the player (computer or set-top) displays in the upper left corner the word "Chapter" and a number after that word. The player seems to decide what to number each of my chapter markers. Instead of this, I wou

  • Operating system name

    Hi, I know we can get the operating system name using the following code. System.getProperty("os.name"); But on Windows 7 and Windows Vista it is returning Windows NT and some times Windows NT(unknown). Is there any specific reason for this ? Thanks

  • BAPI to update the standard tocode and save!!

    Hi, I had a requirement where in the Tcode FKKORD2 I need to change the radio button from noenddate to Last date and then need to fill the date and save it for a particular standing request. Please advice.. vishal