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

music

⚠️ This function contains default values in one or more parameters different from the source, but for practical purposes, they do not affect its functionality. It will be fixed as soon as possible.
🎵 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..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

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