Made with hsc Haskell client for scsynth. As ever, code available under GPL on application. The amplitude of a given harmonic in a square wave is equal to the inverse of its harmonic number. Triangle Audio example of triangle waves. Triangle waves sound like something between a sine wave and a square wave. Like square waves, they contain only the odd harmonics of the fundamental frequency. They differ from square waves because the volume of each added harmonic drops more quickly.
Technical note: The amplitude of a given harmonic in a triangle wave is equal to the inverse square of its harmonic number. Building a Synthesizer Now that we understand oscillators, let's draw a diagram of a very simple synthesizer. This synthesizer will contain a single sawtooth oscillator which sends signal to our audio output, and then to our speakers. The pitch of the oscillator will be controlled by a keyboard.
Here's a realization of this patch in PureData. Individual synthesizer components which perform a single, simple function—such as oscillators and filters—are called modules. A modular synthesizer is a synthesizer made by linking together lots of small modules in interesting ways.
In the diagrams we use, the lines connecting the modules are like virtual cables, sending signal between them in much the same way an audio cable would in real life. Volume control There are some problems with our synthesizer design—not the least of which is that because we have no way of controlling the volume of the oscillator, our instrument is always making sound! The function of a VCA is to raise or lower the volume, often called amplitude or level, of a signal.
Essentially, a VCA is a volume knob. Oscillators and other sound generating modules are always making sound, and VCAs are what keep the level down when you're not playing. In analog synthesizers, VCAs are actually controlled by wires carrying electrical current. There are no real wires carrying voltage inside a virtual synthesizer, but people often call virtual amplitude controls VCAs anyway.
With many synthesizers, most of the VCAs are beneath the hood and we don't need to worry too hard about where they are or how they're controlled, but it's important to know how they work. Let's add a VCA to our simple synthesizer now. This means adding a new module and a couple more cables, but don't worry, they're explained right after the diagram. The "gate" cable running from the keyboard to the VCA is a signal that sends one of two messages to the VCA: "on" if a key is depressed, and "off" otherwise.
When the gate signal is off, or closed, we hear nothing. When the gate signal is on, or open, then the VCA will let the noise from the oscillator to the audio output. The "velocity" cable sends a level to the VCA that corresponds with how fast we hit the key, and controls the volume level of the output. If we press a key very hard, and thus very fast, the volume of the output will be louder than if we pressed the key soft and slow.
Filters Filters are, generally speaking, tools for manipulating signals. Any device which modifies a signal in any way is, technically, a filter. When people talk about filters, however, they usually are referring to filters which modify the harmonic content of the signal, altering the characteristics of the sound in the frequency domain.
This is the sense in which the term "filter" is used in this article. Filters allow you to select a range of frequencies in a sound, and either amplify or reduce those frequencies. Decreasing high frequencies or increasing low frequences within a sound makes it seem "darker" or muffled, while increasing high frequencies or decreasing low frequences makes the sound seem "brighter.
If you're talking to someone and hold a large book in front of your mouth, the book filters out much of the high frequency content of your voice, causing it to sound dark and muffled. Low pass and high pass filters Audio example of a high pass filter. A low pass filter allows low frequencies to pass through the filter and blocks out high frequencies, causing the sound to seem muffled. The range of frequencies blocked by a filter is called the stop band.
The range of frequencies allowed to pass through the filter is called the pass band. The transition from pass band to stop band is gradual, and happens over a range called the transition band. The width of the transition band depends on the rate at which the filter reduces the signal. This rate is called the slope, which is measured in decibels per octave. A detailed discussion of the decibel as a unit of amplitude measurement is beyond the scope of this article.
Also Wien bridge oscillators need an amplitude stabilization method. This is often a JFET but could be diode based, or even using a small incandescent lamp not my preferred approach!
If you need to generate a sine wave which is based on a given clock then a different approach is required. In that case you would presumably have a square wave and need to generate your sine wave from that. If you could make your square wave frequency higher than the desired sine wave then you could digitally generate a sine wave using a sine lookup table. You would also need some analog filtering to remove the higher frequency components of the resulting stepped waveform.
Here you would generate a square wave at a multiple of the desired sine wave and vary the width — not linearly but in a sinusoidal fashion. The square wave produces a very harsh tone due to the abrupt rises and falloffs in the waveform: The Equation There are a number of ways to generate square waves, and many of them generate imperfect square waves especially electronics.
Since we are using a very precise program with nice things like for loops, we can generate a square wave that is absolutely perfect.
That LED screen is a frequency domain representation of the audio. The width of the transition band depends on the rate at which the filter reduces the signal. An ideal mathematical square wave changes between the high and the low state instantaneously, and without under- or over-shooting.
Unlike an oscillator, which repeats its signal over and over again, an envelope generator sends out its signal only once. Our imaginary synthesizer does this already: the frequency of the oscillator and the volume level of the VCA are controlled by our keyboard.
Running a lead synthesizer through a low pass filter and slowly moving the cutoff frequency from high to low and back is a popular technique used in electronic dance music. When the gate signal is off, or closed, we hear nothing. Some stereo systems have an LCD screen where lines rise and fall based on the pitch content of the sounds being played.
These changes are, in fact, logarithmic. The frequency where the filter has reduced the level of the signal to about seven tenths its original level is called the cutoff frequency. The idea is to be able to make instrumental sounds by typing onomatopoeic words. After that, the signal moves gradually down to about 0.
Also Wien bridge oscillators need an amplitude stabilization method. It is the smoothest sounding tone signal we can produce. We're also going to use the envelope generator to modulate the frequency of our filter, so we get a cool sweeping effect automatically on every note, especially if we turn up the filter's resonance. As ever, code available under GPL on application. This article is intended as a good place to start learning; a place to acquire vocabulary without technical training.
The power of a signal is proportional to the amplitude of the signal squared, and at 0. The "velocity" cable sends a level to the VCA that corresponds with how fast we hit the key, and controls the volume level of the output. If the system is overdamped , then the waveform may never actually reach the theoretical high and low levels, and if the system is underdamped, it will oscillate about the high and low levels before settling down. After that, the signal moves gradually down to about 0. Resonance occurs when sound in the pass band near the cutoff frequency is sent back into the filter as it comes out, creating feedback.
At lower frequencies a Wien bridge might be considered — for frequencies of up to maybe 1MHz although in theory it could be used considerably higher in frequency.
Building a Synthesizer Now that we understand oscillators, let's draw a diagram of a very simple synthesizer. We'll look at frequency domain graphs of more complicated waves very soon. This is, however, not the end. Variants of these techniques are used in power inverters — using multi-level inverters or a combination of multi-level inversion with sine PWM.
Technical note: Topics in music synthesis sometimes call for a little bit of math. Our slider range is set to If we press a key very hard, and thus very fast, the volume of the output will be louder than if we pressed the key soft and slow. Further examples will show this in multichannel format, like below. When the gate signal is off, or closed, we hear nothing.
The times taken for the signal to rise from the low level to the high level and back again are called the rise time and the fall time respectively. An ideal mathematical square wave changes between the high and the low state instantaneously, and without under- or over-shooting. These frequencies are called harmonics. Characteristics of imperfect square waves[ edit ] As already mentioned, an ideal square wave has instantaneous transitions between the high and low levels. Using three sinusoids that track the frequency and amplitude of the first three speech formants, high intelligibility can be achieved. LFOs are like little robots that turn knobs back and forth for you.