-
Notifications
You must be signed in to change notification settings - Fork 1
music
🎵 This function depends on music modules provided in assets/music filepath.
music [track=-1] [frame=0] [row=0] [loop=True] [sustain=False][NOT SUPPORTED] [tempo=-1][NOT SUPPORTED] [speed=-1][NOT SUPPORTED]
...or to stop the music:
music
- track : the id of the track to play (0..n)
- frame : the index of the frame to play from (0..254)
- row : the index of the row to play from (0..63)
- loop : loop music (True) or play it once (False)
sustain : sustain notes after the end of each frame or stop them (True/False)tempo : play track with the specified tempospeed : play track with the specified speed
This function starts playing a track
If you call music() within while True:
, the specified track will restart 60 times per second - probably not what was intended! You'll need to add conditional logic to ensure that the track isn't continuously restarted, for example:
#####################################
musicplaying = False
while True:
# ensure we only start the music a single time
if not musicplaying:
music(0)
musicplaying = true
#####################################