Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use Opus Codec from JavaScript

I would like to see if it's possible to have direct access to Opus using getUserMedia or anything similar from the latest browsers.

I've been researching on it a lot but with no Good results.

I'm aware that either Opus or Speex are actually used in webkitSpeechRecognition API. I would like to do speech recognition but using my own server rather than Google's.

like image 636
Omar Al-Ithawi Avatar asked Dec 12 '13 16:12

Omar Al-Ithawi


1 Answers

So there are a lot of suggestions about Emscripten but nobody did, so I ported the encoder opus-tools to JavaScript using Emscripten. Dependent on what one has in mind, there are now the following opportunities:

  • Encoding FLAC, WAVE, AIFF, RAW files || demo || Web Worker size: 1.3 MiB
  • Encoding raw stuff for immediately processing or sending without container || demo || Web Worker size: 0.6 MiB
  • Encoding to Ogg-Opus and WAV from getUserMedia stream
  • When using Mozilla Firefox, it's possible to use a MediaRecorder, which would also allow to convert arbitrary sound files into Opus format on supported platforms together with AudioContext.decodeAudioData()
like image 191
Rainer Rillke Avatar answered Sep 28 '22 19:09

Rainer Rillke