OAVp5.mic.stop()#
functionoav-p5OAVp5.mic.stop()
Turns the microphone off and sets every microphone value back to 0: the same as stopMic().
stopMic() is this function. It stops the microphone's tracks and closes its audio context, so the browser's "recording" indicator goes away, and OAVp5.mic.level, bass, mid, treble, rms read 0 and db reads −100. After it, only OAVp5.mic.start() or 🎤 turns the microphone back on: reading micLevel does not.
Returns
Promise<Boolean> Resolves to false, the new state of the microphone.
Examples
function setup() {
createCanvas(400, 300);
startMic();
}
function mousePressed() {
OAVp5.mic.stop(); // the browser's recording indicator goes away
}
function draw() {
background(20);
fill(255);
text('microphone: ' + OAVp5.mic.state + ' (click the canvas to stop it)', 20, 30);
circle(width / 2, height / 2, 50 + OAVp5.mic.level * 300);
}Related
stopMic()Turns the microphone off and sets every microphone value back to 0.OAVp5.mic.start()Turns the microphone on and returns a promise that says whether it worked: the same asstartMic().OAVp5.mic.stateWhere the microphone is:'off','asking','on','denied'or'unavailable'.micIsOnWhether the microphone is running right now.