diff --git a/index.html b/index.html index adc6550..b2606f3 100644 --- a/index.html +++ b/index.html @@ -616,8 +616,8 @@ function drawSpectrum() { else { vuPeakR *= 0.990; } drawVuRow(0, levelL); drawVuRow(gap + rowH, levelR); - const piL = Math.round(vuPeakL * segCount); - const piR = Math.round(vuPeakR * segCount); + const piL = Math.min(segCount - 1, Math.round(vuPeakL * segCount)); + const piR = Math.min(segCount - 1, Math.round(vuPeakR * segCount)); if (vuPeakL > 0.05) { vuctx.fillStyle = '#e98989'; vuctx.fillRect(segLeft + piL * (segW + segG), 0, segW, rowH);