Summary

This is a demonstration of a complicated bug that involves the sample values being half of what they should be when using a single channel ScriptProcessorNode with a MediaElementSourceNode connected to a multi channel input with echoCancellation disabled with navigator.getUserMedia and the Web Audio API.

To reproduce you need to have an audio interface that has at least two independent inputs.

  1. Plug an instrument into the first input (left channel). It should preferrably be some sort of synthesizer or sampler where the output will be a consistent level.
  2. Press the capture button on the top section below (using a ScriptProcessorNode configured to have 2 input channels), and observe how the level is reported at the correct level
  3. Press the capture button on the bottom section below (using a ScriptProcessorNode configured to have 1 input channel), and observe how the level is exactly half the level of the level from step 2

Notes

Get Channel Peaks (2 Channel Script Processor)

ChannelPeak
Left
Right

Get Channel Peaks (Single Channel Script Processor)

ChannelPeak
Left
Right