SynthLab™ is the name of a set of C++ objects, structures, and functions designed to encapsulate and implement each of the functional blocks in a software synth, or soft-synth. There are scores of objects and structures, including abstract base classes, abstract interfaces, and all of the derived classes that implement the SynthLab synth projects. There are multiple projects for different types of synths, and you have access to all of the code for all of the objects and synth projects. But I’ve gone a step further to get you playing with the code and learning SynthLab without needing to integrate the objects into your plugin framework and then compile, debug, and test the complete synth projects, which are more complex than the audio effect plugins in my Designing Audio Effect Plugins in C++, 2nd ed. (I refer to this as “my FX plugin book” in this text).
In addition to the C++ code and objects that you may compile and integrate into your own projects, you may also download the pre-compiled versions of each of the six different synths for VST3 (Windows® and MacOS®) and AU (MacOS). These are called the SynthLab Dynamic Module (SynthLab-DM) projects. I designed SynthLab in a highly modular format to include the use of “module cores” that are small, complete synth objects which implement the soft synth building blocks. You may design, compile, and then dynamically load your own modules into the host DM synths. This will allow you to study and learn each synth component, modify the code, or invent your own designs, then load those modules into the synth at runtime to debug, test, and voice. If you are interested in designing modular components for systems like VCVRack, then these tiny synth modules represent each of those modular building blocks – oscillators, filters, envelope generators, and the like.
In addition, all of the underlying building block objects feature a “stand-alone mode” of operation, so you can integrate them into existing projects right away without needing to manage entire synth projects.
The base classes and interfaces, like all of the smaller helper objects and functions, may be accessed with just two includes: synthbase.h and synthfunctions.h, and their.cpp implementation files. You can find the C++ code and projects at www.willpirkle.com or https://github.com/willpirkleaudio/synthlab.
1.1 What You Need to Know to Use SynthLab Objects and Projects
You will notice that there is no mention of plugin APIs in this book – AAX, AU and VST are absent as they are covered in detail in my FX book. There is no discussion about specific plugin frameworks – ASPiK, JUCE, IPlug2, etc. Likewise, there are no analog or DSP theory chapters, so you will need to bring your own knowledge to the table or be willing to study it alongside this book. There is also no “intro to MIDI” chapter. You need to know how MIDI messages work, what a MIDI “CC” means, and the like. There are numerous books and sources available on all of these topics. These are prerequisites for getting the most out of this text.
This book is not designed to feature any particular framework or API but rather shows how I create software synthesizers in C++ using DSP theory and coding implementations. Most chapters begin with theory of operation, then show the C++ objects I use to implement that theory. You will need to download the code and study it side-by-side with the text as the book only includes very specific C++ code: stuff that is non-intuitive or very specific to audio or synthesis. Since all of the synth components use the same module-core paradigm and ten-control GUI implementations, the book figures and specifications are cleaner and easier to understand. This is in stark contrast to the book’s first edition, in which each project was vastly different in architecture and components.
If you intend to build the complete synth projects in this book, you need to have a solid grasp on your chosen plugin framework, and you especially need to understand how to generate your own GUIs within that framework; you will also need to understand some advanced GUI design topics, such as dynamic loading of string lists (remember that you are free to pick and use individual C++ objects and code as you like for your own synth projects). You will find that adding the synth objects to your framework’s processing object is very straightforward, but the GUI details may be challenging. Chapter 5 covers the details on using the module cores, designing with objects in stand-alone-mode, and connecting the synth engines to your framework, and you can always get more help and information from www.willpirkle.com/forum.
1.2 SynthLab Synth Projects
To demonstrate how to use and combine these objects, and how they work together, I have created a set of synth projects based on the same fundamental architecture which only differ in their oscillators and waveform rendering. All synths feature monophonic, unison, and polyphonic operational modes. These projects include:
SynthLab-WT: four-oscillator wavetable synth that includes ordinary wavetable, morphing wavetable, and one-shot drum and sound effect (SFX) wavetable implementations; the various oscillators may be used in any combination
SynthLab-PCM: PCM sample playback synth with four separate PCM oscillators; this synth uses.wav files for its PCM sample storage and retrieval
SynthLab-VA: four-oscillator virtual analog synth using virtual analog oscillators and filters
SynthLab-KS: physical modeling synth that uses the Karplus-Strong plucked string algorithm to generate realistic acoustic and electric guitar and bass sounds
SynthLab-DX: four-operator FM synth that produces the classic Yamaha DX synth sounds
SynthLab-WS: wave sequencing synth based on the Korg Wavestate’s ® multi-lane, independent looping wave sequencer that allows use of both normal and morphing wavetable oscillators during the sequencing operation; the wave sequencing oscillator demonstrates how to create an amalgam of modules encapsulated in a single object
In addition, each of these has a precompiled dynamic module (DM) version which you can download from www.willpirkle.com/synthlab using the DM subscript/prefix: for example, SynthLab-WSDM is the dynamic module version of the wave sequencing synth, and the dynamic module synths are collectively referred as SynthLab-DM.
1.2.1 SynthLab Documentation
SynthLab is fully documented with the Doxygen® tool and is available to download at www.willpirkle.com/synthlab-docs/. This includes every C++ object, interface, structure, and function, with every member variable and member function. You should bookmark this page and refer to it often. Synth projects are considerably complex, and there is not enough room in the book to document every object.
The C++ listings in this book represent the interesting, difficult, or highly synth-oriented code that connects to the theory portions of each chapter. You will need to use the documentation and review the sample project code to get the most out of this book and understand how to select and use whichever C++ objects you like in your own plugin projects.
1.3 Synth Components
Most hardware and software synthesizers are designed from the same set of basic building blocks that will be used throughout this book. Table 1.1 lists these components, their abbreviations, and their descriptions, as applied to the SynthLab projects.
Table 1.1 Synthesizer components, my abbreviations, and descriptions, as used in SynthLab Component | Abbreviation | Description |
Synth engine | Engine | The entire synth, in one object that manages a set of voices |
Synth voice | Voice | This term is not always used the same way, but for SynthLab, it is the object that renders each note-event; a voice contains a collection of one or more of the components below (LFO, EG, etc.) |
Low frequency oscillator | LFO | An oscillator with frequency fo on the range of about 0.02 to 20.0 Hz, though numerous variations on these limits are allowable |
Envelope generator | EG | Produces a unipolar control signal used to modulate other components; it is most closely associated with the output amplifier, where it sets the time-domain contour of the rendered signal |
Digitally controlled amp | DCA | A variable gain and panning amplifier used on the output of each voice |
Virtual analog filter | VAFilter | A synth filter des... |