NetStorm84 / Metronome

A Visual Metronome
https://netstorm84.github.io/Metronome/
2 stars 15 forks source link

Implement beats per bar #14

Closed chrismilson closed 4 years ago

chrismilson commented 4 years ago

There is now a second number input. It specifies the number of beats in a bar.

I am not sure what the intended behaviour is, but I assume it will mean something different happens on the first beat in every bar. This code in script.js can easily be changed to implement such behaviour:

// cahnge color and play sound when progress bar is 100% width
function endProgress() {
    metronome.style.background = getRandomColor();
    if (beatNum == 0) {
        // Do something for the first beat
        new Audio("assets/click.wav").play();
    } else {
        new Audio("assets/click.wav").play();
    }
    beatNum = (beatNum + 1) % bpb;
}
chrismilson commented 4 years ago

This would close #9.

NetStorm84 commented 4 years ago

Thanks for the effort but not quite the functionality I was going for.