To everybody who isn't an electrician, music producer or programmer the concept of oscillators might be a little foreign. That’s why this article is here to introduce you to the wonderful world of oscillators.
Oscillators are a category of nodes that are continuously in motion, always transitioning between two values. This is called oscillation.
Oscillators are an invaluable tool in Wire as they are a common source of modulation. Oscillators can be used to modulate values over time. In the example below the Sine oscillator modulates the rotation and scale of the hexagon shape.
The amplitude is the value between which the oscillators oscillate. An oscillator with an amplitude of 1 will constantly move between 1 and -1. The frequency controls how fast this is happening.
While the amplitude might seem like a set and forget “range”-style parameter, it is actually really fun to modulate the amplitude. This is called amplitude modulation, now that is something you can brag to your parents about!
As we said before, each oscillator has a frequency and amplitude value. It’s useful to know that the frequency value is in Hertz which is the official unit for frequency.
By default each oscillator is set to 0.25 Hz, which equals four seconds. This means that it takes the oscillator four seconds to go from 1 to -1 and back to 1. Setting the frequency to 0.5 will shorten that time to two seconds and setting it to 1 will set it to 1 second.
Any frequency values above 30 Hz won’t really make sense. Because of how aliasing works in Wire and the fact that most of you will be running Wire at 60 FPS, setting an oscillator to 30 Hz at 60 FPS will give you almost a freezing effect. Aliasing occurs at the frame rate divided by two, hence the 30 Hz “limit”.
Offset is really easy to understand, so let’s tackle that first. The offset value is added to the result of the Oscillator. If your oscillator has an amplitude of 1 (meaning it runs from 1 to -1), setting your offset to 1 will result in an output between 0 and 2. This works with negative values too.
To understand phase offset we first have to discuss phase (a term you will encounter in nodes outside of oscillators too). Our oscillator starts on 0 and runs from 1 to -1 back to 0. This is called a phase, you could also call it one full cycle.
Phase offset is a value between 0 and 1 which can best be seen as 0 and 100%. At 0 the oscillator will be at 0. At .25 (25%) it will be at 1. At .5 (50%) it will be at 0. At .75(75%) it will be at -1 and at 1(100%) it will be back at 0 and it has completed its phase.
Setting your phase at 25% will make the starting/restarting position of your oscillator 1. The most frequent use case for phase offset is using it in conjunction with instancing and something that offsets each phase of each instance differently.
In the example below we’re using the Linear node to give each instance of the sine oscillator a different phase offset.
Now that you understand phase, reset phase should be simple. You send in a trigger and the phase resets. This inlet is hidden by default but can be toggled on in the visibility menu after you right click the node.
This feature is only accessible in the node panel. It is toggled off by default. When toggled on, the oscillator will discard one of its poles. Meaning that an oscillator with an amplitude of 1 will run from 0 to 1. And an oscillator with an amplitude of -.3 will run from 0 to -.3. The offset parameter will be applied regardless.
Perlin noise is a bit of a weird oscillator, that is why it is getting its own little sub-section. A easy way to look at Perlin Noise is seeing it as smoothed out randomness. Or for the more visually inclined among us: a drunk sine wave.
Perlin Noise functions the same as all other oscillators. It has an amplitude, frequency and so on.
Because Perlin Noise if often used to create "random" movement/changes the phase offset is more important with this node. There is a good chance that you want to randomize the phase offset. So we added a randomize button like the good folk we are.
The randomize button can be accesed in the node panel or by shift-clicking the phase offset text box.