Oscillator phase & SetCycle()

Post Reply
User avatar
Captain
Posts: 103
Joined: Sat Aug 25, 2018 11:12 am

Oscillator phase & SetCycle()

Post 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 )
Benard
Posts: 62
Joined: Mon Oct 01, 2018 11:40 am

Re: Oscillator phase & SetCycle()

Post 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.
effebal
Posts: 1
Joined: Sat Feb 16, 2019 4:13 pm

Re: Oscillator phase & SetCycle()

Post 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.
User avatar
Captain
Posts: 103
Joined: Sat Aug 25, 2018 11:12 am

Re: Oscillator phase & SetCycle()

Post 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. :)
Cherry Dan
Site Admin
Posts: 257
Joined: Fri Jul 27, 2018 5:36 pm

Re: Oscillator phase & SetCycle()

Post 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
User avatar
Captain
Posts: 103
Joined: Sat Aug 25, 2018 11:12 am

Re: Oscillator phase & SetCycle()

Post by Captain »

Great! Good to know a fix is on the way 8-) Thanks!
Cherry Dan
Site Admin
Posts: 257
Joined: Fri Jul 27, 2018 5:36 pm

Re: Oscillator phase & SetCycle()

Post by Cherry Dan »

All,

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

Dan
User avatar
Captain
Posts: 103
Joined: Sat Aug 25, 2018 11:12 am

Re: Oscillator phase & SetCycle()

Post 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:
Post Reply

Return to “Module Designer”