-
Notifications
You must be signed in to change notification settings - Fork 0
API Modplayer
Keith McGahey edited this page Apr 8, 2026
·
1 revision
Tracker module music playback (MOD, XM, S3M formats). The mod player runs on Core 1 alongside other audio.
Create a new mod player instance.
- Parameters: None
-
Returns: (userdata) Player object, or
nil, errorStringon failure
local player, err = picocalc.modplayer.create()
if not player then
picocalc.repl.print("Error: " .. err)
endObjects returned by picocalc.modplayer.create(). The player is automatically cleaned up by the garbage collector when it goes out of scope.
Load a tracker module file from the SD card.
-
Parameters:
-
path(string): Path to a MOD, XM, or S3M file
-
-
Returns: (boolean)
trueif the file was loaded successfully
local ok = player:load("/apps/myapp/music.mod")Start playback of the loaded module.
-
Parameters:
-
loop(boolean, optional): Whether to loop playback. Defaultfalse.
-
- Returns: None
player:play(true) -- play with loopingStop playback.
- Parameters: None
- Returns: None
player:stop()Pause playback at the current position.
- Parameters: None
- Returns: None
player:pause()Resume paused playback.
- Parameters: None
- Returns: None
player:resume()Check whether the player is currently playing.
- Parameters: None
-
Returns: (boolean)
trueif playback is active
if player:isPlaying() then
picocalc.repl.print("Playing...")
endSet the playback volume.
-
Parameters:
-
vol(number): Volume level from 0 (silent) to 100 (maximum)
-
- Returns: None
player:setVolume(75)Get the current playback volume.
- Parameters: None
- Returns: (number) Current volume level (0-100)
local vol = player:getVolume()Enable or disable looping on the current module.
-
Parameters:
-
enabled(boolean):trueto loop,falseto play once
-
- Returns: None
player:setLoop(true)