Created
June 22, 2020 06:13
-
-
Save Anduin2017/a420896b61a3881cfae3de42716088c8 to your computer and use it in GitHub Desktop.
Echo back microphone.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | |
<title>capture microphone audio into buffer</title> | |
<script type="text/javascript"> | |
var audioContext = new AudioContext(); | |
if (navigator.getUserMedia) { | |
navigator.getUserMedia({ audio: true }, function (stream) { | |
var streamSource = audioContext.createMediaStreamSource(stream); | |
var gain = audioContext.createGain(); | |
gain.connect(audioContext.destination); | |
streamSource.connect(gain); | |
document.getElementById('volume').addEventListener('change', function () { | |
gain.gain.value = this.value; | |
}); | |
}, function () { | |
}); | |
} | |
</script> | |
</head> | |
<body> | |
<p>Volume</p> | |
<input id="volume" type="range" min="0" max="1" step="0.1" value="0.5" /> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment