I'm trying to adjust microphone volume in Chrome App. Is is possible to do it? I'm using webrtc.
Asked
Active
Viewed 7,499 times
1 Answers
5
It's possible
- to use WebAudio and a gain filter to adjust the volume
- to set the volume of an audio/video tag (on the receiving end)
Here is some sample code for the first option
var audioContext = new AudioContext();
var sourceStream = audioContext.createMediaStreamSource(yourStream);
var gain = audioContext.createGain();
sourceStream.connect(gain);
gain.value = 0.9;
gain.connect(audioContext.destination);
and then use audioContext.createMediaStreamDestination().stream
. yourStream
is the original stream that you got from getUserMedia()
.

Adrian Ber
- 20,474
- 12
- 67
- 117
-
Hi ;) I used second option to change speakers volumne but how can I do this for microphone? Or can you give me an example for first option? – user3025978 Feb 12 '16 at 13:03
-
I updated my answer. But I'll go for the second option. You cannot set the hardware options that you can set by right clicking on the speaker tray icon, selecting the microphone and then adjusting its level (supposing that you're in Windows). – Adrian Ber Feb 12 '16 at 13:12
-
Just note that the PeerConnection automatically controls volume, so using the answer above any dampening wil result in a higher HW microphone volume untill maximum is reached. – Bas Goossen Dec 08 '16 at 08:42