adafruit / Adafruit_CircuitPython_RTTTL

Play RTTTL tunes in CircuitPython
MIT License
4 stars 12 forks source link

Added support for handling boards without builtin speakers #2

Closed brentru closed 6 years ago

brentru commented 6 years ago

Uses tone() from simpleio to avoid using builtin speakers on boards without them (square wave instead of sine wave for a piezo)

@ladyada

ladyada commented 6 years ago

looks good, please refactor to avoid the big code dupliation!

+            p = None
+            d = duration
+            if note[0].isdigit():
+                d = int(note[0])
+                p = note[1]
+            else:
+                p = note[0]
+            if "." in note:
+                d *= 1.5
+            if "#" in note:
+                p += "#"
+            o = octave
+            if note[-1].isdigit():
+                o = note[-1]
+            p = o + p

etc

tannewt commented 6 years ago

There are outstanding comments and no response. Please reopen if you want to continue this.