squash 2
This commit is contained in:
parent
3fc00430b6
commit
0aca4c5738
|
@ -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
|
|
@ -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>
|
15
src/main.js
15
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();
|
||||
|
|
Loading…
Reference in New Issue