Hi all!
I have this simple code:
local musicPlayer = pd.sound.fileplayer.new("sound/Luna")
outside the Init of my Sprite class and this
musicPlayer:play(0)
in the Init of my class.
It loops only once, what am I doing wrong?
Thx!
Hi all!
I have this simple code:
local musicPlayer = pd.sound.fileplayer.new("sound/Luna")
outside the Init of my Sprite class and this
musicPlayer:play(0)
in the Init of my class.
It loops only once, what am I doing wrong?
Thx!
I think you're doing it correctly.
What format is your music? If MP3 or uncompressed WAV I guess it might cause a problem somehow.
You could try increasing the buffer size.
Or try ADPCM format music which is less taxing on the system.
Hi Matt! thanks for your reply. It's a WAV file, 44khz, 24bits. Maybe the size ( 6mb ) is the issue?
I'll try to play around with the encoding to see if it helps
F.
If anyone sees this. I had the same issue with MP3 files.
using ADPCM did fix it.
here is the reference from the documentation:
Preparing your sound files
ADPCM is the ideal audio format to use for Playdate games. It is less CPU-intensive to decode than MP3, while still providing a much smaller file size than uncompressed audio.
To encode into ADPCM with Audacity
File > Export Audio… > File type: WAV (Microsoft), Encoding: IMA ADPCM.
To encode into ADPCM with ffmpeg
type `ffmpeg -i input.mp3 -acodec adpcm_ima_wav output.wav` at the command line.
And here is a small command line by me to convert multiple files in windows
for %A in ("*.mp3") DO ffmpeg -i "%A" -acodec adpcm_ima_wav "processed/%~nA.wav"
You'll get better sounding results using adpcm-xq https://github.com/dbry/adpcm-xqsearch the forum for more info on this @mirrorlink
Also if you convert from MP3 you'll get empty space at the end of the wav which means it won't loop cleanly. So you need to ideally convert a full quality PCM wav that's confirmed to loop cleanly to adpcm.