createCanvas(400, 400); colorMode(HSB); mic = new p5.AudioIn(); mic.start(); } function draw() { background(0, 0, 100, 0.2); fi ll(random(360), 80, 100); count++; let volume = mic.getLevel(); let d = volume * 1000; rect((-100+count*4)%width - d/2, height*0.6 - d/2, d, d); rect((-200+count*3)%width - d/2, height*0.4 - d/2, d, d); rect((-300+count*2)%width - d/2, height*0.2 - d/2, d, d); } mic.getLevel()で音量を取得する(0.0〜1.0)