<guitar-tuner> Web-component or svelte component
npm install guitar-tuneror include into your website.
``html`
...
...
...
example / default:
`js`
function drawCanvas(ctx, pitch, note, detune) {
ctx.fillStyle = "rgb(166, 166, 166)";
ctx.font = "12px Arial";
ctx.fillText(chamber_pitch + ' Hz', 3, 14);
ctx.fillText(pitch, 3, 26);
ctx.font = "28px Arial";
ctx.fillText(note, (width / 2) - 10, 30);
let color = Math.abs(detune) 10 > 255 ? 255 : Math.abs(detune) 10;
ctx.strokeStyle = "rgb(" + color + ", 0, 0)";
ctx.beginPath();
ctx.moveTo((width / 2), height - 5);
let scale = Math.abs(detune) > 5 ? 2 : 1;
ctx.lineTo((width / 2) + detune * scale, height - 5);
ctx.lineTo((width / 2) + detune * scale, height - 15);
ctx.lineTo((width / 2), height - 15);
ctx.lineTo((width / 2), height - 5);
ctx.stroke();
ctx.closePath();
ctx.fillStyle = "rgb(" + color + ", 0, 0)";
ctx.fill();
}
JS-Example using Parameter.
`html
...
<-
pitch
+>
mic[on/off]
``