Oscillators

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.


Amplitude

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!

Frequency

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

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.



Phase offset

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.



Reset Phase

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.


Unipolar

This feature is only accessible in the inspector. 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.




Oscillator types

Wire has four types of oscillators: Sine, Triangle, Square and Saw.


Sine

The sine oscillator will run from back and forth between its amplitude. The values are curved, like a sine wave.


Triangle

The triangle behaves in the same way as the Sine, except that the values are linear.

The triangle works really well with the Curve node, by combining these two you’ll have access to all the curves you know and love from Resolume’s envelopes.


Saw

A saw oscillator will grow until its amplitude value is reached and then drop to its negative amplitude before crawling back up again in a linear fashion. This is perfect when you want a value to grow and then reset.



Square

The square oscillator won’t grow in value. Instead it toggles between its amplitude and negative amplitude. The speed of the toggle is set by the frequency. The square oscillator has an additional parameter called Pulse Width.


Let’s  assume that the Square has a frequency of 0.25 (4 seconds, remember?) and an amplitude of 1. Leaving the pulse width at its default 0.5 will result in the square being 1 for two seconds and then being -1 for two seconds. This would be one phase. Now we adjust the pulse width to 0.25. Now the Square will be 1 for one second and -1 for three seconds.



Related Articles