i did that wrong.  i meant to say:


           x[n] = a[n] + j*b[n] = g[n-1]*exp(j*w[n]) * x[n-1]


        this is the same as


                  a[n] = g[n-1]*cos(w[n])*a[n-1] - g[n-1]*sin(w[n])*b[n-1]
                          b[n] = g[n-1]*sin(w[n])*a[n-1] + 

        and adjust the gain g[n] so that |x[n]|^2 = a[n]^2 + b[n]^2 converges 
to the desired amplitude squared (let's say that we want that to be 1).  you 
can adjust the gain slowly with:


          g[n] = 3/2 - (a[n]^2 + b[n]^2)/2


        that will keep the amplitude sqrt(a[n]^2 + b[n]^2) stably at 1 even as 
w[n] varies.


        i've done this before (when i wanted a quadrature sinusoid) for doing 
frequency offset shifting (not pitch shifting).  worked pretty good.


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

"Imagination is more important than knowledge."
> A very simple oscillator recipe is:


> a(t+1) = C*a(t) - S*b(t)

> b(t+1) = S*a(t) + C*b(t)


> Where C=cos(w), S=sin(w), w being the angular frequency. a and b are your

> two state variables that are updated every sample clock, either of which

> you can use as your output.


> There won't be any phase or amplitude discontinuity when you change C and

> S. However, it's not stable as is, so you periodically have to make an

> adjustment to make sure that a^2 + b^2 = 1.


> -Ethan



> On Wed, Feb 20, 2019 at 12:26 PM Ian Esten <i...@ianesten.com> wrote:


>> The problem you are experiencing is caused by the fact that after changing

>> the filter coefficients, the state of the filter produces something

>> different to the current output. There are several ways to solve the

>> problem:

>> - The time varying bilinear transform:

>> http://www.aes.org/e-lib/browse.cfm?elib=18490

>> - 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.


>> I will also add that some filter structures are less prone to problems

>> like this. I used a lattice filter structure to allow audio rate modulation

>> of a biquad without any amplitude problems. I have no idea how it would

>> work for using the filter as an oscillator.


>> Best,

>> Ian


>> On Wed, Feb 20, 2019 at 9:07 AM Dario Sanfilippo <

>> sanfilippo.da...@gmail.com> wrote:


>>> Hello, list.


>>> I'm currently working with digital resonators for sinusoidal oscillators

>>> and I was wondering if you have worked with some design which allows for

>>> frequency variations without discontinuities in phase or amplitude.


>>> Thank you so much for your help.


>>> Dario
dupswapdrop: music-dsp mailing list

Reply via email to