Stuck with a SynthEdit project?

Category: Oscillators

The Naïve Oscillator in SynthEdit.

So what is this Naïve Oscillator? I’m guessing you don’t know the term
(I didn’t know what it was for some time). Well it’s all to do with Aliasing, and the frequency limitations that apply to digital audio.
A “normal” oscillator in Synthedit is what is called “bandlimited” to prevent it producing frequencies above the Nyquist limit. The Naïve oscillator is not bandlimited and thus will produce aliasing (and lots of it!).
Note: The naive oscillator is also not very well optimised, so it’s a bit higher on CPU usage than the normal Oscillator module.

The difference between the Naive and normal stock oscillators.

Using the stock Frequency Analyser gives a good demonstration of the difference between the two oscillators.
The top oscillator is bandlimited, so has anti-aliasing built in.
Both Oscillators are generating a sawtooth at just over 1kHz. There is a noticeable amount of distortion and extra non-harmonically related frequencies generated at this frequency.
Notice all the extra frequencies below the 1kHz fundamental coming out of the Naïve Oscillator. What is happening here is that lots of high frequencies are being created by the sawtooth, but due to the limitations of the audio in Synthedit these higher frequencies are actually being folded back on themselves above the maximum audio frequency and appearing as spurious lower frequencies which are not harmonically related to the fundamental frequency.
You can see where the Bandlimiting starts to take affect; the level of the harmonics starts to dip, then suddenly cuts off, compare this with the Naïve Oscillator where the harmonics just keep on going…

Increase the Oscillator frequency to 8kHz and things will get even worse:

This diagram makes things a little clearer, the red dashed line shows the harmonics that have been “folded back” into lower frequencies, being above the maximum our digital audio can handle they aren’t ignored, but instead turned into an ugly sounding inharmonic mess.

Aliasing  and "folding back"

If you want to find out more try these articles:
https://www.metafunction.co.uk/post/all-about-digital-oscillators-part-1-aliasing-foldover
https://www.metafunction.co.uk/post/all-about-digital-oscillators-part-2-blits-bleps

Synthedit’s HD Oscillator

This oscillator has a wider bandwidth, lower aliasing resulting in a brighter sounding sawtooth/ramp waveform. This achieved by using a series of harmonically related sine waves to create the wave forms, and thus generally has zero aliasing allowing us to have a much higher definition oscillator. This also means we can do away with the smoothing needed for the Gibbs effect in the standard SynthEdit oscillator.
Compare the frequency spectrum of two sawtooth signals (shown below) with a fundamental frequency of 440 Hz. Although the harmonic output still ends at about 30kHz the decrease in output up to this point is more linear than the older oscillator which tails off quite rapidly above 10 kHz. Let’s face it 30kHz is pretty good as it’s still way above the range of human hearing (unless of course you’re a Vampire…)

It also has two phase modes: 1) Free-running (not phase locked) 2) Sync where the oscillator always starts at the 0° phase point of the cycle. Both these modes are dependent on how the Oscillator is connected.
Note: For the VCO/DCO modes to work correctly there must be a VCA with a MIDI gate source somewhere in the audio output chain.
Note: This does not affect Phase Modulation, which works as normal in both modes.

Plugs.
Left Hand Side:

-> Pitch:- (Voltage) Controls the oscillator frequency this can be set to 1 volt per octave, or 1 volt per kHz in properties.
-> Pulse Width:- (Voltage) Width of the rectangular pulse waveform. The default control range is from -10 Volts to +10 Volts. 0 Volts = 50% width
-> Waveform:- (List) Selects different from waveforms; Sine, Saw, Ramp, Triangle, White Noise, Pink Noise.
-> Sync:- (Voltage) Applying an external oscillator to this plug Syncs the Oscillator to the external signal, produce a gnarly sound (works best with a pulse waveform)
-> Phase Mod:- (Voltage) Varies the phase of the output audio (default range -5 Volts to +5 Volts), can be used for Casio/Yamaha style “FM” sounds.
-> Disable:- (Boolean) Turns the oscillator on when “true”
-> Reset Mode:- (List) Select between; VCO (Freerun), and DCO (Sync).
The VCO (Freerun) mode means the oscillator will start at no fixed point on the waveform, whereas the DCO (Sync) always starts at the same point on the cycle.

Right Hand Side:
-> Audio Out:- (Voltage) Signal Output -10 Volts to +10 Volts.

Parameters:
♦ Frequency Scale:- Choose between 1 volt/Octave, or 1 volt kHz.
There’s no PM depth control?? No you need to control this separately. It’s not built in to the HD Oscillator.

You can use the HD Oscillator in two free-run modes:
1) By using it as a “free running” Oscillator, this means it starts at a different point on the waveform every-time a new note is triggered, as long as you leave the Sync pin unconnected. This is a bit similar to a “drifting” analogue oscillator of a vintage hardware synthesizer.

Note: if you use multiple oscillators, they all will cycle the same so you doesn’t hear any difference when listening to them if the oscillators all have the same Phase Mod value set. You will hear a difference if you set different Phase Mod values for every single oscillator or you will notice a “drifting” effect if you sync one oscillator to the MIDI-CV Gate and leave the sync plugs of the other oscillators unconnected if they both have the same Phase Mod value set.

The connection mode in operation is shown below, and as you can see the two signals are out of phase, and will be in a different phase each time a new note is triggered.


2) The other option is connecting a MIDI-CV Gate to the Sync plug of all your oscillators, which ensures they all always will start from their pre-set Phase Mod value whenever a new note is received.
When setting the Phase Mod of an OSC to 0, then it always will start from Zero Phase.

There is a third way for a special kind of oscillator, when using multiple oscillators to create a super-saw oscillator setup. That is to connect the Gate of the MIDI-CV2 module
to each oscillator, then feed each phase plug with a random voltage which is generated each time a new is triggered. This ensures that the oscillators will all start at different phase points on the sawtooth waveform each time a new note is triggered.

Of course for a true Super Saw or Unison sound we would have more oscillators, and in the case of a Super Saw you’ll also have small frequency offsets too. But the principle remains the same.

If the oscillator(s) are in DCO (Sync) mode then the waveform will always start in phase.

Even with multiple notes played you can see each sawtooth starts at the same phase of its cycle. They are synced to each other.

SynthEdit Oscillators.

The oscillator is arguably (OK we could say the keyboard, but let’s not get picky) the starting point for sound generation in a Synthesizer, after all it’s where almost all of the sounds are created.
The classic analogue Oscillator or VCO in a synthesizer had a choice of five basic waveforms: Sine Wave, Triangle wave, Sawtooth, Ramp (which is the reverse of a sawtooth), and Pulse.

Oscillator waveshapes and noise.

Saw and pulse waves’ spectral content is very rich. For example, a saw wave with a base frequency of 500 Hz comprises harmonics spaced at equal intervals, with exponentially decaying amplitude as shown below.

Sawtooth harmonic spectrum

However, many physical instruments harmonics are of lower amplitude at high frequencies, or may have resonances at particular frequencies. We can achieve this by filtering out, or boosting different frequencies with various types of filter.

The waveform affects the harmonics.
The exact relation between waveform and harmonic content is a very complex mathematical subject (Fourier analysis).
Sawtooth wave:
A sawtooth waveform contains all harmonics in inverse proportion to their number – with all these mathematical relationships you know something ‘natural’ is going on. So the 2nd harmonic is half the amplitude of the fundamental, the 5th harmonic is a fifth the amplitude and so on. Being so rich in harmonics, sawtooth waves are commonly used for brass, strings and some woodwind sounds.


Square or pulse wave:
The square wave contains only odd-numbered harmonics in the same proportion as in sawtooth waves. It produces a ‘hollow’ sound and is typically used for clarinets and reed instruments.


Triangle wave:
Triangle waves contain only odd harmonics, as with square waves, but at much lower amplitudes. In fact – yes, it’s more maths – the relationship is the square of the harmonic number. The 3rd harmonic has an amplitude one ninth (3×3) of the fundamental, the 5th has an amplitude of 1/25th (5×5) and so on. Although triangle waves do contain harmonics, they are not very dominant and triangle waves sound very sine-like. Some synthesisers dispense with a sine wave in favour of a triangle waveform.

Sine wave Harmonics:
A pure sine wave produces just the fundamental frequency, with no (or as close to as possible) Harmonics.
Complex Wave: Usually referred to as Noise, this is an almost random variation in audio voltage with no fixed frequency content. Useful for creating percussion sounds, and adding breath sounds when synthesising flutes or similar instruments.

We don’t need to get into the technicalities of how the shapes are created, just how to use, and control them.

Basic VCO module

The Pitch plug: This controls the frequency or “Pitch” of the oscillator, the default voltage to frequency response is 1 octave per volt, the same as an analogue synthesizer.
We connect this to a Detuner Module so that the frequency can be set by octave, semitone, and fine tuned as an offset against any other oscillators if required.
The pitch of SynthEdit’s Oscillator modules are calibrated in Volts per Octave.
This means that signal of 5 Volts on the pitch plug sets the oscillator frequency to 440 Hertz or Middle A, (the note in the centre of a piano keyboard). Increasing the input by 1 Volt will cause the pitch to rise one octave- so the oscillator frequency doubles to 880 Hz .

How pitch is related to voltage

Simplified: volts=1.442695041* Log(0.07272727273Hz)
To convert Volts to Frequency; Frequency = 440*2^(Volts-5)

To convert MIDI note number to Volts;
There are 128 midi notes. There are 12 semitones on an Octave.  5.0 Volts is middle-A (MIDI note 69) 
Volts = 5.0+(MIDI note number-69)/12


The Pulse Width Plug: This controls the on and off times of the Pulse wave form- (see the diagram below) which in turn controls the sound of the tone due to the change in the number of harmonics in the waveform. Note: This control only varies the output when the pulse waveform is selected.

Effect of varying the pulse width

The waveform plug: Connects to a drop down list or similar selector control, so you can select the required waveform.
Sync: This plug allows you to synchronize the oscillator against another oscillator, which can produce some interesting (and outright ugly in some cases) harmonic changes dependent on the frequencies of the two Oscillators.
Phase Mod plug: allows you to phase shift the oscillator waveform by applying a voltage within the range of -5 Volts to +5Volts. By connecting this to the audio output of another Oscillator this allows you to create FM type effects from the two Oscillators.
PM Depth plug: This allows you to control the amount of the signal applied to The Phase Modulation plug that affects the Oscillator.

Smooth Peaks, or The Gibbs Effect.
In the oscillator’s Properties window you will see an advanced
option called Smooth Peaks (Gibbs Effect). Now compare the two oscillators’
waveform in a scope, and you will discover they are different. The top display is with Smooth Peaks turned off.
We can see a sharp peak with a ripple effect preceding the peak.
If we enable Smooth Peaks then the waveform will more closely resemble a saw wave. Disable smooth peaks, and a big ripple and spike appear at the edge.

Gibbs effect or Peak Smoothing


Why is this? Without going into very complex maths and programming,
the waveform is band-limited, meaning that its frequencies
range no further than from 0 Hz to half the sampling rate.
The Fourier series tells us summing an infinite number of sine waves
creates a band-limited saw wave. Summing a limited number of sine
waves creates what programmers and mathematicians call the Gibbs effect; we call it ripples at the edges.
The same happens to other waveforms with sharp
edges—ramp and pulse come to mind. So, this rippling waveform is a
fixture in the digital domain. Smooth Peaks curtails the effect, but also
noticeably diminishes high frequency content above 4 kHz.

Sync X-Fade (Anti Alias):-
Reduces Aliasing noise when Syncing Oscillators at Audio rates. This can be disabled to provide precise note-on phase sync (useful for phase modulation patches) at the expense of introducing aliasing artefacts into the audio output.

Oscillator Sync:

When we Synchronise two oscillators in Synthedit, we ensure that the both start in phase (at the 0 volts part of the cycle) here we have two oscillators which are running at different frequencies, but are Synchronised.

Oscillator synchronized

With the Sync connection removed they are no longer starting at the 0 volts/0 degrees point as they did when synchronised.

Oscillators unsynchronized

When the first oscillator in the chain is higher in pitch than the following oscillator, this sync trick causes it to sound as if the following oscillator is tracking the leading oscillator’s pitch: any changes to the leading oscillator’s pitch will also cause a change in the following oscillator’s pitch. This works because you’re forcing the follower to reset in sync with the natural resets on the leading oscillator, locking them to the same frequency.
This crude form of pitch tracking can be used in a pinch to cause multiple oscillators to track together—but it’s a bit crude and has a noticeable side effect. The higher the frequency of the first oscillator, the more truncated the following oscillator’s shape will become—ultimately changing both its timbre and its amplitude. As such, this method of oscillator synchronization isn’t typically used for pitch tracking—after all, in most situations, you could just use the same keyboard, sequencer, or pitch control voltage to control both oscillators simultaneously anyway. So … what does this form of oscillator sync achieve?
Well it does produce some harmonically richer sounds by syncing even a simple sine wave, and once we get to a sawtooth the harmonics can become really wild especially when the first oscillator is lower in frequency than the second.

Oscillator 1 has a lower frequency than Oscillator 2

Oscillator 1 has a higher frequency than Oscillator 2 (Note that as Oscillator 1 rises in frequency the amplitude of Oscillator 2 will decrease)


Oscillator sync becomes very interesting once you start affecting the follower’s frequency independently from the leader. By modulating the follower’s frequency (with LFOs, envelopes, random voltages, etc.), you can achieve a crazy range of sounds some usable others- well a noise. Many of these sounds can be heard in synth lines from the 1980s (Cars, Keith Emerson to name but a few).
This is something that it’s better to try out for yourself than to hear and see the results than for me to attempt to describe