1

I'm trying to record audio on the browser and I am currently using Firefox. The goal is to be able to encode the audio data to Opus using a module compiled in Emscripten. I am using the code here as a guide https://github.com/F1LT3R/voip-js.

I notice that he is using the Speex library to resample the audio and that he is treating the audio frames as floats. How can I set the audio format on the browser itself? Can I set audio to be recorded in, for example, 48000Hz 16-bit signed PCM data, which can be easily encoded?

If not, is there at least a way I can get the format?

Mikey A. Leonetti
  • 2,834
  • 3
  • 22
  • 36
  • 1
    afaik _AudioContext_ doesn't have a "format" everything is PCM, if you want to encode it browser side you'll need to read the spec and implement the operations on the _ArrayBuffer_ (using typed arrays) to encode it yourself.. or find a nice person who's already done it. There are some examples out there for wav and mp3. – Paul S. Jun 03 '15 at 16:06
  • Hello! Thank you for your comment. From what I understand even PCM data has a sample rate, but depth, endianness, and other flats like signed or float. I was more asking how it's possible to set (preferably) or get those flags. – Mikey A. Leonetti Jun 03 '15 at 17:43

0 Answers0