Skip to content

Commit 8023453

Browse files
Fix timing of dotted notes
Dotting a note lengthens it by 1/2. In the code, the `duration` parameter is actually a divisor of the length of the note (e.g. 1 is a whole note but 4 is a quarter note (1/4 the length)), so dotting should divide the `duration` by 1.5 instead of multiplying.
1 parent aab3fb0 commit 8023453

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

adafruit_rtttl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def _parse_note(note: str, duration: int = 2, octave: int = 6) -> Tuple[str, flo
9696
else:
9797
piano_note = note[0]
9898
if "." in note:
99-
note_duration *= 1.5
99+
note_duration /= 1.5
100100
if "#" in note:
101101
piano_note += "#"
102102
note_octave = str(octave)

0 commit comments

Comments
 (0)