Skip to content
Kyuchumimo edited this page Mar 10, 2022 · 22 revisions

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

Parameters

  • track : the id of the track to play (0..7)
  • frame : the index of the frame to play from (0..15)
  • 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

Description

This function starts playing a track

Tip

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

#####################################
Clone this wiki locally