JSFiddle - React, Tailwind, and code Playground
by Eve Weinberg
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/p5.js/0.3.3/p5.min.js"></script>
<script src="//tonejs.github.io/CDN/r6/Tone.min.js"></script>
JavaScript
var meter = new Tone.Meter();
meter.smoothing = 0.92 //from 0 t0 1
//slow up and slow down
function setup(){
createCanvas(300, 300);
//open up the microphone
var mic = new Tone.Microphone().open().start().connect(meter);
}
function draw(){
background(255);
//draw the current level using the meter
var level = meter.getLevel();
fill(0);
rect(0, height - level * height, width, height);
}