This commit is contained in:
stupidcomputer 2024-10-07 22:19:48 -05:00
parent 3fc00430b6
commit 0aca4c5738
3 changed files with 20 additions and 3 deletions

1
fetch-libs.sh Normal file → Executable file
View File

@ -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

View File

@ -2,6 +2,8 @@
<html>
<head>
<title>toolbox</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="./style.css" rel="stylesheet">
</head>
<body>
@ -28,6 +30,9 @@
<div class="param debugme">
Transpose: F
</div>
<div class="param debugme" onclick="clickhandler()">
Start Tuner
</div>
</div>
</div>
</div>
@ -45,6 +50,6 @@
</div>
</body>
<script src="./libs/jquery.js"></script>
<!-- <script src="./libs/wad.js"></script> -->
<script src="./libs/wad.js"></script>
<script src="./main.js"></script>
</html>

View File

@ -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();