Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

solutions to compress audio in browser?

I am working on getting audio recorded directly in browser and POSTed to a webserver. I am currently relying on flash to access the user microphone (using code derived from https://code.google.com/p/wami-recorder/) and passing the recorded Wav/pcm blob from flash to JS for upload (using XHR post). This works fine, but I am trying to avoid sending uncompressed WAV data (I can compress the audio on the server, but I am trying to limit CPU intensive work there).

Options I have found so far to compress to ogg on client side include:

  • relying on lab features of flash to compress the audio to ogg (labs.byhook.com/2011/02/15/ogg-vorbis-encoder-for-flash-alchemy-series-part-1/). Since it is an experimental feature in flash, it's risky to rely on it.

  • porting a minimal subset of libvorbis to javascript so that the browser can compress the data. This probably sounds a bit silly, but I only need short audio bits (a few seconds) so performance may not be such an issue. I have looked around, but couldn't find any such project going on.

  • a few other browser specific solutions such as http://firefogg.org which require substantial user-side install to work, which I don't want.

I'm looking for a better option to solve this issue, if such an option exists. I am obviously waiting for html5 getUserMedia() to work, but I need a solution in the meantime that works cross-browser (not necessarily 100%, but at least on major/recent browsers).

like image 404
Laurent S Avatar asked Mar 09 '12 14:03

Laurent S


1 Answers

Flash: https://github.com/maxl0rd/standingwave3 eg: www.jordansthings.com/blog/?p=5 support mp3.

js compression: https://github.com/jpemartins/speex.js no good examples.

like image 74
Anthony Zhan Avatar answered Oct 01 '22 12:10

Anthony Zhan