diff --git a/12/index_test.html b/12/index_test.html index bb5a824..d006aae 100644 --- a/12/index_test.html +++ b/12/index_test.html @@ -9,6 +9,10 @@ + + + +
↰ Main Page
diff --git a/12/sketch.js b/12/sketch.js new file mode 100644 index 0000000..23923a7 --- /dev/null +++ b/12/sketch.js @@ -0,0 +1,22 @@ +let mic, fft; + +function setup() { + createCanvas(710, 400); + noFill(); + + mic = new p5.AudioIn(); + mic.start(); + fft = new p5.FFT(); + fft.setInput(mic); +} + +function draw() { + background(200); + + let spectrum = fft.analyze(); + beginShape(); + for (i = 0; i < spectrum.length; i++) { + vertex(i, map(spectrum[i], 0, 255, height, 0)); + } + endShape(); +}