Open
Description
I wonder how one would access the signal of the input device inside an associated AudioContext.
It would be possible with the current API but I think it's not very elegant. The following would, for example, apply a simple gain to the input:
// inputDeviceId is a variable with holds the device id of the desired input device.
const client = await navigator.mediaDevices.getAudioDeviceClient({ inputDeviceId });
const mediaStream = await navigator.mediaDevices.getUserMedia({ audio: { deviceId: { exact: inputDeviceId } } });
const context = client.getContext();
const mediaStreamSourceNode = new MediaStreamSourceNode(context, { mediaStream });
const gainNode = new GainNode(context, { gain: 0.5 });
mediaStreamSourceNode
.connect(gainNode)
.connect(context.destination);