Platform: Mac
Tried searching for posts for quite a while, apologies if this is a repeat post!
Hope everyone's enjoying their saturday, have a small audio question! In these ~20 lines of lua code here why is my audio silent? I think I'm making a super small mistake, but it's had me stumped for almost hours now. I have a sequence "playing", but no notes are audible.
I'm able to hear the notes when I use playNote
, so I don't think it's a simulator / mac speaker issue
local snd <const> = playdate.sound
synth = snd.synth.new(snd.kWaveSine)
instrument = snd.instrument.new(synth)
track = snd.track.new()
sequence = snd.sequence.new()
track:setInstrument(instrument)
track:addNote(1, 300, 1, 1)
sequence:addTrack(track)
sequence:setLoops(1, 8, 0)
sequence:setTempo(1)
printed = false
step = sequence:getCurrentStep()
-- Uncommenting this plays a sine tone at 300hz, which makes
-- me think my instrument / track setup is fine....
-- sequence:getTrackAtIndex(1):getInstrument():playNote(300, 1)
sequence:play()
-- Problem: Why doesn't this play an audible note on beat 1 of 8??
function playdate.update()
local currentStep = sequence:getCurrentStep()
if step ~= currentStep then
step = currentStep
print("step:", currentStep)
end
end