Make sound effects with frequencies
# Ta-Daaa!
speaker.play(262, 0.1) # short c note
sleep(0.1) # rest
speaker.play(262, 0.4) # long c note
lightbulb Note names
Notes go from 150 (low) to 10000 (high).
bug_report My note doesn't sound right
-
Make sure you are using a number higher than
150. -
Make sure you have setup the
Speaker.
Make sound effects with frequencies
# A series of high-pitched chirps
for _ in range(2): # decreasing frequency
for i in range(5000, 2999, -100):
speaker.play(i, 0.02) # very short length
sleep(0.2)
lightbulb Note length
The default length is 1 second. Specify a different length with a number.
lightbulb Use a rest
A rest is a short break. If you don't add in a rest the notes blend into one.