| Reply | « Previous Thread | Next Thread » |
|
Hi,all
i have problem descirbed below plz help me as soon as possible. i am recording voice and then playback in phone but only plays 5 seconds recording voice i want to store more minutes recording then how to manage it. how to store in memory? is it possible or not? plz reply me |
| amitkalyani |
| View Public Profile |
| Find all posts by amitkalyani |
|
Hi,amitkalyani
It possible to implements what you want,you can use RecordControl in JSR135 to control recording voice Best regards |
|
hi
i'm trying to save audio as well but i have an exception that i couldn't solve can you please give me some steps how you saved that audio i'll be grateful thanks |
| Mr.Developer |
| View Public Profile |
| Find all posts by Mr.Developer |
|
Quote:
http://discussion.forum.nokia.com/fo...d.php?t=100712 Any more clarifications can ask. If you could tell the Exception thats occuring may be we can try to solve it as well with regards, with regards, Khalandar Pasha N (khalandar_p@yahoo.co.in) |
|
thanks for replying.
i put my code below plz solve it i am trying lots but i am not success to develop it. thanks in advanced i just store 5 seconds but i want to store more minutes of data in file. import javax.microedition.midlet.*; import javax.microedition.lcdui.*; import javax.microedition.media.control.*; import javax.microedition.media.*; import javax.microedition.io.*; import java.io.*; import java.lang.*; import java.util.*; public class RecordForm extends MIDlet implements CommandListener { private Display display; private Form form; private Command record; private Command play; private Command exit; private Player p; private byte[] recordedSoundArray = null; public RecordForm() { display = Display.getDisplay(this); record = new Command("Record", Command.SCREEN, 1); play = new Command("Play", Command.SCREEN, 2); exit=new Command("exit",Command.SCREEN,3); form = new Form("Recording Example"); form.addCommand(record); form.addCommand(play); form.addCommand(exit); form.setCommandListener(this); } public void startApp() { display.setCurrent(form); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } public void commandAction(Command comm, Displayable disp) { if(comm==record) { Thread t = new Thread() { public void run() { try { form.append("record voice ...\n\n"); String[] types= Manager.getSupportedContentTypes("capture"); for( int i= 0; i < types.length; i++ ) { form.append(types[i]); } // p = Manager.createPlayer("capture://audio?encoding=pcm"); //p = Manager.createPlayer("capture://audio?rate=8000&bits=16"); p = Manager.createPlayer("capture://audio");//?encoding=amr"); // p = Manager.createPlayer("capture://audio?rate=8000&bits=8&Channels=1"); // p=Manager.createPlayer("capture://devmic0?encoding=pcm"); //p=Manager.createPlayer("rtp://192.168.2.2:8000/audio"); p.realize(); RecordControl rc = (RecordControl)p.getControl("RecordControl"); ByteArrayOutputStream output = new ByteArrayOutputStream(); rc.setRecordStream(output); rc.startRecord(); p.start(); form.append("recording...\n"); form.removeCommand(play); Thread.currentThread().sleep(5000); // record for 5 seconds form.append("done!"); form.addCommand(play); p.stop(); rc.stopRecord(); rc.commit(); recordedSoundArray = output.toByteArray(); p.close(); getRoots(); } catch (IOException ioe) { form.append("Error 1:"+ioe.toString()); } catch (MediaException me) { form.append("Error 2:"+me.toString()); } catch (InterruptedException ie) { form.append("Error 3:"+ie.toString()); } } };t.start(); } else if(comm == play) { Thread a = new Thread() { public void run() { try { form.deleteAll(); form.append("playing...\n"); form.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(); } catch (IOException ioe) { form.append("Error 3:"+ioe.toString()); } catch (MediaException me) { form.append("Error 4:"+me.toString()); } } };a.start(); } else if (comm==exit) { try { destroyApp(false); notifyDestroyed(); } catch (Exception ioe) { form.append("Error 5:"+ioe.toString()); } } } private void getRoots() { Enumeration drives = javax.microedition.io.file.FileSystemRegistry.listRoots(); while(drives.hasMoreElements()) { String root = (String) drives.nextElement(); form.append(root); } } } |
| amitkalyani |
| View Public Profile |
| Find all posts by amitkalyani |
|
I have provided some sample code in the link that "khalandar" have pointed. Please let me know what exception are you getting and in which phone you are trying.
Regards Gopal __________________ MobiQuil.com An initiative by Developers for Developers. http://www.mobiquil.com - Alpha - Launched. |
|
If Iam not wrong your problem is storing minutes of data instead of 5 seconds right..If yes, then the solution is simple you are stopping the player after 5 seconds i.e by using thread.sleep(5000) and then stopping the player instead of that increase the sleep period for the amount of time you want (say 1minute etc...)or what you can do is add one more command to the Form say a stopRECCommand and when this is pressed only then you stop the player as well as recording. I hope that solves your problem. Iam not in office else may be I would have sent you the changed program itself. I hope this solution works.
with regards, with regards, Khalandar Pasha N (khalandar_p@yahoo.co.in) |
|
thanks for replying.
i am not got any exception code is running but it store only 5 seconds recording i want more than 5 seconds means 1 minutes to 1 hours if possible. reply me thanks |
| amitkalyani |
| View Public Profile |
| Find all posts by amitkalyani |
|
Quote:
thanks for reply i am increase the seconds but there is not any kind of changed becoz it stores only 5 seconds data. thanks for nice reply |
| amitkalyani |
| View Public Profile |
| Find all posts by amitkalyani |
|
Could you please tell me the Emulator/ Phone you are working on. So that i can try the code on the same and if possible help you.
With regards, with regards, Khalandar Pasha N (khalandar_p@yahoo.co.in) |
|
Quote:
i am testing on nokia 3230 and emulator is wireless toolkit 2.2 is there use of rms or not for storing file? plz help |
| amitkalyani |
| View Public Profile |
| Find all posts by amitkalyani |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Unlimited Audio Recording with J2ME on nokia 6630 | basitj | Mobile Java Media (Graphics & Sounds) | 10 | 2008-06-01 19:16 |
| Voice recording on 9500 / 9300 | omarsc | General Discussion | 0 | 2006-04-28 11:10 |
| use Java Native Interface to record voice in J2ME | walterzcm | Mobile Java General | 1 | 2002-11-20 11:40 |
| voice recording in MMS | walterzcm | General Messaging | 1 | 2002-11-19 06:17 |