0

Im trying some javascript codes to record wav sound, for example I tried this example:

http://webaudiodemos.appspot.com/AudioRecorder/index.html

That I found in this post:

HTML5 record audio to file

But I need to configure this attributes:

  • Sampling Rate: 8000 Hz
  • Bit Resolution: 16 (L16)
  • Encoding: PCM linear (LPCM)
  • Audio channel: Mono

This is not a duplicated post. The difference is that I need to generate the sound with specific configuration, like I said. I didn't find any example setting this parameters.

Comp
  • 1
  • 1

1 Answers1

0

You can get the sampling you want with the sampleRate constraint.

navigator.mediaDevices.getUserMedia({audio: {sampleRate: 8000}})

Native PCM encoding is entirely up to the browser, but PCM is simple enough that, given the stream, you can certainly implement it yourself.

Touffy
  • 6,309
  • 22
  • 28