Tracker module playback library

I've always thought that tracker music would be perfect for Playdate games. I've tried building GitHub - dashodanger/mod4play: Lightweight embeddable replayer for IT/S3M/XM/MOD modules library and it worked!

Unfortunately, the performance is not very good now. 8-channel S3Ms choke on my RevA Playdate. However, surprisingly, 8-12 channel XMs play well, but take ~40% of CPU time. RevB Playdates perform significantly better. I'm thinking of trying to optimize mixing routines in the future.

You can try the player now: GitHub - Megus/PDMod4Play: Tracker module player demo for Playdate

This demo app is not meant to be a proper module player but more like a demo for developers. Add MOD/S3M/XM/IT modules to the Source folder and app will recognize them.

I would appreciate if somebody else will also be interested in the attempts to optimize it.

9 Likes

This is really cool and will be even cooler when Bluetooth audio is implemented

That's cool! I've been working on my own s3m player, so I'm curious about how your efforts have been going, particularly with performance issues.

Am I correct that this library you're using does all the calculations internally for producing the audio from a tracker file, and then you send that directly to the Playdate? Or are you utilizing the Playdate's audio engine in some capacity? (e.g. using channels, PDSynth instruments, etc.)

Yes, it's a generic module playing library, not Playdate-specific. I just added a little bit of Playdate integration on top of it. No PDSynth-like trickery.

I haven't had time to work on performance optimization yet. But as I'd like to use it in my game, I will definitely get back to it.

If it helps, the S3M player I'm working on that uses PDSynth can play back an 8 channel track and uses around 25-30% CPU to do so, which leaves a good amount of space for game logic and graphics. Though I've only implemented a small subset of all of the effects so far, and there's a few where I'm not yet sure how I'm going to do it. But it at least shows it's possible to get the Playdate to play back these sorts of tracker files.

It'd be great if you can manage to optimize mod4play enough that it can play any of the major tracker formats you throw at it, including XMs and ITs, complete with accurate implementations of all the effects. I wonder if it'd be an optimization to have each channel playing to a SoundChannel and use that to do the mixing for you.