playdate.sound.synth:setVolume doesn't seem to support stereo

I have a playdate.sound.instrument containing a playdate.sound.synth. If I call synth:setVolume(1, 0) or synth:setVolume(0, 1), it only sets the first argument as the value for both channels, seemingly only supporting mono configuration, even though the API docs say it supports stereo. If instead I call instrument:setVolume(1, 0) or instrument:setVolume(0, 1), it works as expected, and so that functions as a workaround for my use case.

oh this is interesting. I realized this is a duplicate of an issue I filed last year: “Should be able to separately pan voices in an instrument”. The actual problem is that the sound lib is taking a shortcut and only rendering the left channel and copying it to the right because it thinks the instrument is mono. Panning the synths does work like you’re expecting if you trick the instrument into stereo rendering by doing instrument:setVolume(1,0.999).

I need to do some testing here, see if my optimizations like this are actually doing any good. Looking at this code again I can’t figure out why I’m having mono synths pretend they’re stereo when they’re panned instead of having the engine render to a mono buffer first then scaling that to the different channels… :thinking:

Until I come up with a better way to do this I’ll make instruments always render in stereo. It doesn’t appear to add too much overhead. :man_shrugging: