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.

Similar Messages

  • 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.

  • How to create bookmarks by using J2ME

    Hi! Does anyone knows how to create bookmarks by using J2ME?

    hey , did u get any help on this?
    --vijay
    Hi! Does anyone knows how to create bookmarks by
    using J2ME?

  • [HELP] How to records user who use SQLPlus or SQL editor?

    Dear Gurus,
    Is onyone know how to record user who use SQLplus or any SQL editor?
    for instance...
    user1 using SQLplus on monday august 9.30.21 PM...and I have table which record this for audit user.
    Or..
    Can I block user who connect to oracle using SQLPlus?
    If anyone know how to do this..please inform me...
    Thanks and Regards
    Erie

    You can enable Auditing (AUDIT_TRAIL) and audit at the Session Level to record Logon and Log off of a required user. This can be enabled to be recorded in the audit table or operation system file. You can also audit user statements etc.
    For example, to enable auditing connect for user UGONIC
    SQL>audit connect by UGONIC;
    TO disable it
    SQL>noaudit connect by UGONIC;
    Check in the SQL Reference for the AUDIT statement and requirements.
    If you do not want the user to connect at all via SQL*Plus, you can use PRODUCT_USER_PROFILE to disable a users access to SQL*Plus or at the lower level, disable specified SQL*Plus and SQL commands for the user. You need to run the PUPBLD.SQL script as system user (if not run yet) and add records to it as required.
    Example: After running PUPBLD.SQL. This entry stops the user UGONIC from using the drop command at the backend in SQL*Plus.
    INSERT into product_user_profile (product,userid,attribute,char_value,date_value)
    values('SQL*Plus','UGONIC','DROP','DISABLED',NULL);
    Note that if a user is already connected by the profile entry, it is not activated on that session, but on subsequent logons. Again read the requied security documentations for this.
    For both auditing, you need to set the required database intialisation parameters and know where to get the audit records (in tables, views or OS file). For instance, when using tables, you maintain and query tables like audit$ to view the logs. When using OS type logging, it is recorded on the path specified in the AUDIT_FILE_DEST init parameter (In Windows, it is logged in the Windows Event and you can view it from the event viewer).

  • How to send picture message using J2ME sms APIs?

    Hi,
    I experiment with SMS APIs, i successfully send simple text message. now i want to send picture message, how to send picture message using J2ME APIs.
    please guide me.
    guna.

    I experienced in coding sending and receiving sms in J2ME. Besides, I also esperienced in coding reading a binary file in a applicaition jar. But I never done these both together. Hence Im not sure it works or not. Below is the example to open and read a binary file:
    InputStream oInputStream = getClass().getResourceAsStream( "/picture.png" );
    if(oInputStream == null) {
    //File does not exist;
    throw new Exception("File not found");
    //Read the binary file and copy it to a byte array
    byte[] abyPicture = new byte[oInputStream.available()];
    oInputStream.read(abyPicture );

  • Can someone tell me step by step how to record from audio tape to mac book with the help of xitel import deluxe

    Can someone tell me step by step how to record from audio tape to mac book with the help of xitel inport deluxe system.  Somebody had mentioned that we do not have to download the software - so I did not, but the computer does not recognize the connection.  How can I know it is connected - can someone please tell me step by step as teaching a layman.  Thanks.

    It seems this question is best posed to the makers of "xitel".
    I looked up A product and it is out for Windows but does not mention Mac OS X:
    http://www.xitel.com/USA/prod_inportpro.htm

  • Recording Streaming Audio Using Total Recorder in Vi

    Last year I purchased High Criteria's Total Recorder to successfully record sounds over the internet, etc. Earlier this year I bought a new PC with Vista and onboard sound, and I?installed Total Recorder on the new PC. ?It no longer worked. I checked their website, but they weren't much help. They said to look for a "wave out" option in recording, but there was none. Thinking that it was the onboard audio causing the problem, I bought and installed an Audigy SE sound card yesterday. While it gives me a few more recording options, I still can't use Total Recorder. Cqan anyone please give me some suggestions as to how to make this work? Or is there another program out there to record streaming audio in Vista? Thanks.

    Hi
    Can you record using mp3 or wma -format (on 28kbps) with these tools you have? These formats packs wav data to ~/0 deal from original without huge quality loss.
    If not you can try if there is some other recording tools. There are also freeware products on many SW sites like
    http://www.download.com/Audio-Video/200-2025_4-0.html?tag=dir
    http://www.winsite.com/
    .jtp

  • How to record you screen using quicktime with built in input line and microphone in the same recording?

    i am using th quick time record your screen option and see (when on the audio selction) that you can only either record sound from your computer or from your microphone
    is it possible to have it both on one recording?

    The usual audio-in options on a laptop are None / Built-in Input: Line in / Built-in Microphone: Internal microphone. There's not an option to record system audio unless you've installed a third-party extension such as Soundflower.
    In any event, if you're looking to combine audio inputs, check the Audio MIDI Setup help files (Applications > Utilities > Audio MIDI Setup). Search for "aggregate."

  • How to record an audio clip in Premiere Pro cc with USB mic on PC

    Hey All,
    Having trouble finding a solution on the web. I have just made the switch to Premiere Pro CC from Final Cut Pro 7, and also from Mac to PC, yikes I know. I am looking to record some audio clips directly into PP with my USB mic. I have successfully hooked up my usb mic through the PC control panel. My ignorance will be apparent here, What should I do next in Premiere Pro to begin recording my clips?

    https://helpx.adobe.com/premiere-pro/using/recording-audio.html
    NEW! Voice Over record feature in Premiere Pro CC 2014 - YouTube

  • How to record .jar file using Java Protocol

    Hi,
    I Tried to record .jar using Java protocol by using HR Loadrunner 11.0 Version tool.
    Am unable to record the application.
    Can any one suggest me the process of recording .jar file using load runner?
    Thanks,
    Venkat

    Look at the manual page for jar:
    # man jar
    Also you can run them by doing:
    # java -jar Prog.jar

  • How to record video or use screen capture WHILE capturing audio from Logic??

    Hi,
    I want to record my self playing guitar and singing using my mac book pro built in camera. I want the audio to come from Logic so I can add whatever effects I want to the vocals. When I say audio from Logic I don't mean recording in Logic and adding it in post. I want it to be on the fly.
    What I used to do was use the screen capturing program Snapz Pro. I would screen capture a box around photobooth for the video, and then record while having Logic's audio in the background. It screen captures my entire computers audio. So for example if I get an aim message the bleep would show up in the recording. Or if I raise the volume or lower it the little click sound fx would be in it as well.
    Capturing the audio this way let me get Logic's audio effects in my video on the fly. It worked out great....until now! :/
    I just got the audio interface "Duet 2". And am using a microphone instead of my mbp's built in one. When ever I tried to record and capture my systems audio - my entire computer would crash. Snapz Pro won't work with the system audio with the interface. It works fine without it though.
    I then tried to use Quicktime's new movie recording feature. I see it only gives an option for microphone and now system audio. So I got soundflower to re route the audio but that doesn't help either. This is because when you capture this way you can't hear anything while your capturing. So if I were to record a video and wanted Logics audio in it, I would have to set the output to Soundflower first. So when I record I cant hear myself which defeats the purpose.
    So my final question is, how can I record video while having Logic's audio? I don't need to record with the mic, because in Logic the mic audio is going thru the system audio with everything else.
    I would like to use a process more similiar to Quicktimes straight movie recording instead of doing an odd way like I used to screen capturing a box around the photobooth screen.
    Thanks

    use Yawcam from Yawcam.com

  • How to remove unwanted audio using audio effects?

    The audio effects in question: http://help.adobe.com/en_US/premierepro/cs/using/WS1c9bc5c2e465a58a91cf0b1038518aef7-7d80a .html
    I've been meaning to learn how to do this for a while so I thought I'd get started.
    I want to learn how to clean up my audio. I don't have very professional audio gear, I'm using a Rode videomic pro on a canon 60D so the quality isn't the best but it's ok for now. There is a lot I want to learn but right now there are 2 things on my mind:
    1. I have a deadcat wind muff on my rode but still when the wind hits it I get this unwanted wind sound on my soundtrack. I know there has to be a way to remove or reduce this somehow using the audio effects.
    2. Slight white noise over my audio. I know this is a result of recording directly from my camera but there has to be a way to reduce the white noise in order to get clearer audio. I've seen people recording right out of their camera and they have way better results than me.

    I know there has to be a way to remove [wind noise]
    There is.  It's called ADR.
    there has to be a way to reduce the white noise
    There is.  Better equipment.
    Sorry but, I think you may be expecting to much of your post production tools.

  • Anyway to record just audio using my macbook pro?

    Hi,
    I wanted to know if there was anyway to use my macbook pro to record sound?

    you can record audio in iMovie. The question is what format do you want it in? I'm not sure how to create an MP3 file. There is probably some free program at Macupdate.com if you look.

  • How to record video for use in IMovie?

    Hello. I'm new to MAC & IMovie, and I would appreciate knowing how to capture my video recordings using my USB linked video camera, instead of FaceTime. I would like to record a series of videos, and then import them and edit them in IMovie. Thank you.

    Hey videoiq2014!
    Here are the instructions for achieving this goal:
    iMovie (2013): Record video with the FaceTime HD camera
    https://support.apple.com/kb/PH14675
    While the title of this article is meant for the FaceTime camera, in step 2, the article instructs you to choose the camera you wish to record with. In this step, you should choose your USB camera. Thanks for coming to the Apple Support Communities!
    Regards,
    Braden

  • Recording Just Audio using a camera

    Hello,
    I need to record just dialouge to be burned onto a an audio cd, I just wanted to make sure I understand the process. The only available mic is the one on the camera, which is pretty good, so i can just record someone talking onto a tape using the mic on the camera, and then import that into fcp and then import that audio into soundtrack where i can tweak it and then open its aiffs in itunes and convert them into m4a or mp3 or whatever and then burn that onto a cd? Does this sound like the correct way to go about this? I'm a newbie to most of this stuff. Any help would be much appreciated! Thank you!

    As long as you can put up with the sound of your camera's drive mechanism whirring away in the background, this will be OK.
    But you'll get a far better result if you can move (even a cheap) mic a few feet away from the camera.
    Andy
    G5 Quad 8GB. 250+500 GB HDs. G-Raid 1TB. FCP 5.1.1. Shake 4.1. Sony HVR Z1E   Mac OS X (10.4.7)  
    "I've taught you all I know, and still you know nothing".

Maybe you are looking for

  • AppleSyncNotifier.exe-Entry Point Not Found

    I recently ran an upgrade to my iTunes or Apple software and now when I turn on my laptop I receive this error message. In the window below the title it states, "The procedure entry point sqlite3_wal_checkpoint could not be located in the dynamic lin

  • Using the latest version of Numbers on iPad.

    I am using the latest version of Apple Numbers on both my iPad and Mac. However, when using my iPad, I am unable to enter any Text into cells. Date format, numbers and functions all work OK, but there is no response when I type in text. Is this a kno

  • IDOC to file...Error for Access is denied

    Hello Friends, I am triggering IDOC WBBDLD from SAP ECC. It is successfully sending IDOC to XI In XI, in SXMB_MONI, message is successful. But when I am checking in message monitoring with message ID in adaptor level. I am facing given below error. 2

  • Destorying a thread by name?

    Is there any way destroy a thread by name? For example I name a thread musicthread and then call musicthread.destroy().

  • Plugin for Third party webserver

    How do I configure Sunone Webserver or Apache to talk to Oracle 10g (9.0.4) appserver. I don't want to use builtin HTTP server provided by Oracle. Does Oracle provide any plugin to configure third party webserver ? Thanks in advance, VB