We are about to switch to a new forum software. Until then we have removed the registration on this forum.
This code freezes/crashes every time I run it & make a loud sound. In my sound environment, micLevel is returning values around .01 most of the time, so the while condition should return FALSE most of the time. Is this a bug? Or some audio issue? Or am I obliviously doing something dumb? Thanks for any help!
var mic; var micLevel;
function setup() { createCanvas(500,500); mic = new p5.AudioIn() mic.start(); }
function draw() { background(127); micLevel = mic.getLevel(); text(micLevel, 10, 20); while (micLevel > .1) { micLevel = mic.getLevel(); //this line doesn't seem to update micLevel variable. text(micLevel, 10, 20); } }
Answers
while ()
loop is gonna get stuck "forever"! :-SS