From 8023453f975dfa2baecb3881db8a718bfd11cb7c Mon Sep 17 00:00:00 2001 From: duckythescientist Date: Sun, 4 Sep 2022 17:35:14 -0400 Subject: [PATCH] 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. --- adafruit_rtttl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_rtttl.py b/adafruit_rtttl.py index 95e1a7f..7bca916 100644 --- a/adafruit_rtttl.py +++ b/adafruit_rtttl.py @@ -96,7 +96,7 @@ def _parse_note(note: str, duration: int = 2, octave: int = 6) -> Tuple[str, flo else: piano_note = note[0] if "." in note: - note_duration *= 1.5 + note_duration /= 1.5 if "#" in note: piano_note += "#" note_octave = str(octave)