Setting parameters on synths only works after the synth has been played

,

Platform: Mac Simulator
SDK 1.12.2

In my testing, setting a parameter on a synth has no effect unless it's done after the synth has already been played. This is problematic for doing things like configuring synth parameters at the time of their instantiation (though of course it can probably be worked around). Here's an example of what I'm talking about:

local snd = playdate.sound
math.randomseed(playdate.getSecondsSinceEpoch())

function newsynth()
  local s = snd.synth.new(snd.kWavePOVosim)
  s:setVolume(0.5)
  s:setAttack(0.0)
  s:setDecay(0.5)
  s:setSustain(0)
  s:setRelease(0)
  return s
end

local synth = newsynth()

-- This doesn't work
-- function playdate.AButtonDown()
--   synth:setParameter(2, math.random())
--   synth:playNote("C4")
-- end

-- This works
function playdate.AButtonDown()
  synth:playNote("C4")
  synth:setParameter(2, math.random())
end
3 Likes