How to Call SPEEX Audio Decode/Encode in HTML5 / JavaScript (Without Flash)
Asked Answered
B

4

11

I'm working on a project that requires audio data to be streamed via HTTP to/from server.

We need to compress the audio data using SPEEX.

In Flash, we can use Alchemy and LibSpeex, but how can we do it in JavaScript. HTML5 can be used.

Thanks.

Peter

Benzedrine answered 3/2, 2012 at 20:17 Comment(5)
The most likely answer is "if there is no pure JS codec you need to write one yourself" :(Pruter
Rewriting a SPEEX lib is ......Benzedrine
Then you should stream in some format supported by browsers. See WebRTC webrtc.org no one is forcing you to use SPEEX?Pruter
Hmmm. SPEEX is pretty standard for Speech Recognition. The compression rate is pretty nice: 1/7 or even less but no apparent distortion for Speech Recognition. I'm not sure how the iSAC/iLBC audio codec works.Benzedrine
But SPEEX is not standard for the web, or the browsers... so :)Pruter
S
10

I recently implemented a successful HTML5/VOIP client using the following JS port of Speex, truly awesome stuff:

https://github.com/jpemartins/speex.js

For now you'll need to either wait for MediaStreamRecorder or jump the gun like I did, and make use of this:

https://github.com/jwagener/recorder.js/

As for how you piece the whole lot together into a slick system, your call :)

Hope i've helped

Septicidal answered 22/11, 2012 at 22:25 Comment(2)
For reference, basic implementation of HTML 5 audio recording and uploading... just up to the encoding part is here: learnwithecho.com/testaudio.htmlClupeoid
hey sirjamm, I don't suppose this successful solution is on github? would love to see how you got recorder.js and speex.js to work together!3d
S
1

I am working on a project called AudioRecorder that exactly fits your needs. You can find it here. https://github.com/dbieber/audiorecorder.

This builds upon the already mentioned emscripten compiled speex codec: jpemartins/speex.js.

If you already have the audio and just want to encode it, call Codec.encode(samples). You can also use AudioRecorder to record the audio -- there's an example on Github here: http://dbieber.github.io/audiorecorder/examples/recorder.html

The implementation currently assumes 1-channel audio and if you want two channel you can just encode or decode twice.

Stewardson answered 5/1, 2014 at 23:16 Comment(0)
L
0

I had a similar requirement and ended up writing a Java applet that used JSpeex and called it from JS.

Lauren answered 30/3, 2012 at 10:29 Comment(0)
V
0

I have posted an answer on How can I play .spx file by html5 ?.

With speex.js, now I can play speech of word for my online dictionary project.

Volney answered 4/8, 2015 at 1:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.