This commit is contained in:
stupidcomputer 2024-10-07 17:50:47 -05:00
parent dad76b04d1
commit 3fc00430b6
5 changed files with 157 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
src/libs/*

4
fetch-libs.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
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

50
src/index.html Normal file
View File

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<title>toolbox</title>
<link href="./style.css" rel="stylesheet">
</head>
<body>
<div id="container">
<div id="maincontent">
<div id="tunerpage">
<div id="tunerview">
<canvas id="tunerbackground"></canvas>
<div id="resultcontainer" class="debugme">
<span id="higherdiff">(+10c)</span>
<span id="higherfreq">400.23hz</span>
<span id="detectednote">F#4</span>
<span id="lowerfreq"> </span>
<span id="lowerdiff"> </span>
</div>
</div>
<div id="params">
<div class="param debugme">
Temperment: Equal
</div>
<div class="param debugme">
A4 = 440
</div>
<div class="param debugme">
Transpose: F
</div>
</div>
</div>
</div>
<div id="bottombar">
<div class="barmember debugme">
Tuner
</div>
<div class="barmember debugme">
Metronome
</div>
<div class="barmember debugme">
Settings
</div>
</div>
</div>
</body>
<script src="./libs/jquery.js"></script>
<!-- <script src="./libs/wad.js"></script> -->
<script src="./main.js"></script>
</html>

25
src/main.js Normal file
View File

@ -0,0 +1,25 @@
function clickhandler() {
const voice = new Wad({source: 'mic'});
const tuner = new Wad.Poly();
const pitchoutput = document.getElementById("pitch");
tuner.setVolume(0);
tuner.add(voice);
voice.play();
tuner.updatePitch();
const logPitch = function() {
console.log(tuner.pitch);
pitch.innerHTML = tuner.pitch;
requestAnimationFrame(logPitch);
};
logPitch();
}
$(document).ready(function() {
$('.debugme').each(function () {
var hue = 'rgb(' + (Math.floor((256-199)*Math.random()) + 200) + ',' + (Math.floor((256-199)*Math.random()) + 200) + ',' + (Math.floor((256-199)*Math.random()) + 200) + ')';
$(this).css("background-color", hue);
});
});

77
src/style.css Normal file
View File

@ -0,0 +1,77 @@
#container {
display: flex;
width: 100%;
height: 100vh;
flex-direction: column;
flex-wrap: nowrap;
}
#params {
display: flex;
flex-direction: row;
}
#bottombar {
display: flex;
flex-direction: row;
}
.barmember, .param {
width: 100%;
height: 4em;
text-align: center;
}
#maincontent {
flex-grow: 1;
min-width: 0;
height: 100%;
}
#resultcontainer {
flex-grow: 1;
min-width: 0;
display: flex;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
flex-direction: column;
justify-content: center;
align-items: center;
}
#higherdiff, #higherfreq, #lowerfreq, #lowerdiff {
font-size: 1em;
min-height: 1em;
min-width: 1px;
}
body {
margin: 0px;
}
#tunerview {
height: 100%;
position: relative;
}
#tunerpage {
display: flex;
flex-direction: column;
height: 100%;
}
#tunerbackground {
position: absolute;
z-index: -1;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
#detectednote {
font-size: 4em;
}