09-06-2010 06:16 AM
Hi
I want a sample code for how to record audio and to play the recorded audio
Can anyone help me regarding this??
Thanks,
Pavan Kumar
Solved! Go to Solution.
09-06-2010 06:24 AM
Search in the Forums, You will find many Solved Thread like ur thread.
Also look at these Link:
http://supportforums.blackberry.com/t5/Java-Develo
http://supportforums.blackberry.com/t5/Java-Develo
--------------------------------------------------
Press Kudo to say thank to developer.
Also Press the Accept as solution Button when u got the Solution.
09-06-2010 06:48 AM
Hi nitin!!
Thanks for reply.
I already developed an app to play audio.
Now i'm trying to record audio using headphones and to store that in SDCard .
After storing i want to play the recorded audio.
Thanks
Pavan Kumar
09-06-2010 06:55 AM
Read this docs This wil Help u.
--------------------------------------------------
Press Kudo to say thank to developer.
Also Press the Accept as solution Button when u got the Solution.
09-06-2010 07:06 AM
I tried the coding but I'm getting
JVMError 104 Uncaught:RunTime Exception.
09-06-2010 07:17 AM
Hi,
I already worked on this kind of application. Please provide detail issues what ever you are getting.
Thanks
Regards
-Abhijit
09-06-2010 07:20 AM
Try to catch the Exception and track that where the Issue is comming.
--------------------------------------------------
Press Kudo to say thank to developer.
Also Press the Accept as solution Button when u got the Solution.
09-06-2010 07:36 AM
Try this code out, this works for me.
For recording the audio. Note that this code saves the audio in the device memory. just change the url to save the code in the sd card.
try{
player = Manager.createPlayer("capture://audio?encoding=amr
player.realize();
rc = (RecordControl)player.getControl("RecordControl");
bt = new ByteArrayOutputStream();
rc.setRecordStream(bt);
fc = (FileConnection)Connector.open("file:///store/home
if(!fc.exists()){
fc.create();
}
ot = fc.openDataOutputStream();
rc.setRecordStream(ot);
rc.startRecord();
player.start();
}catch(Exception e){
e.printStackTrace();
}
To stop and play the audio. use this code,
try{
rc.commit();
data = bt.toByteArray();
bt.close();
player.close();
bi = new ByteArrayInputStream(data);
player = Manager.createPlayer(bi,"audio/amr");
player.realize();
player.start();
}catch(Exception e){
e.printStackTrace();
}
09-06-2010 08:18 AM
Hi David,
Thank You Very much![]()
Its working superbbbbb
09-06-2010 09:45 AM
Hi David
Thank You for your support.I'm having one more doubt.
I created 2 buttons one for record and other for stop and play.
The record button is working fine;but the stop and play is having some issue.
when i click the button its not playing the audio.
Can u provide some i/p regarding this.
Thanks