About the Book
Audio programming is a lot of fun, but it has always been hard to get into. Most of the existing teaching materials aren't written for the audio programming enthusiast and generally don't cover the topic of plug-ins, also known as VSTs. Until now!
Code Your Own Synth Plug-Ins With C++ and JUCE provides a clear introduction to the world of audio programming, using a real software synthesizer as the example project. This book is for programmers of all experience levels who want to learn how audio plug-ins work under the hood, and how these synths can magically create sound out of nothing.
Why this book? Some time ago I came across the source code for a virtual analog synthesizer plug-in called MDA JX10. I wanted to understand how this synth worked and so I started going through the code to clean it up and add comments. While doing this, I realized that this synth would make an excellent topic for a book — it has a little bit of everything one needs to know to get started with audio development and digital signal processing, tied neatly together into a working plug-in.
Most plug-ins these days are written using the popular JUCE audio programming framework. There aren't many books available about JUCE — or even about how to make synthesizers — and so I decided I might as well write one, explaining how to code a modernized version of the MDA JX10 synth from scratch.
This book takes you on a journey of building a software synthesizer step-by-step, starting from the very basics and ending up with a full-featured VST or Audio Unit plug-in that can be used in any of the popular DAWs such as Logic Pro, REAPER, FL Studio, Cubase, Bitwig Studio, and others.
Topics covered in the book:
- Synthesizer design: What synthesizers are and the different building blocks they are made from.
- How and why to use JUCE for making audio plug-ins.
- All about handling MIDI.
- What digital audio is, and the basics of digital signal processing (DSP).
- Oscillators, from a simple sine wave to a bandlimited sawtooth, and how to combine oscillators into a square wave with pulse width modulation (PWM).
- Using an analog-style ADSR envelope to shape the sound over time.
- Polyphony and voice stealing, legato-style playing, handling the sustain pedal, and other voice management topics.
- Filters and how to use them to make your synth sound awesome.
- Modulation using velocity, LFO, filter envelope, and MIDI CC such as the modulation wheel.
- Parameter smoothing and other ways to avoid audio glitches.
- How to communicate between the audio thread and the UI thread, the proper way.
- Building a good-looking user interface for the plug-in.
- And lots more: factory presets, glide, avoiding aliasing, adding a MIDI learn function, and so on...
This book packs a lot of information into its 360 pages. It's a follow-along tutorial of how to create a complete synthesizer plug-in, with lots of explanations of why you're doing everything and hints of new avenues to explore. If you've ever wondered how software synths work — or how to build your own — then this book is a great place to start learning!
Is this book for you? Maybe you've been trying to get into audio programming but didn’t know where to start, or you’re just curious how audio plug-ins work, or perhaps you were overwhelmed by the amount of math in a typical DSP course... This book explains it all. You'll learn the fundamentals of making audio plug-ins in general and synths in particular, in an easy-to-follow guide that is light on math and heavy on being practical. The only prerequisite is some knowledge of C++ and a Mac, Windows, or Linux computer.
Why is this book using C++? It's true that C++ doesn't have a great reputation, but because it produces fast code it's the industry standard programming language for audio development, and JUCE is the standard framework. I've kept the C++ in this book as simple as possible, so don't let C++'s notoriety scare you off. Anyone with basic programming skills should be able to follow along with this book.
Do you need to know math to understand this book? Not at all! While being familiar with math can be very helpful for someone pursuing a career in DSP or audio development, writing a synthesizer plug-in can be done with high-school level math skills. There is only a little math in this book and you can mostly skip it if it gives you the creeps.
The source code for the book is available on GitHub, including several audio demos of what the synth sounds like. Go ahead, check it out and then come back to buy this book!
About the Author
Matthijs Hollemans is a professional audio programmer. In his spare time he's a hobbyist musician who really needs to learn how to play the piano properly. Matthijs wrote the best-selling book The iOS Apprentice and is a co-author of Machine Learning by Tutorials from Kodeco (formerly raywenderlich.com). Check out his audio development blog at audiodev.blog.