.max(dx - 1, 1), y);
            }
            ctx.stroke();
          }

          const drawWaveform = () => {
            let ctx = waveformCtx;
            let buffer = timeBuffer;
            let canvas = waveformCanvas;
            let bufferLength = buffer.byteLength;

            // Based on https://codepen.io/ContemporaryInsanity/pen/Mwvqpb
            var width = canvas.width;
            var height = canvas.height;
            var scaling = height / 256;
            var risingEdge = 0;
          