-
Notifications
You must be signed in to change notification settings - Fork 1
music
Kyuchumimo edited this page Oct 6, 2022
·
22 revisions
🎵 This function depends on music modules provided in assets/music filepath.
music [track=-1] [frame=-1] [row=-1] [loop=True] [sustain=False][NOT SUPPORTED] [tempo=-1] [speed=-1]
...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 tempo
- speed : 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
def TIC():
# ensure we only start the music a single time
if not musicplaying:
music(0)
musicplaying = true
#####################################