Skip to content

Commit 770a6e6

Browse files
fix(rhythmruler): use meter-based count-off instead of hardcoded 4 beats (#5053)
- Get beatsPerMeasure from turtle.singer instead of using hardcoded 4 - Count-off now correctly matches the time signature (e.g., 3 beats for 3/4) - Fixed timing calculation to properly space count-off beats across interval This resolves the FIXME comment at line 973 that requested updating the count-off to be based on meter rather than always running 4 times.
1 parent 0a6eb7c commit 770a6e6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

js/widgets/rhythmruler.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -970,8 +970,12 @@ class RhythmRuler {
970970
drum = this.activity.blocks.blockList[drumBlockNo].value;
971971
}
972972

973-
// FIXME: Should be based on meter
974-
for (let i = 0; i < 4; i++) {
973+
// Get the meter from the current turtle's singer
974+
const turtle = this.activity.turtles.ithTurtle(0);
975+
const beatsPerMeasure = turtle.singer.beatsPerMeasure || 4;
976+
977+
// Play count-off based on meter (e.g., 4 beats for 4/4, 3 beats for 3/4)
978+
for (let i = 0; i < beatsPerMeasure; i++) {
975979
setTimeout(() => {
976980
this.activity.logo.synth.trigger(
977981
0,
@@ -981,7 +985,7 @@ class RhythmRuler {
981985
null,
982986
null
983987
);
984-
}, (interval * i) / 4);
988+
}, (interval * i) / beatsPerMeasure);
985989
}
986990

987991
setTimeout(() => {

0 commit comments

Comments
 (0)