Channels and Sound

How can I use

I've added an affect and pan, and also a source but when I play the source synth I can't hear the affect or pan.

On windows:

gfx =

-- synth/source
sawtooth =
sawtooth:setADSR(0.5, 0.5, 0.5, 0.5)
sawtooth2 =
sawtooth2:setADSR(0.5, 0.5, 0.5, 0.5)

list = {}

list[1] = { note=49, step=1, length=4, velocity=1 }
-- list[2] = { note=64, step=2, length=2, velocity=1 }
-- list[3] = { note=67, step=4, length=2, velocity=1 }

-- track
trx =
--trx:addNote(1, 60, 1)

-- sequence
seq =

-- effect
bitcrush =

-- channel
chan =

Bdown = false
Adown = false

function playdate.update()

if Bdown then sawtooth2:playNote('Db3') 
	gfx.drawText("B Pushed", 20,20)
if not Bdown then sawtooth2:noteOff() end

if Adown then seq:play() 
	gfx.drawText("A Pushed", 20,50)
if not Adown then seq:stop() end


function playdate.BButtonDown()
if Bdown == true then Bdown = false
elseif Bdown == false then Bdown = true end

function playdate.AButtonDown()
if Adown == true then Adown = false
elseif Adown == false then Adown = true end

There's some unexpected stuff going on under the hood here that I need to fix. What's happening is trx:setInstrument(sawtooth) creates a playdate.sound.instrument under the hood and adds the sawtooth synth to it, and that's what's making the sound, not the synth. Since it wasn't assigned to chan it plays on the default channel and doesn't get panned or bitcrushed. If instead of trx:setInstrument(sawtooth) you do

inst =

and add inst to the channel instead of sawtooth it'll work as expected. Well, almost: The bitcrusher effect's amount parameter defaults to 0, so you'll have to crank that up a bit to hear it do anything. 1.0 is too much, it completely flattens the waveform, but 0.9 is good.

I'm not sure yet how I'll fix this, but it should work like you expected it to. Thanks for pointing this out!

1 Like

That’s a huge help. Thanks Dave!

Using playdate.sound.instrument seems like a better option anyways.