You Are Here:

Community: Developer Discussion Boards

#1 Old voice recording in j2me - 2007-04-14, 00:34

Join Date: Mar 2007
Posts: 8
amitkalyani
Offline
Registered User
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
Reply With Quote

#2 Old Re: voice recording in j2me - 2007-04-14, 06:14

Join Date: Mar 2007
Posts: 46
gordon32
Offline
Registered User
Hi,amitkalyani
It possible to implements what you want,you can use RecordControl in JSR135 to control recording voice

Best regards
Reply With Quote

#3 Old Re: voice recording in j2me - 2007-04-16, 00:16

Join Date: Mar 2007
Posts: 11
Mr.Developer
Offline
Registered User
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
Reply With Quote

#4 Old Re: voice recording in j2me - 2007-04-16, 06:55

Join Date: Jan 2007
Posts: 99
Location: Bangalore, India
khalandar
Offline
Regular Contributor
Quote:
Originally Posted by Mr.Developer
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
I trhink this link might be useful for you as it deals with saving the recorded audio.
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)
Reply With Quote

#5 Old Re: voice recording in j2me - 2007-04-18, 05:01

Join Date: Mar 2007
Posts: 8
amitkalyani
Offline
Registered User
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);
}
}
}
Reply With Quote

#6 Old Re: voice recording in j2me - 2007-04-18, 05:29

Join Date: Nov 2003
Posts: 3,641
Location: Bangalore , India
Send a message via Yahoo to balagopalks
balagopalks's Avatar
balagopalks
Offline
Forum Nokia Expert
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.
Reply With Quote

#7 Old Re: voice recording in j2me - 2007-04-18, 08:08

Join Date: Jan 2007
Posts: 99
Location: Bangalore, India
khalandar
Offline
Regular Contributor
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)
Reply With Quote

#8 Old Re: voice recording in j2me - 2007-04-18, 18:58

Join Date: Mar 2007
Posts: 8
amitkalyani
Offline
Registered User
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
Reply With Quote

#9 Old Re: voice recording in j2me - 2007-04-18, 19:02

Join Date: Mar 2007
Posts: 8
amitkalyani
Offline
Registered User
Quote:
Originally Posted by khalandar
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,

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
Reply With Quote

#10 Old Re: voice recording in j2me - 2007-04-19, 07:43

Join Date: Jan 2007
Posts: 99
Location: Bangalore, India
khalandar
Offline
Regular Contributor
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)
Reply With Quote

#11 Old Re: voice recording in j2me - 2007-04-19, 19:41

Join Date: Mar 2007
Posts: 8
amitkalyani
Offline
Registered User
Quote:
Originally Posted by khalandar
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,
thanks for reply
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
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

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

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
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

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d18645X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ