Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
momentollogy committed Apr 15, 2023
1 parent c192ae3 commit 52437c0
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,14 @@ <h1>Arduino Piano Buzzer Song Creator V1 <br> <small>by momentollogy</small><br>
2592: "NOTE_WHOLE",
};

if (!isRest) {
if (sliderValue >= 0.5) {
delete noteLengths[108]; // Remove 32nd notes based on the slider value
}
if (sliderValue >= 1) {
delete noteLengths[216]; // Remove 16th notes based on the slider value
}
}
// if (!isRest) {
// if (sliderValue >= 0.5) {
// delete noteLengths[108]; // Remove 32nd notes based on the slider value
// }
// if (sliderValue >= 1) {
// delete noteLengths[216]; // Remove 16th notes based on the slider value
// }
// }

let closestDuration = Object.keys(noteLengths).reduce((prev, curr) => {
return Math.abs(curr - duration) < Math.abs(prev - duration) ? curr : prev;
Expand Down Expand Up @@ -489,16 +489,16 @@ <h1>Arduino Piano Buzzer Song Creator V1 <br> <small>by momentollogy</small><br>

console.log('Playing note:', note); // Debug: log the current note

// if (note.rest) {
// console.log(`Waiting (rest) for ${note.duration}ms`); // Debug: log the rest duration
// await new Promise(resolve => setTimeout(resolve, note.duration + timeBetweenNotesMs));
// } else {
// const keyElement = document.querySelector(`.key[data-note="${getKeyCodeForFrequency(note.frequency)}"]`);
//
// if (!keyElement) {
// console.error('Could not find key element for note:', note);
// continue;
// }
if (note.rest) {
console.log(`Waiting (rest) for ${note.duration}ms`); // Debug: log the rest duration
await new Promise(resolve => setTimeout(resolve, note.duration + timeBetweenNotesMs));
} else {
const keyElement = document.querySelector(`.key[data-note="${getKeyCodeForFrequency(note.frequency)}"]`);

if (!keyElement) {
console.error('Could not find key element for note:', note);
continue;
}

const oscillator = playNote(note.frequency, keyElement);

Expand Down

0 comments on commit 52437c0

Please sign in to comment.