I’ve been working on a 303-ish sequenced synth for the Playdate because why not, and after banging my head against the wall attempting to write a sequencer myself, I noticed the playdate.sound.sequence functionality in the documentation. The only argument playdate.sound.sequence.new() has is midi_path, which points to a pre-existing MIDI file. Does playdate.sound.sequence only work with existing MIDI data, or can a sequence be created and modified on the fly? I’d been using a table to hold the notes used in my sequence, so is there a way to write a sequence in the code itself?
Hey! In the Lua SDK sequence.new() takes midi_path as an optional argument (you can tell from the [] surrounding it in the docs), so you should be able to create an empty sequence with new(), then add tracks to it with addTrack() or setTrackAtIndex(). You can add notes to the tracks (perhaps from the table you already have) with track.addNote() or with track.setNotes() (if you have an array of tables with keys step, note, length, and velocity). You’ll also want to look at adding instruments and additional voices to the tracks, take a look at the corresponding docs for that.
Hope that helps to get started!
My game OUTSIDE PARTIES generates procedural music on the fly as sound.sequences. Works great! Use sequence.addTrack.
So a “track” is something within a “sequence”? Thanks, I think that’s what was tripping me up since I’m used to working in DAWs, where you make a track and add a sequence to the track, instead of the other way around. I’ll try that out, thanks for clarifying the “infrastructure”!
Correct, a “sequence” is the top level entity here and it can have multiple tracks, each with multiple notes but one instrument, which in turn can have multiple voices to affect how individual notes are played or for polyphony. An instrument basically wraps around a synth, which can be sample- or waveform-based.
I just remembered that the SDK comes with a couple examples named “MIDIPlayer” and “DrumMachine” in the Examples directory that show how this general setup works, definitely recommend taking a look there too.
Just bought your game btw and I LOVE the Shepard tone effect that the scrolling clicks have!! And the controllable radio tuning effect is really impressive, is that based on the built-in synths and fx, or was it prerendered?
Thanks! Cool that you noticed that detail.
The background ambience is a pair of pre-prepared sample loops. Their pitch, volume, and stereo pan respond to the various controls. (As do the voice signals.) There are sometimes random swells of extra “hiss” using a noise synth, but those don’t react to the controls.