You probably won't need to correct the amplitude every sample because the error introduced every tick should be tiny. You can do it every N samples and just see what value of N introduces an acceptable amount of noise. Or just fold the amplitude management in as Robert suggests, that way you get amplitude envelopes and stability as a natural consequence.
You don't necessarily need to use a real sqrt() for this, you could use the fast inverse square root that Evan linked to. Something even simpler like approximating 1/sqrt(x) as 0.5*(3-x) might work fine too -- you just need to keep the amplitude nudged in the right direction after all. -Ethan On Thu, Feb 21, 2019 at 8:34 AM STEFFAN DIEDRICHSEN <sdiedrich...@me.com> wrote: > If an update on a zero-crossing is enough, you might want to take a look > at the wave guide oscillator: > https://ccrma.stanford.edu/~jos/pasp/Digital_Waveguide_Oscillator.html > > It does like updates at zero-crossings, but needs some history > corrections. > > The coupled-form oscillator, as discussed in the thread, has an issue, if > the sum of the squares of the coefficients is not exactly 1.0. I’m not > sure, if a small controlled contamination with noise of the coefficients > might help. > just an idea. Like switching between 2 coefficient sets to meet the above > condition in a time interval. Just a weird idea. > > Best, > > Steffan > > > On 21.02.2019|KW8, at 13:58, Dario Sanfilippo <sanfilippo.da...@gmail.com> > wrote: > > though changing the frequency would change the amplitude, so I need to > reset the states and retrigger the impulse to do so. But that would also > reset the phase so another solution, maybe less simple, could be to do so > whenever there is a zero-crossing on a rising wave. > > > _______________________________________________ > dupswapdrop: music-dsp mailing list > firstname.lastname@example.org > https://lists.columbia.edu/mailman/listinfo/music-dsp
_______________________________________________ dupswapdrop: music-dsp mailing list email@example.com https://lists.columbia.edu/mailman/listinfo/music-dsp