I have a basic synthesiser working. For my more complex designs, I need to be able to delay certain “events” like, for example, when a sine wave should change frequency on a ‘startNote’ trigger, by a certain amount of time.
ie. Here is a basic synth voice I am playing with:
Here is the basic code for the oscillator from Maximilian library:
What would be the most useful or practical way to write something that will delay the frequency change of the oscillator by an arbitrary amount, such as 10 ms?
Should I write a for loop sort of like in an envelope code like this, triggered by noteOn that just counts up by sample until a certain number of samples are reached? Then once that condition is met, frequencyDelayed = frequency, and feed frequencyDelayed into the oscillator?
^ That is using a switch with cases for each envelope stage. I presume I might need the same technique for this as well so the thing knows when to start looping or not. Ie. On startNote, enter the switch case that triggers beginning the counting loop. Once the number of samples are met, switch to the case that triggers ‘frequencyDelayed = frequency’, and it can just idle there or go to another separate idle case until the next startNote.
Does this make sense? Or is there a more sensible way of doing this?
I have access to an audio delay I’ve implemented from Maximilian, but I’m not sure if that is any use in this utility. In Reaktor this was done just by feeding the GateOn or Pitch data into a delay unit by a certain number of ms.



