Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
tejaswini
Posts: 211
Registered: ‎04-29-2009
My Device: Not Specified

Problem in recording wav file

Hi,

I am trying to record wave file on Blackberry device.

 

I have used following code for creatring wav file.

 

After recording, whenever I try to play it, exception is thrown as un-supported media file.

 

Please help.

p = Manager.createPlayer("capture://audio?encoding=pcm"); p.realize(); RecordControl rc = (RecordControl) p .getControl("RecordControl"); ByteArrayOutputStream output = new ByteArrayOutputStream(); rc.setRecordStream(output); rc.startRecord(); p.start(); Thread.currentThread().sleep(10000); rc.commit(); rc.setRecordLocation("file:///SDCard/BlackBerry/test.raw"); recordedSoundArray = output.toByteArray(); p.close();

 

 

 

Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Problem in recording wav file

Instead of test.raw, can you specify the correct format like .amr etc..

Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.
Developer
tejaswini
Posts: 211
Registered: ‎04-29-2009
My Device: Not Specified

Re: Problem in recording wav file

[ Edited ]

HI,

I tried with foll. extensions: .wav, .amr

Also with encoding types as x-wav, pcm

The file is generated but when I try to play it, it says unsupported format...

 

I want .wav file to be recorded. Please help....Badly stucked.... 

Message Edited by tejaswini on 08-24-2009 11:47 AM
Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Problem in recording wav file

I had tried with amr recording and also teh playback, which worked fine.

Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.
Developer
tejaswini
Posts: 211
Registered: ‎04-29-2009
My Device: Not Specified

Re: Problem in recording wav file

May I know what encoding type you had used for .amr recording?
Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Problem in recording wav file

Check this KB article.

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/1089414/How_To...


Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.
Developer
tejaswini
Posts: 211
Registered: ‎04-29-2009
My Device: Not Specified

Re: Problem in recording wav file

For .amr extension also, I am getting unsupported file format....

 

Please help

:smileysad: 

Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Problem in recording wav file

Just a try, Instead of setting teh location using record control, get the bytes of audio data and use those bytes to store it in a SDCard(PC) location using FileConnection API and try the created file in PC using some AMR players..

Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.
Developer
tejaswini
Posts: 211
Registered: ‎04-29-2009
My Device: Not Specified

Re: Problem in recording wav file

As my project requirement is .wav file, I tried copying wave file on desktop and play with media player.

Still no luck, media player says file format not supported. Other wav files downloaded over the internet work fine with media player. 

Please use plain text.
Administrator
MSohm
Posts: 14,296
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Problem in recording wav file

Are you unable to play back the file on the BlackBerry smartphone when using the sample code in the knowledge base article referenced above?  If so, what BlackBerry Smartphone model and BlackBerry handheld software version are you testing on?  You can find this under Options, About on the BlackBerry Smartphone.  Are you using a real BlackBerry handheld or the simulator?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.