diff --git a/src/index.js b/src/index.js index ab9a899..5af581d 100644 --- a/src/index.js +++ b/src/index.js @@ -57,7 +57,6 @@ async function main() { // analyser.getByteTimeDomainData(self.spectrum); spectrum.reverse(); - const volume = getRMS(spectrum); const pitch = getPitch(spectrum, volume); @@ -93,17 +92,7 @@ async function main() { sketch.colorMode(sketch.HSL, 255); }; - let shouldDraw = 0; - sketch.draw = () => { - shouldDraw += 1; - if (shouldDraw > 0) { - if (shouldDraw > 3) { - shouldDraw = -1; - } - return; - } - sketch.background(sketch.color(0, 0, 0)); for (let l = 0; l < lines.length; l++) { const lineBaseHeight = baseHeight - (l * LINE_MARGIN); @@ -112,14 +101,16 @@ async function main() { sketch.stroke(((line.pitch - minPitch) / (maxPitch - minPitch)) * 255); sketch.strokeWeight(1); sketch.beginShape(); - sketch.curveVertex(0, lineBaseHeight); + sketch.curveVertex(-10, lineBaseHeight); + sketch.curveVertex(-10, lineBaseHeight); sketch.curveVertex(0, lineBaseHeight); for (let i = 1; i < line.spectrum.length - 1; i++) { const point = line.spectrum[i]; sketch.curveVertex(i * spectrumPointWidth, lineBaseHeight - point); } sketch.curveVertex(window.innerWidth, lineBaseHeight); - sketch.curveVertex(window.innerWidth, lineBaseHeight); + sketch.curveVertex(window.innerWidth + 10, lineBaseHeight); + sketch.curveVertex(window.innerWidth + 10, lineBaseHeight); sketch.endShape(); } };