Skip to content

Instantly share code, notes, and snippets.

@mcrisc
Last active November 30, 2022 18:27
Show Gist options
  • Save mcrisc/2fe2b8bf1d92a19cf614dafdc9e3b575 to your computer and use it in GitHub Desktop.
Save mcrisc/2fe2b8bf1d92a19cf614dafdc9e3b575 to your computer and use it in GitHub Desktop.
# Superman March, by John Williams, played by a Raspberry Pi Pico
# Tutorial: Using buzzers with Raspberry Pi Pico - https://projects.raspberrypi.org/en/projects/introduction-to-the-pico/9
# Music Scores: https://musicum.net/superman.pdf
# Video: https://youtu.be/u6veDQYzYYk
import time
from picozero import Speaker
BPM = 76
BEAT = 60.0 / BPM
tune = [
('d5', BEAT), ('d5', BEAT/3), ('g4', BEAT/3), ('d5', BEAT/3), ('d5', BEAT*2),
('g5', BEAT), ('d5', BEAT), ('g4', BEAT*2),
('d5', BEAT), ('d5', BEAT/3), ('g4', BEAT/3), ('d5', BEAT/3), ('d5', BEAT*2),
('b5', BEAT/2), ('a5', BEAT/4), ('a5', BEAT*1.5)
]
speaker = Speaker(5)
speaker.play(tune)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment