From 78c8f898e1b8a6573d6810f6c9297dccc704e597 Mon Sep 17 00:00:00 2001 From: Edric Cantu Date: Sun, 24 Mar 2024 17:04:49 +0000 Subject: [PATCH] removed herobrine --- i.css | 19 +++++++++++----- i.js | 64 ++++++++++++++++++++++++++++++++++++------------------ icon.svg | 10 ++++----- index.html | 5 +++++ 4 files changed, 67 insertions(+), 31 deletions(-) diff --git a/i.css b/i.css index 86e34d4..b72fc03 100644 --- a/i.css +++ b/i.css @@ -47,14 +47,14 @@ input[type="range"]{ border: solid 2px #fff; outline:none; color: #FFF; - font-size: 50pt; - width:5in; + font-size: 80pt; + width:6in; height:auto; border-radius: 9999px; text-align: center; display: inline; - font-family: 'Courier New', Courier, monospace; + font-family: Oxanium, Roboto; } .smallButton{ height: 60pt; @@ -64,7 +64,7 @@ input[type="range"]{ background: #000; color: #fff; border-radius: 999px; - font-size: 35pt; + font-size: 45pt; } body > div > div > button.smallbutton{ margin: 0 5pt; @@ -158,7 +158,7 @@ input[type=range] { height: 37px; -webkit-appearance: none; margin: 10px 0; - width: calc( 120pt + 5in ); + width: calc( 120pt + 6in ); outline: none !important; } input[type=range]::-webkit-slider-runnable-track { @@ -235,3 +235,12 @@ input[type=range]:focus::-ms-fill-lower { input[type=range]:focus::-ms-fill-upper { background: #FFFFFF; } + + + + + + + + +@media \ No newline at end of file diff --git a/i.js b/i.js index 7dc0781..9ea4aad 100644 --- a/i.js +++ b/i.js @@ -300,8 +300,8 @@ for(var wave of waves.querySelectorAll("input")){ -normalizeNote = function(note){ - var noteMap = { +normalizeNote = function(letter){ + return { "Cb":"BB", //// "C":"CC", //// "C#":"CD", ////---------@@@@@@@@@@ C# -- C Sharp @@ -323,26 +323,48 @@ normalizeNote = function(note){ "Bb":"AB", ////---------@@@@@@@@@@ Bb -- B Flat "B":"BB", //// "B#":"CC" //// - } - /* - var smap = { - "C":, //----------- - "CD":, //------@@@@@ - "D":, //----------- - "DE":, //------@@@@@ - "E":, //----------- - "F":, //----------- - "FG":, //------@@@@@ - "G":, //----------- - "GA":, //------@@@@@ - "A":, //----------- - "AB":, //------@@@@@ - "B":, //----------- - }*/ + }[letter]; +} +function parseNote(note, normalize=true){ + console.log(note); + var x = note.search(/\d/); + if(x<0) x = note.length// + letter = note.slice(0,x); + octave = note.slice(x) || "4";// + if(normalize) letter = normalizeNote(letter); + return {letter,octave}; +} +var smap = [ + "CC", //----------- + "CD", //------@@@@@ + "DD", //----------- + "DE", //------@@@@@ + "EE", //----------- + "FF", //----------- + "FG", //------@@@@@ + "GG", //----------- + "GA", //------@@@@@ + "AA", //----------- + "AB", //------@@@@@ + "BB", //----------- +]; +function sdiff(note1, note2) { + // Parse notes into letter and octave components + const { letter: letter1, octave: octave1 } = parseNote(note1); + const { letter: letter2, octave: octave2 } = parseNote(note2); + + // Calculate the semitone difference based on letter positions in the smap array + const semitone1 = smap.indexOf(letter1); + const semitone2 = smap.indexOf(letter2); + + // Account for octave difference (12 semitones per octave) + const octaveDiff = (octave2 - octave1) * 12; + + // Calculate semitone difference considering both letter position and octave + return semitone2 - semitone1 + octaveDiff; } function noteFreq(note, tune = "A4=440"){ - tune = tine.split("="); - tuningnote = tune[0]; - tuningfreq = tune[1]; + var [tuningnote,tuningfreq] = tune.split("="); + return modc(tuningfreq, 100*sdiff(tuningnote, note)) } diff --git a/icon.svg b/icon.svg index 0c15267..75537ca 100644 --- a/icon.svg +++ b/icon.svg @@ -1,8 +1,8 @@ - + - diff --git a/index.html b/index.html index 7ab4d55..e6995c2 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,10 @@ + + + + +