definitive waveform sync/reset?


New member

I've been seraching for an hard sync/waveform reset (waveform reset to zero) for the AudioSynthWaveform or AudioSynthWaveformModulated.
Found some solutions posted here over the years on the forum, but haven't tryed them yet because i don't have the confidence to change the .h and .ccp's and i like to keep the "official" files.

I was wondering if after all this time, this was already implement on the official library or if any of you guys have any tricks to do it without changin the file?

Thanks all!
I've wanted this as well. Pretty sure there's not an official solution.

I attempted to add sync and have attached my modified files. You can either use (for example) OSC_A.sync() in your sketch or patch in another audio object into input 2. This has worked for my project, but I'm sure someone more knowledgeable could do it better (please do!). I'm just trying to help as no one as responded yet.

If you don't want to mess with the actual audio library, you can just put these in the same folder as your sketch and include it like this:
#include "synth_waveform_withsync.h"

Then use it like so:
AudioSynthWaveformModulatedSync OSC_A;

View attachment synth_waveform_withsync.cpp
View attachment synth_waveform_withsync.h
Thanks for the solution Mattkuebrich! .sync() function works well!

But .pulsewidth() function seems to be broken... I think something wrong in the synth_waveform_withsync.cpp file. I tried to fix it, but when I opened it, my eyes began to turn red... Any ideas?

I haven't been able to test this yet, but it seems there has been confusion in the past about setting the pulse width using AudioSynthWaveformModulated. See the last few posts in this thread. Seems like to set it directly, you'd want to use a DC object connected to AudioSynthWaveformModulated's "In 1" or Shape input. ("In 0" being the frequency and "In 2" being sync in my modified object). And make sure you're using a Pulse or Var Triangle waveform. Maybe that helps? Also possible the sync feature screwed something up.

I should mention, I did some further testing on this sync mod awhile ago. On the scope it looks like it's resetting the phase properly but it didn't sound quite the same as a similar setup in VCV Rack. As I said in my earlier post, I'm sure this isn't the best solution. I'll probably take another stab it if no one else jumps in.