diff --git a/fetch-libs.sh b/fetch-libs.sh old mode 100644 new mode 100755 index a1456b8..76214cc --- a/fetch-libs.sh +++ b/fetch-libs.sh @@ -1,4 +1,5 @@ #!/bin/sh +mkdir -p src/libs curl https://unpkg.com/web-audio-daw@4.13.2 -Lo src/libs/wad.js curl https://unpkg.com/jquery@3.7.1 -Lo src/libs/jquery.js \ No newline at end of file diff --git a/src/index.html b/src/index.html index 253b952..9c612bb 100644 --- a/src/index.html +++ b/src/index.html @@ -2,6 +2,8 @@ toolbox + + @@ -28,6 +30,9 @@
Transpose: F
+
+ Start Tuner +
@@ -45,6 +50,6 @@ - + \ No newline at end of file diff --git a/src/main.js b/src/main.js index 3787599..aed7510 100644 --- a/src/main.js +++ b/src/main.js @@ -1,7 +1,8 @@ function clickhandler() { const voice = new Wad({source: 'mic'}); const tuner = new Wad.Poly(); - const pitchoutput = document.getElementById("pitch"); + const pitchoutput = document.getElementById("higherfreq"); + const noteoutput = document.getElementById("detectednote"); tuner.setVolume(0); tuner.add(voice); @@ -12,7 +13,17 @@ function clickhandler() { const logPitch = function() { console.log(tuner.pitch); - pitch.innerHTML = tuner.pitch; + let pitch = tuner.pitch; + if (pitch === undefined) { + pitch = "??"; + } + + let note = tuner.noteName; + if(note === undefined) { + note = "??"; + } + pitchoutput.innerHTML = pitch; + noteoutput.innerHTML = note; requestAnimationFrame(logPitch); }; logPitch();