# Re: [music-dsp] Time-variant 2nd-order sinusoidal resonator

```

---------------------------- Original Message ----------------------------

Subject: [music-dsp] Time-variant 2nd-order sinusoidal resonator

From: "Martin Vicanek" <martin.vica...@web.de>

Date: Thu, February 21, 2019 10:33 am

To: music-dsp@music.columbia.edu

--------------------------------------------------------------------------

> /Ian wrote:

> Every time you modify the filter coefficients, modify the state of
> the//filter so that it will produce the output you are expecting. Easy to do.

>

> /Ethan wrote:

> A very simple oscillator recipe is [the coupled form]. However, it's not
> stable as is, so you periodically have to make an adjustment to make sure
> that a^2 + b^2 = 1.

>

> You can have both: A (hyper)stable quadrature oscillator without the need to
> adjust states upon frequency modulation, and without the need to counteract
> amplitude runaway:

> https://vicanek.de/articles/QuadOsc.pdf

>

�
this is Martin's quadrature oscillator alg:
�

// initialize u and v

at start do{

u = 1;

v = 0;

}

�

// update coefficients

if frequency changes do{

update w;

k1 = tan(0.5*w);

k2 = 2*k1/(1 + k1*k1);

}

�

// iterate filter

for every sample do{

tmp = u - k1*v;

v = v + k2*tmp;

u = tmp - k1*v;

}

�

and it looks very interesting and efficient.� i am still concerned about long
term amplitude stability, since, like the other quadrature osc, there are two
poles resting precisely on the unit circle (assuming infinite precision).� this
is clear because no scaler multiples u or v or tmp
in the assignments to those same lvalue quantities.
with finite precision these poles will either be slightly inside the unite
circle which will cause the output to slowly die off (but it might take a
couple days of continuous running to notice) or they will be slightly outside
the unit circle
and the amplitude will rise slowly.
the gain adjustment that i suggested in one way, but a simple method to make
this "stable" is to round the coefficients, k1 and k2, up (in magnitude) very
slightly (making the output grow slowly) and *clipping* or limiting the outputs
u and
v.� that is what i originally did with the 56K (an ancient 24-bit fixed point
DSP) long ago.
i'm gonna fiddle with Martin's interesting variant of the quadrature
oscillator.� i am happy to learn better and more efficient ways of doing things.
But Martin, if you let this thing
run for days on end, would not eventually the amplitude of the output change a
bit?

--

r b-j� � � � � � � � � � � � �r...@audioimagination.com

"Imagination is more important than knowledge."

�
�
�
�
```
```_______________________________________________
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp```