I've been continuing this project purely for "track-making" on Playdate, so I hadn't anticipated game developers incorporating the compositions made by Yacht for their games. However, I am interested in making that happen!
Playback essentially utilizes the playdate.sound API. Synthesis and Sample player too. The composed song data is exported (saved) as JSON, but it's not compatible with formats used in libraries like Pulp. Nevertheless, should be able to implement that playback engine it relatively easily.
In the early stages of the project, I created a "musical tick" using playdate.resetElapsedTime(), but it was unstable. So, I'm using the classic method of tempo management by watching dummy playdate.sound.sequence. However, playdate.sound still has its quirks, and I've noticed occasional tempo glitches, which is why I set the FPS to "0". This might not be ideal for most game developers!
do you have any ideas?
for reference song data in Lua
song = {
name = "song1",
bpm = 120.0,
volume = 1.0,
length = 32, -- song bars
tracks = 4, -- tracks synth1,2,3+drums(4ch)
struct = {
-- song struct
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
},
synth1 = { -- synth track
waveform = 1,
volume = 1.0,
pan = 0.0,
attack = 0,
decay = 0.1,
sustain = 0,
release = 0.0,
pattern = {
{
length = 16,
direction = 1,
notes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
-- note numbers, 0: noteoff, 128: legato
},
-- ......
},
},
drum1 = { -- drums track....
bank = 1,
type = 4,
volume = 1,
pan = 1.0,
pattern = {
{
length = 16,
direction = 1,
notes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
-- boolean
},
-- ......
},
},
}