Andrew
Andrew

Reputation: 21

How to use webrtc to record high quality stereo audio?

Is there a way to set line-in quality using javascript?

Instead of a microphone, I used an external mp3 player connected to the line in. The recorded audio sounds compressed and is mono.

This effect is tested with the most populair libraries/sample pages (on different computers in both firefox and chrome), it looks like audioin is first compressed and merged into a single track, and then uncompressed and split in multiple channels for the createScriptProcessor callback.

The newer and still experimental MediaRecorder api (such as used for webrtc.github.io examples) has the same quality problems.

Upvotes: 2

Views: 1530

Answers (1)

Kim T
Kim T

Reputation: 6436

Sounds like to need to change your getUserMedia() constraints. It defaults to settings for voice with echo and noise cancellation processing, but you can override them using these settings:

navigator.mediaDevices.getUserMedia({
  audio: {
    autoGainControl: false,
    channelCount: 2,
    echoCancellation: false,
    latency: 0,
    noiseSuppression: false,
    sampleRate: 48000,
    sampleSize: 16,
    volume: 1.0
  }
});

Upvotes: 1

Related Questions