squash 2
This commit is contained in:
parent
3fc00430b6
commit
0aca4c5738
|
@ -1,4 +1,5 @@
|
||||||
#!/bin/sh
|
#!/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/web-audio-daw@4.13.2 -Lo src/libs/wad.js
|
||||||
curl https://unpkg.com/jquery@3.7.1 -Lo src/libs/jquery.js
|
curl https://unpkg.com/jquery@3.7.1 -Lo src/libs/jquery.js
|
|
@ -2,6 +2,8 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>toolbox</title>
|
<title>toolbox</title>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link href="./style.css" rel="stylesheet">
|
<link href="./style.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -28,6 +30,9 @@
|
||||||
<div class="param debugme">
|
<div class="param debugme">
|
||||||
Transpose: F
|
Transpose: F
|
||||||
</div>
|
</div>
|
||||||
|
<div class="param debugme" onclick="clickhandler()">
|
||||||
|
Start Tuner
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,6 +50,6 @@
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
<script src="./libs/jquery.js"></script>
|
<script src="./libs/jquery.js"></script>
|
||||||
<!-- <script src="./libs/wad.js"></script> -->
|
<script src="./libs/wad.js"></script>
|
||||||
<script src="./main.js"></script>
|
<script src="./main.js"></script>
|
||||||
</html>
|
</html>
|
15
src/main.js
15
src/main.js
|
@ -1,7 +1,8 @@
|
||||||
function clickhandler() {
|
function clickhandler() {
|
||||||
const voice = new Wad({source: 'mic'});
|
const voice = new Wad({source: 'mic'});
|
||||||
const tuner = new Wad.Poly();
|
const tuner = new Wad.Poly();
|
||||||
const pitchoutput = document.getElementById("pitch");
|
const pitchoutput = document.getElementById("higherfreq");
|
||||||
|
const noteoutput = document.getElementById("detectednote");
|
||||||
|
|
||||||
tuner.setVolume(0);
|
tuner.setVolume(0);
|
||||||
tuner.add(voice);
|
tuner.add(voice);
|
||||||
|
@ -12,7 +13,17 @@ function clickhandler() {
|
||||||
|
|
||||||
const logPitch = function() {
|
const logPitch = function() {
|
||||||
console.log(tuner.pitch);
|
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);
|
requestAnimationFrame(logPitch);
|
||||||
};
|
};
|
||||||
logPitch();
|
logPitch();
|
||||||
|
|
Loading…
Reference in New Issue