Channels ▼

JVM Languages

Music Components in Java: The Synthesizer Core

In the last installment in this series, we built oscillator and envelope generator (EG) components to add to our collection of needed components. In that discussion, we didn't really get into the type of devices that an EG might control or how EGs fit into the larger scheme of things. In this article, I'll discuss the digital equivalents of both a Voltage Controlled Amplifier (VCA) and a Voltage Controlled Filter (VCF), both of which will be controlled by EGs. We will continue to use the terms VCA and VCF to describe these devices even though voltage doesn't enter into the picture in the digital realm. Finally, we will touch on a MusicPlayer class for playing simple tunes within our synth environment. Before we get started, however, a little more history is in order.


When synthesizers were first built, they were made up of modules connected together with patch cables. Early modular synths looked more like an old telephone switchboard than a musical instrument. Programming a synth to produce sound meant patching the modules together with a rats' nest of wires. Control signals were, in fact, voltages and these control signals (along with audio signals) were carried by the patch cables between modules. As flexible as this was for producing sound, it was very awkward from a performance perspective. To change sound in any significant way, musicians would have to tear down the current patch cord arrangement and patch in a new one — not exactly a real-time operation. The MiniMoog was the first performance-oriented synthesizer that I am aware of. It did away with the patch cables, while offering players the ability to change sounds by manipulating pots and switches instead. The MiniMoog didn't have the flexibility of a modular synth, but it could perform in real time the functions most sought by musicians.

Here is an interesting quote from Wikipedia:

"A patch, in terms of music synthesizers, is a sound setting. Modular synthesizers used cables to patch the different sound modules together. Since these machines had no memory to save settings, musicians wrote down the locations of the patch cables and knob positions on a "patch sheet" (which usually showed a diagram of the synthesizer). After this, an overall sound setting for any type of synthesizer has been known as a patch."

For those interested in early synthesizer history there is a 2004 documentary called Moog by director Hans Fjellestad, which traces the roots of electronic music using interviews, photos, and archival footage. The story centers on inventor Robert Moog and his sometimes interesting views on creativity, interactivity, music, and machines. There are commentaries in the film by some of the early synthesizer adopters like Rick Wakeman of Yes and Keith Emerson of Emerson, Lake, and Palmer. This film is definitely worth seeking out for its historical perspective on electronic music.

Besides the mess of patch cords, early synthesizers were analog devices made up of resistors, capacitors, inductors, and transistors. One downside of these early analog synths was they were constantly going out of tune and needed to be periodically adjusted as the components aged and/or the temperature/humidity changed. Initially, these synths were used for avant garde music and sound effects so their ability to stay in tune wasn't much of an issue. However, as more people wanted to put them to use making traditional music, these stability problems needed to be addressed.

An EG in those days was a hardware device that would manipulate the charge on a capacitor for timing purposes. This voltage would be buffered and then fed out of the EG as a control voltage. This control signal would then be patched to other devices as a means of manipulating them dynamically. Besides using an EG to control amplitude dynamics with a VCA or cutoff frequency in a VCF it was possible to use the EG for many other purposes including: controlling the frequency of a low frequency oscillator (LFO), controlling filter resonance, controlling the amounts of modulation, and many other functions.

The MiniMoog had two EGs. One was coupled to a VCA for controlling amplitude dynamics and the other to a VCF for controlling filter cutoff frequency or resonance. My portable iPhone/iPod synthesizer, PSynth, has two EGs as well for the exact same purposes. In both the MiniMoog and PSynth, the EGs are triggered when a keyboard key is pressed and triggered again when the key is released.

Stability isn't an issue in the digital realm in which we are working. Aside from the occasional bug in the software, the electronic music modules we write will work consistently time after time and will never go out of tune. Of course, there are musicians who still prefer analog synths to digital ones, and that is why there is such a healthy market for these old analog devices.

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.