Audio Functions¶
These functions play music created in the Sound Editor.
play_music¶
- play_music(index)¶
Play a music slot from the Sound Editor.
- Parameters:
index (number) – Optional zero-based music slot index.
0plays the first Sound Editor slot,1plays the second slot, and so on.
When
indexis omitted, the engine plays the default selected slot, which is currently slot0.If the project has no sound data, the call is a silent no-op – nothing plays and no error is raised.
function _init() play_music(0) -- play Sound Editor slot 1 end
stop_music¶
- stop_music()¶
Stop the current music playback.
if key_pressed(" ") then stop_music() end