O'Reilly    
 Published on O'Reilly (http://oreilly.com/)
 See this if you're having trouble printing code examples


This is the last in a series of three articles road-testing SynthEdit, a Windows shareware program that has become very popular for creating virtual instruments and effects. (Mac users may want to try Max/MSP or Sonic Birth.) With SynthEdit, you build your own software synth by connecting modules onscreen; the program then exports the instrument in the VST plug-in format. Here’s the story so far:

SynthEdit Logo You can use the open-source SynthEdit logo to brand your synths and SynthEdit-related websites. Download higher-resolution and vector-format versions here.

Walkthrough: Your First Synth

Let’s jump straight into making a micro-synth.

  1. Download and install SynthEdit.
  2. Download the example file OReillyEG.se1 (8KB zip file) and save it into a convenient directory, such as TEMP. (SynthEdit synths use the .se1 extension.)
  3. Launch SynthEdit.
  4. Select the File>Open menu item and open OReillyEG.se1.

You should see a window like Figure 1.

Top Window Figure 1. Typical top-level window (click to enlarge).

Figure 1 shows a typical top-level window on a SynthEdit project.

Now right-click on the OReillyEG container; a pop-up menu will appear. SynthEdit developers use this menu constantly. Let’s look at each of the major sections in it—Properties, Panel Edit, Structure, and Automation—and make a micro-synth.

Properties

From the top window, right-click on the OReillyEG container and select Properties. The window in Figure 2 will appear.

Figure 2: Properties Figure 2. SynthEdit Property windows let you adjust global parameters for each module.

All containers and modules have Property windows. These let you set parameters such as the title and various input settings of modules. Starting from the bottom:

Panel Edit

From the top window, now right-click on the OReillyEG container and select Panel Edit. The window in Figure 3 will appear.

Figure 3. Panel Edit Figure 3. Panel Edit window (click to enlarge).

Our micro-synth can be monophonic or polyphonic, lets us select the waveform and (for square waves) the pulse width, and has controls for ADSR (Attack, Decay, Sustain, Release), level, and panning. None of these knobs is connected yet; that will be your job!

SynthEdit provides many different kinds of knobs, sliders, switches, buttons, and text displays. And you can customize and animate them using tools such as POVRay or Adobe Illustrator to make completely different kinds of skins—translucent sliders that glow as you change them, knobs with the inspiring faces of the Staple Singers, level meters that track Michael Jackson’s noses...whatever strikes your fancy.

Structure

From the top window, right-click on the OReillyEG container and select Structure. The window in Figure 4 will appear. This is a our basic synthesizer, but the various knob and list selectors are not yet attached.

Figure 4. Structure Figure 4. The Structure window (click to enlarge.)

Starting from the left side of the diagram, the incoming MIDI signal goes to a “MIDI to CV” module. (CV is short for control voltage, the type of signal used to change parameters in real time on analog synths. The signals here are digital, of course, but the concept is the same.) This module provides the gate signal for the ADSR generator and the pitch signal for the oscillator. The oscillator output signal goes to a VCA (virtual voltage controlled amplifier) which shapes the level of the signal, then to a stereo Pan module, and finally to the output.

Every synth you make will probably include the MIDI Automation and Patch Select modules; these enable what their names suggest. They are only needed in the container for your synth.

Notice that we have used two I/O Mod modules. That permits a nice right-to-left flow, which is vital as your synth grows to scores of connections.

If you right-click in the whitespace in the Structure window, you’ll see a pop-up menu showing all the components loaded in your system. (Many more components are available, as we’ll see in a moment.) You add extra oscillators, filters, and so on by selecting these components. 

Try right-clicking on the Oscillator module (in the center) and selecting Properties. You’ll notice that you can set values for all the unconnected pins, and also that there are some minor options available that do not correspond to pins. Try choosing a different waveform from the list, and then play the virtual keyboard to hear the new sound.

Dem Bones

Now we’ll hook up the knobs and list controls to the appropriate modules’ inputs.

Click on an Output pin. Then, with the mouse button still held down, move the cursor to the corresponding input pin and release the button. (There are various types of pins, indicated by color; SynthEdit will not let you connect inputs and outputs of different types.) The window should now look like Figure 5.

Figure 5. Knob Connection Figure 5. The knob bone’s connected to the Osc bone....

Now you’re ready to be Herbie Hancock:

  1. Go to the top-level window, “SynthEdit.” The Window menu can be useful for this.
  2. Right-click on the OReillyEG container and open the Properties window. Select the “Show Controls on Module” option.
  3. The OReillyEG container will now be showing the controls, but the window layout will be messed up. So resize the top-level window by dragging the bottom right corner downwards, and move the now-large OReillyEG container around so that the virtual keyboard and the controls are on different parts of the screen.
  4. Play the virtual keyboard and adjust the controls to hear the sound change. (Tip: at the far left of the virtual keyboard is a little “T” button. Press that and the next notes you play will hold until you press the T button again or press the red “stop” button in SynthEdit’s toolbar.)

Automation

Now that you’ve played your synth, it’s time to give the computer a turn. From the top window, right-click on the OReillyEG container and select Automation. The window in Figure 6 will appear.

Figure 6. Automation Figure 6. By enabling automation, you can control your synth through VST host programs.

Almost every knob, switch, and list in your synth can be altered by host programs by default; this is called VST automation. The Private column in Figure 6 lets you prevent specific controls from being automatable, which is sometimes desirable.

A large synth has numerous controls, so it’s important to give controls unambiguous titles, even if the title is not shown on the front panel. One slight annoyance in SynthEdit is that some controls, such as the knobs used in OReillyEG, need to be unlocked before the label can be changed. (Search for “lock” in SynthEdit's help file for details.)

Closely related to VST automation is MIDI automation; this maps various control parameters to specific MIDI commands. The Controller column in the Automation window lets you select the MIDI Control Change number to use. The MIDI standard assigns MIDI Control Change numbers (aka Continuous Controllers or CCs) to many common features, and you should use these for maximum compatibility with VST host user interfaces and hardware MIDI controllers. For example, MIDI Control Change 7 typically affects overall volume. 

Well-documented VST instruments will also provide a MIDI implementation chart, although these are less important now that direct VST automation is available. (Instead of looking up a number, you can simply click the target knob onscreen.) Following is the abridged MIDI implementation chart for the Ricko-3A. Following convention, an X means an assignment is not implemented, and an O means it’s implemented. The minimum three assignments users will expect are probably:

Creating the VST

The final stage of the project is to create a VST. It’s a simple, two-step process:

  1. First, delete the VU meters (click once on them, then press the DEL key). They confuse SynthEdit about which container is supposed to be used for the VST.
  2. Next, select  “File->Save as VST...” and fill in the dialog box that comes up. (See Figure 7.)
Figure 7. Save as VST Figure 7. Creating a VST instrument from your SynthEdit patch.

VSTs should each have unique four-character identifiers; hosts use that ID internally to keep track of them. Steinberg maintains a central database for that purpose. I have not registered OREG; it’s just an example.

Saving a document as a VST creates a .DLL file that can be loaded into a host. Depending on the options you set, the VST may appear as a synthesizer or as an effects plug-in. The name your host uses for the plug-in will vary. Some hosts use the file name; some use the name you entered in the Product field, perhaps with capitalization changes. One host I tried seemed to use the title of the container, so it’s best to use the product name for that container.

Inside the Ricko-3A

SynthEdit synths can get much more complicated than the simple example above. For example, Figure 8 shows most of the actual circuit for the 8' oscillator in the Ricko-3A.

Figure 8. The Ricko-3A Oscillator Figure 8. The Ricko-3A oscillator (click to enlarge).

The top left four modules provide the 8' chorus effect, a pulse-width modulation effect we probably would call celeste today. The oscillator can be routed through one of four different waveshapers, each of which bends the wave according to a particular formula. The clipper is a precaution to set the maximum and minimum level of the oscillator. The bottom line provides a slight level compensation for different pulse widths on square waves. A fixed value added to Input 2 of the multiplication module at bottom right is not shown. (Also not shown is a level-compensation signal from the 8' level slider to a later stage.)

The module called swarf is one I programmed in C++; when the pitch is high, it filters out the highest frequency components. That reduces the aliasing effect that polynomial waveshapers can produce on high notes. On some very rare settings, some high notes in the Ricko-3A still have audible aliasing; that is a design trade-off for using polynomial waveshapers.

When designing a synth, conventional programming wisdom is to create a prototype and then optimize it for efficiency. You can see an example of such an optimization in Figure 8; the switch to select which waveshaper is used comes before the waveshapers, not after them; we want the shortest possible signal path to be active at any time.

Tips for Virtual Synthesizers

You want your synth to be popular? Here are some hints:

Of course, the other approach is to ignore all these hints and just make some virtual synths that give you pleasure and generate your own unique sound. I built the Ricko-3A for my own use, and I am happy if there are other people who get a kick from it, be they other old Roland SH-3A users or simply musicians looking for a different tone color. But the Ricko is not designed to be massively popular; it begs for outboard effects and more presets for a start! There is fun in creating your synth for sure, but I think there is more satisfaction in subsequently playing it and sharing the musical results.

Sources for Modules

The download site for stable versions of SynthEdit is synthedit.com. However, there is a semi-secret site where the most recent beta versions are placed; those include the most up-to-date features.

You can also download components. They can be classified as pre-fabs, which are collections of modules created in SynthEdit and saved as .SE1 files; modules, which are created using the C++ SDK and are .DLL files renamed with a .SEP extension; and little VSTs, which just provide part of the functionality of a synth and are intended to be patched together inside a VST host such as SynthEdit.

The SynthEdit C++ software developer kit (SDK) is also available for creating custom modules. In some cases, functionality is more efficiently implemented in code than by connecting modules onscreen. However, SynthEdit is often surprisingly efficient compared to modules written in straight C++. The SDK also has a Yahoo support group, syntheditsdk.

Bob Hug maintains the excellent SynthEdit SEP/SEM Database, which is the best place to start. It contains listings from dozens of developers. The three major sources of modules are as follows:

Developer

Description

Chris Kerry

Over 100 modules in two packs, mostly for audio, control, and MIDI manipulation. These are donationware, through PayPal indexed to sales for commercial products.

Dave Haupt

Almost 100 modules, some available in packages, mostly for improved user interfaces. Most are donationware through PayPal.

Yahoo SynthEdit Users Group

Group members can access various free open-source prefabs and modules. I have contributed a few modules to the Yahoo site: RJ_SWARF is a simple filter for high notes that can be used to reduce aliasing noise in some cases; RJ_SLEEPER can help your synth be more CPU-efficient in some cases. I used both modules in the Ricko-3A. Some C++ is also available at the Yahoo SynthEdit SDK group site.

SynthEdit synths can get very large. Custom modules can reduce the complexity, and you can often use SynthEdit’s container modules to hide details. Figure 9, courtesy of synthesizer and module designer Xoxos (Rurik Leffanta), shows how complex the connections in a large circuit can become, even with containers.

Figure 9. Synth Sprawl Figure 9. bird’s-eye view of a complex SynthEdit pre-fab, courtesy of Xoxos. (Click to enlarge.)

Synth You Asked

These are exciting times for adventurous musicians and sound designers. No longer do you need a microchip foundry or extensive electronic know-how to create your own unique instruments. All it takes is some shareware and a willingness to explore, and there are plenty of people online who will help you along the way. I hope this series has inspired you to develop your own sounds and share them with the world.

C++ Pocket Reference

Related Reading

C++ Pocket Reference
By Kyle Loudon

Copyright © 2009 O'Reilly Media, Inc.