7. Playing Music - CRCibernetica/circuitpython-ideaboard GitHub Wiki
Introduction
The easiest way to play music on the IdeaBoard is to use a passive buzzer such as the one below.
The adafruit_rtttl.mpy
library is a simple method to play tunes using the RTTTL (Ring Tones Text Transfer Language). Thousands of songs can be downloaded by searching for "RTTTL songs". The RTTTL protocol is easy to learn if you want to translate songs or create sound effects.
Installation
- From the adafruit-circuitpython-bundle install the
adafruit_rtttl.mpy
library to the IdeaBoard - Use the
play
function to play the song
Example code
import board
from ideaboard import IdeaBoard
from adafruit_rtttl import play
song = "IronMan:d=4,o=5,b=155:2b4,2d5,4d5,4e5,2e5,8g5,8f#5,8g5,8f#5,8g5,8f#5,4d5,4d5,4e5,2e5"
play(board.IO27, song)