Skip to main content
Known Participant
September 28, 2011
Question

Compress Audio from Microphone

  • September 28, 2011
  • 2 replies
  • 733 views

Hi, I am developing an app that records voice from mic and needs to save it in the disk then send it via email. I got it no problem. I get the bytes and tranform it to wav format using the WAVWriter class.

But the wav file is HUGE. As I said, I need to send it via Email. A 10 seconds wav file is almos 1MB =/. I researched and I found a class that transforms WAV to MP3: http://code.google.com/p/flash-kikko/

Thats worked, but the resulting file is relatively big. it encodes to 128kb mp3 and I cant change the bitrate. And 128 just to a voice sound is much much more than I need. The resulting file is a bit larger than I would like.

But the BIG BIG problem is that, it takes almost 15 seconds to encode a 10 second wav to MP3 in a galaxy S or a galaxy Tab device.

It takes TOO long to encode and the resulting file is really big compared to the voice recorder that is avaliable in android devices. It records the voice, it takes 0 seconds to encode to the final file. and the file is MUCH smaller than the one I am getting.

Is there a way to compress the microphone data I have, to get a smaller file, like the voice recorder in a efficient way android devices do?

'Is there a way for my Air app to use the android's voice recorder to record the sound for my application?

Thank you very much.

This topic has been closed for replies.

2 replies

Known Participant
October 10, 2011

Im gonna try to do something with the native Extensions too. If you got something let me know. I will post here what I will archive with it too.

Participating Frequently
June 15, 2013

Hey Daniel,

Do you got something on that?

Im running on a similar problem, and i dont know how ti solve it.

When i change the microphone rate to 22, the voice sounds like a duck.

When i try 44, the sound goes crazy like an beep.

Wierd!

If you got any solution, let me know.

Thank you

Known Participant
October 3, 2011

Nobody?

Participant
October 6, 2011

Hi Daniel,

I've gone through the Kikko route and found the encoding time unacceptable as well. The best I could do was reduce my sampling rate to 22k which is acceptable for voice (but not fantastic) and compress the bytearray before I stored it and decompress when I use the recording. The bytearray compression is almost trivial but hey I guess every little bit helps if you are storing a lot of files.

Another method you could use is uploading the wav files to a server and encoding and emailing them there. Upload time is the only issue with that.

I spent months researching this problem and unfortunately there isn't a great solution out there. =(

Please update this thread if you do end up finding something.

Edit: I forgot about  Native Extensions that just got released with Adobe Air 3. That should open up a lot more solutions as you could call an mp3 encoder n Objective-C which should have far superior speed. I'll probably be looking into this solution in a few weeks but let me know if you figure something out.