  var edgeThreshold = 5;

            analyser.getByteTimeDomainData(buffer);

            // clear canvas
            ctx.fillStyle = 'rgba(0, 10, 0, 0.1)';
            ctx.fillRect(0, 0, width, height);

            ctx.lineWidth = 2;
            ctx.strokeStyle = 'rgb(0, 200, 0)';
            ctx.beginPath();

            // No buffer overrun protection
            while (buffer[risingEdge++] - 128 > 0 && risingEdge <= width);
            if (risingEdge >= width) risingEdge = 0;

            while (buffe