0

I have a BB app that records and sends audio to a web service and is stored as a BLOB on my DB. I would like to know how I can play this audio from another source that isn't the BB player. I am able to save the audio data as a byte array on the BB and then extract it and play it without problem but i can't manage to do the same when I try to play it using Java Sound for instance. Has anyone tried this?

8vius
  • 5,786
  • 14
  • 74
  • 136

1 Answers1

1

BlackBerry records files in AMR format. Java Sound cannot play them back, you need a codec for that. Try, for example, http://sourceforge.net/projects/jspeex/, if you want to stay pure Java.

Alex Pakka
  • 9,466
  • 3
  • 45
  • 69
  • Don't want to stay pure java necessarily, the java sound thing is just for testing to see if i receive the audio correctly. The end of this would be to grab that audio file and play it on a browser. Any idea how i can do this? Like an embeded audio player i can use ? Thx for the answer btw, i will test this out – 8vius Jan 17 '11 at 15:12
  • Is there any simple example i can't seem to find a simple introduction and besides the javadoc on the site there doesn't seem to be much, what i want to do is fairly simple, i think, just grab a byte[] array and play it – 8vius Jan 17 '11 at 15:53
  • Oh, then you can just install [RetroCode](http://sourceforge.net/projects/retrocode/files/) and do `code input_file_name.amr output_file_name.wav` Also keep in mind that most of the source code in these tools comes from FFmpeg - the most comprehensive opensource code library for this kind of stuff. – Alex Pakka Jan 18 '11 at 02:05
  • As for playing it in the browser - I am not an expert in this area (sound playback in DHTML), but I imagine a combination of HTML5 and Flash (for something like IE6, there are plenty of freely available ones) will do the trick, as long as you convert the files into mp3 first. – Alex Pakka Jan 18 '11 at 02:12
  • I've changed how I store my sound files, I no longer save them as a BLOB in my DB since this would cause serious strain on my DB server under heavy traffic, also it makes it difficult to play the files on a website since I have to pull the data from it, turn it into a file and then play it. So what I do now is that when the the petition to save the note arrives at my web service I make the .amr file and save it in a folder. So now I know the sound I send is properly received. Since finding an amr player doesn't seem easy, any idea how I can write a script that will convert my files? – 8vius Jan 20 '11 at 15:34
  • Forgot to mention that in my DB i save the URL to the file. Also thx alot for taking the time to answer my questions. – 8vius Jan 20 '11 at 15:35
  • I'm looking to the FFmpeg library you mentioned I checked jFFmpeg but it does not support the amr format, or at least it is not listed on the site. Any idea how I can use the commands from the library in java? Or maybe php at least so I so can run it on the web client side? – 8vius Jan 20 '11 at 19:19