Clicks and pops when using amplitude LFO on a synth

Hi!
I'm making a synth editor for the PD synth API. I'm finding that when using the LFO for amplitude modulation I get a lot of clicks and pops when playing back the sample.

To reproduce the issue:

  1. run the PDX below
  2. Enable vibrato. Use the dpad to navigate to the top right on-off switch and press A or crank forwards.
  3. Set vibrato depth to 1 by highlighting the depth control using the dpad and cranking forwards.
  4. Press B to play back the synth occasionally. Listen for pops while it plays back, they should be quite common.
  5. Experiment with different vibrato wave types by highlighting the wave selector on the vibrato module and either pressing A or cranking to change the LFO wave type.
    PDFXR.pdx.zip (127.4 KB)
2 Likes

Just writing here to show that I agree that this would be great to take a look at and bumping this to the top of this list very much intentionally.

Linking back to a related thread which has a code example which demonstrates this bug. I think this is an extremely gnarly bug.

Maybe there is some workaround that someone has found in the meantime?

2 Likes

The only workaround I'm aware of (and bear in mind I haven't actually tried this out) would be to use playdate->sound->channel->addCallbackSource to create your own source, and do all of the raw audio generation, mixing, and effects processing yourself. That however would be like using a rocket launcher to kill a mosquito, because you're basically writing your own audio driver and you give up most of the advantage of using the Playdate sound API in the first place!

I agree this issue needs to be addressed for volume modulators to be of proper use, because without it there will always be nasty clicks and pops the moment you change a channel's volume to any significant degree.

1 Like

Actually, I just realized my last post isn't correct. You could write a custom SoundEffect and use that to adjust a channel's volume smoothly, since those have the ability to modify every sample that's coming through the channel. That probably wouldn't be very hard to do. Then you could still use the rest of the Playdate audio API, with the exception of the bits for controlling volume, and instead of those you'd keep a channel at full volume and only adjust its volume using your SoundEffect.

Now that I realized this can be worked around with a custom effect... I went ahead and implemented one! Source code here: Provide a way to set a channel's volume without creating popping artifacts - #5 by bribri