vote up 0 vote down
star

Hi,

I've been experimenting with the new Microphone API on the Flash Player 10.1 and I managed to do a microphone recorder/player. Pretty cool!

Now, the problem is that I don't know how to save/export the sound recorded into any common format like WAV, MP3 or anything else!

Can someone please help? Or at least point me on the right direction?

Thanks in advance! Luís

flag

4 Answers

vote up 0 vote down

I didn't play with this particular API, but usual technique to save data created by Flash Player is to create a ByteArray, send it to a server side program to (Java, PHP, e.t.c.) that will attach the proper Mime type to this byte array and bounce it back to the Web browser, which, based on the Mime type will open the application on your computer that, hopefully, will allow you to save the file.

I've been using this technique to generate PDF in Flex on the client and sebd it to the server and back to open the Acrobat Reader.

The other choice is to use AIR 2.0 and save the files directly.

link|flag
Well, the problem is that this has to be done in Flash Player and not AIR. I also can't find anything that would allow me to send the audio ByteArray to the server and convert it to an audio format. Do you know anything? – Luis Fonseca Nov 24 at 22:49
As I said, I didn't work with MP3, but here's the code snippet to send a ByteArray with the PDF content to the JavaServer page createPDF.jsp public static function openPdf(xdp:String, target:String="_blank"):void{ var req:URLRequest = new URLRequest("/createPDF.jsp"); req.method = URLRequestMethod.POST; var ba :ByteArray = new ByteArray();; ba.writeMultiByte(xdp, "iso-8859-1"); ba.compress(); ba.position = 0; req.data = ba; navigateToURL(req, target); } – Yakov Fain Nov 25 at 2:34
vote up 0 vote down

Hehe, I just can tell you how we handled this whole stuff 2 years ago. We had to built a podcast service where users were able to record their podcasts via a Flex RIA.

We used the Flash Media Server to stream the audio to the server. The prob is, that Adobe was using Nellymoser Codec and it was impossible to save it as a mp3. So, what we have done then was to call ffmpeg via cmd line with the help of a servlet which then returned after conversion the correct url to the converted mp3.

I have no clue, if it is now possible to save the stuff maybe directly as mp3. Hope I could help a bit.

Regards, Inkvine

link|flag
vote up 0 vote down

Flash 10 can write to file, no need for server roundtrip.

link|flag
vote up 0 vote down

There is a sample by Christophe Coenraets made in AIR and SQLite http://coenraets.org/blog/2009/11/voice-notes-record-voice-notes-and-persist-them-in-sqlite-with-air-2/

May be it will be useful for you

link|flag

Your Answer

Get an OpenID
or

Not the answer you're looking for? Browse other questions tagged or ask your own question.