Channels ▼

JVM Languages

Music Components in Java: Creating Oscillators

Note: All slope values above are calculated when the corresponding setter methods in the API are called. See the file or the javadocs for the details.

Electronic Music Components in Action

softsynth.jar (see Resources) contains all of the code from this article series and is made available for demonstration purposes. Using this code you can listen to the following examples of our electronic music components in action.

[Click image to view at full size]
Table 1: Bundled sound examples.

To hear any of these examples, execute the following command in a shell:

java -jar softsynth.jar X

where X is the example number (1 – 11) from Table 1 that you want to listen to. Of course, you must have the Java runtime environment installed on your computer for this to work. Unjar the jar file if you want to get at the source code or javadocs.


In this article, I talked about waveform generation and its relationship to subtractive synthesis and then described how to build two types of oscillators. Envelope generators were then presented and some discussion was provided on how they work. Finally, we provided a means to listen to our electronic music components in operation.

In the next article we will talk about VCA's, VCF's and a simple music player and how these components fit into the electronic music architecture we have presented.


The code for the complete article series can be downloaded here. Source code, javadocs, and executable code are all in this JAR file. Feel free to use the code for any uses you see fit. Let me know of any unique projects you come up with based on this code.

The following books contain valuable information on electronic music production and digital signal processing. Of course the Internet is an amazing source of information as well.

  1. Computer Music: Synthesis, Composition and Performance, Charles Dodge, Thomas A. Jerse, 1985, 1997. Schirmer Books.
  2. Elements of Computer Music, F. Richard Moore, 1990, Prentice-Hall.
  3. A Programmers Guide To Sound, Tim Kientzle, 1998, Addison-Wesley.
  4. Digital Audio with Java, Craig A. Lindley, 2000, Prentice-Hall.
  5. PSynth – An iPhone/iPod Touch synthesizer app available from iTunes.

— Craig Lindley is a hardware engineer who, until recently, had been writing large-scale Java applications. He is the author of Digital Audio with Java from Prentice-Hall.

Creating Music Components in Java (Part One of this series)

Music Components in Java: The Synthesizer Core (Part Three in this series)

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.