Both MIDI files I attached play fine in GarageBand. But when executing the lua code above, I don't hear anything.
note that the err variable was just something I tried, folling conventions from other loader funxctions in the sdk. For sequence.new no error return argument is specified though.
From the print output, we can see that the file was found on disk. the length and number of tracks is non-zero. When I change the file path to the other midi file, values do change
my laptop's audio is OK. I can hear sound effects loaded with sampleplayer.
What am I missing? Should I load the sequence in a channel before playback or something?
Allright, I found the MidiPlayer sample project in the SDK; and when I plug my files in there, actual sound comes out. In the code, track 10 is mapped to a drums instrument. Is it convention in midi-land that track 10 is a drum track? Or was this sample project written with the bundled giveyouup.mid in mind?
The result is very rough/ old-skool though, because all tracks in the midi file, a saw-tooth instrument is created. The style actually suits the final countdown song, but in garageband, the cgmusic file sounds considerably richer
So it seems playdate needs to be told what instruments to use for each track though. Using track:getInstrument() returns nil initially after loading the midi file. GarageBand does an excellent job of gathering that info from just loading the file tho. So I guess the playdate sdk doesn't read that information.
Are these mappings available for playdate as well?