Page 1 of 1

Oscillator phase & SetCycle()

Posted: Sun Feb 10, 2019 8:51 pm
by Captain
I'm using the AnalogOscillator & DigitalOscillator classes as LFOs. But I can't figure out how to set their phase, or the point where the waveform starts.

When I create a new oscillator, set the frequency, and start reading the values, the DigitalOscillator always starts from the beginning of the cycle, and the AnalogOscillator from a more or less random position (I guess it's simulating a freerunning osc?). The GetCycle() method runs from 0 to 1 when the oscillator completes one cycle, which makes sense. One would assume that SetCycle(x) would then set the position in the cycle (or phase), but no matter how much I call it, it seems to do absolutely nothing... the oscillator just keeps running.

Did I miss something obvious here? :) Help!

(BTW, is there a reason why the methods of the VM classes start with a capital letter? My understanding is that the standard is to start with a lowercase letter, ie. setCycle() instead of SetCycle(). Not a biggie, just interested... I constantly write it wrong in my code. Old habits... :D )

Re: Oscillator phase & SetCycle()

Posted: Sat Feb 16, 2019 3:44 pm
by Benard
I've had the same problem. I've implemented lots of features in my modules, but I simply haven't been able to figure out how to reset the phase of oscillators with SetCycle(). My understanding is that it should set the phase, with 0-1 mapping to 0-360, but I've tried calling it in every way that I could think of, and nothing had any effect. It was driving me crazy, so I put it aside for the time being, but I'm glad to know I'm not the only one not getting it. Perhaps someone from Cherry Audio could provide a specific example of how to use this in code? I think it would be really helpful. I'm sure it is one of those things that *should* be obvious, but apparently it isn't and we're just missing something.

Re: Oscillator phase & SetCycle()

Posted: Sat Feb 16, 2019 4:23 pm
by effebal
Same problem here.
The development documentation too basic for a seriuous development, and il lacks of detailed info about the methods that can be invoked.
There is a method that I'm currently trying, without success, that is the .ResetCycle(). Anyway it is not listed.
What I'm doing is to set the new cycle and after reset the oscillator to keep this new value.

Re: Oscillator phase & SetCycle()

Posted: Sun Feb 17, 2019 9:15 am
by Captain
Good to know I'm not alone. :D Yeah, ResetCycle() is a good find. Looks like it actually resets the cycle to the beginning, but still, I also couldn't find a way to set the cycle/phase freely to any position. We really need better documentation, it's frustrating to try to guess how something works, only to find out that it doesn't seem to work at all. And without documentation, you can't be sure if there's a bug, or if you are doing something wrong.

CA guys, "You are doing it wrong, do it like this", or "There's a bug, we'll fix it" would be super helpful. :)

Re: Oscillator phase & SetCycle()

Posted: Tue Feb 26, 2019 6:53 pm
by Cherry Dan
Good catch everyone - the SetCycle() function was broken due to a silly mistake, and has been fixed for a future release. (We have a new build (1.3.1) scheduled for possible release this week, and this fix is unfortunately not included.)

Thanks for catching this! Also, we didn't realize that ResetCycle() wasn't in the Library. This function has been added to the Library in Module Designer.

Dan

Re: Oscillator phase & SetCycle()

Posted: Tue Feb 26, 2019 7:26 pm
by Captain
Great! Good to know a fix is on the way 8-) Thanks!

Re: Oscillator phase & SetCycle()

Posted: Fri Mar 01, 2019 3:15 pm
by Cherry Dan
All,

SetCycle is fixed in the new VM 1.3.3 release. Thanks again for bringing this to our attention!

Dan

Re: Oscillator phase & SetCycle()

Posted: Fri Mar 01, 2019 3:29 pm
by Captain
So it is! You are welcome, and thanks for the fix! Life (or at least the module coding part of it) is much easier now... :mrgreen: