|
|
@ -8,10 +8,11 @@ bpm.addEventListener("change", (e) => {
|
|
|
|
const newChannel = document.getElementById("new-channel");
|
|
|
|
const newChannel = document.getElementById("new-channel");
|
|
|
|
const insert = document.getElementById("insert");
|
|
|
|
const insert = document.getElementById("insert");
|
|
|
|
insert.addEventListener("click", (e) => {
|
|
|
|
insert.addEventListener("click", (e) => {
|
|
|
|
const newSequence = newChannel.querySelector("input[type=text]").value;
|
|
|
|
input = newChannel.querySelector("input[type=text]");
|
|
|
|
|
|
|
|
const newSequence = input.value;
|
|
|
|
if (newSequence) {
|
|
|
|
if (newSequence) {
|
|
|
|
createChannel(rebuildArray(newSequence));
|
|
|
|
createChannel(rebuildArray(newSequence));
|
|
|
|
newChannel.value = "";
|
|
|
|
input.value = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -24,8 +25,6 @@ document.getElementById("start")?.addEventListener("click", async () => {
|
|
|
|
newChannel.classList.remove("hidden");
|
|
|
|
newChannel.classList.remove("hidden");
|
|
|
|
|
|
|
|
|
|
|
|
createChannel(["C4", null, null, "F4", null, null, null]);
|
|
|
|
createChannel(["C4", null, null, "F4", null, null, null]);
|
|
|
|
createChannel([["C3", ["F3", "G3", "A#3"]], "C3", ["D#3", "D3"], "F3"]);
|
|
|
|
|
|
|
|
createChannel(["C3", ["G3", ["F3", "A#3"]], "C3", ["D#3", "D3"], "F3"]);
|
|
|
|
|
|
|
|
createChannel(["C3", "F3"]);
|
|
|
|
createChannel(["C3", "F3"]);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -84,7 +83,11 @@ let createChannel = function (sequence) {
|
|
|
|
|
|
|
|
|
|
|
|
function simplifyArray(literal) {
|
|
|
|
function simplifyArray(literal) {
|
|
|
|
// Sorry for this
|
|
|
|
// Sorry for this
|
|
|
|
return literal.replaceAll('"', "").replaceAll("'", "").replaceAll(",", ", ");
|
|
|
|
return literal
|
|
|
|
|
|
|
|
.replaceAll('"', "")
|
|
|
|
|
|
|
|
.replaceAll("'", "")
|
|
|
|
|
|
|
|
.replaceAll(",", ", ")
|
|
|
|
|
|
|
|
.replaceAll("null", "-");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function rebuildArray(literal) {
|
|
|
|
function rebuildArray(literal) {
|
|
|
@ -100,6 +103,7 @@ function rebuildArray(literal) {
|
|
|
|
let array = JSON.parse(rebuild);
|
|
|
|
let array = JSON.parse(rebuild);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
getAllIndexes(array, "null").forEach((index) => (array[index] = null));
|
|
|
|
getAllIndexes(array, "null").forEach((index) => (array[index] = null));
|
|
|
|
|
|
|
|
getAllIndexes(array, "-").forEach((index) => (array[index] = null));
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
|
|
|
console.log(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|