Broken audio synth playback from .aif sample

Hi all!

I'm working on a small Playdate project where an audio sequence is played by turning the crank. As this requires manual control over the timing of the audio playback I ended up with a solution using the sound.sequence.goToStep function.

All seemed fine until updating to the latest playdate and SDK versions (1.12.2) where now suddently, the audio doesn't sound right anymore and often stutters and crackles. Here is a short example that I recorded.
I believe this is a bug with the current SDK version and it goes away again when I downgrade back to SDK 1.11.0.

Some more details:

  • The problem happens both in the simulator (I'm on macOS) and on the Playdate itself.
  • I'm using sound.sequence with multiple tracks.
  • Each track has a sound.synth with a sound.sample that is loaded from a short .aif file. When not providing a sample (i.e. the synth uses one of the built-in waveforms) it seems to also work correctly.
  • Unfortunately, the problem isn't trivial to reproduce as the problem doesn't happen every time the program runs. On average I'd say the bug is triggered every second time or so---but sometimes it doesn't happen a few times in a row and other times it happens almost every time.

Here is a simplified version of my code that simply plays the sequence once but still triggers the issue:

Example code
import "CoreLibs/timer"

local snd <const> = playdate.sound
local timer <const> = playdate.timer

length = 10
n_notes = 9
noteLabels = {}
noteLabels[1]  = "C4"
noteLabels[2]  = "E4"
noteLabels[3]  = "G4"
noteLabels[4]  = "C6"
noteLabels[5]  = "E6"
noteLabels[6]  = "G6"
noteLabels[7]  = "C8"
noteLabels[8]  = "E8"
noteLabels[9]  = "G8"

sample ="sample.aif")

sequence =
for i=1,n_notes do
    local track =

    local notes = {}
    for j=1,length do
        local tmp = {}
        tmp.step = j
        tmp.note = noteLabels[i]
        tmp.velocity = 1.0
        tmp.length = 15
        notes[j] = tmp


    -- Create synth from audio sample.
    local synth =

    -- Alternatively, a standard synth without sample sounds just fine:
    -- local synth =
    -- synth:setADSR(0.1, 0.1, 0.0, 0.5)



played = false
function playdate.update()
    if not played then
        sequence:goToStep(1, false)
        played = true

See also this zip file that includes the .pdx, the makefile, and the "sample.aif" file.

I'd appreciate any help!



FWIW this still seems to be a problem with SDK 1.12.3. Any updates on this?

1 Like

I've got this fixed, finally! Sorry I missed this post first time around. :flushed: We'll get 1.13 out as soon as we can. :crossed_fingers:

1 Like

Amazing---thanks for your hard work!!
And thanks for the workaround proposed in the other thread, switching the sample to mono indeed works for now :slight_smile:

1 Like