I’ve been writing a software synthesizer to help develop some ideas that have been percolating recently. Why not use one of the many readily-available synthesizers in the world (either hardware or software)? Two reasons.
Most additive synthesis synthesizers are limited to one or two (or at most, several) oscillators. But what if you want more? Maybe a lot more? I’ve dreamed of having a whole bank of oscillators – dozens of them – to create crazy textures and sounds. With my new synthesizer, I can have as many oscillators as I want.
Nearly all existing synthesizers are tied to the usual 12 note western music scale. That’s convenient in most cases, but not if you want to use a 16 tone scale. Or 10. Or whatever.
I believe that using tools like CSound and ChucK, one could create sounds based on a large number of oscillators and use unusual scales, but whenever I’ve attempted to learn these languages, the learning curve has loomed very steep. I can create very simple ChucK programs, but I don’t know enough about it to do anything sophisticated.
Like with a lot of computer books, I find that the documentation for both ChucK and CSound to be either too simple or too advanced. In too many cases, the authors seem to assume that you already know what you’re doing. There is a real talent in writing good beginner- and intermediate-level computer tutorials, which seems to be largely lacking among academic types.
In the past, I have generated tones by hand in an audio editor, which works fine for simple sounds in small sample sets, but gets tedious and error-prone with larger, more complicated sets. So having a way to batch process large, complex synthesis processes would be nice.
Also, since I’m going to have my sequencer program play the notes, I don’t care if the synthesis happens in real time or is audible during the synthesis. I only need to output WAV files. So, the synthesizer needs have no limits (thousands of oscillators? sure!), and can be slow an inefficient (meaning, even I can write it).
The downside to the non-realtime approach is that unlike with a hardware synthesizer, you can’t fiddle around with settings on the fly and zero in on what sounds good in realtime. The iterations take longer, and it helps if you have an idea of what you’re trying to accomplish in audio terms.
The Bangsplat Non-Realtime Audio Synthesizer is very simple. I am building it in blocks like a modular analog synthesizer. So far, I have built the equivalent of the VCO (Voltage-Controlled Oscillator) and ADSR (Attack Decay Sustain Release) Envelope Generator. I have essentially written the VCA (Voltage-Controlled Amplifier), but it is essentially stuck in one position, though that will change with the next version.
It has a command-line interface which allows for scripting and batching of work. Most of the planning will get done in a spreadsheet, and get converted to a shell script to generate all the various pieces which I will use with my sequencer.
The “VCO” uses sine waves. Many analog synths use sawtooth waves because it’s easy to build an electronics circuit which produces them. But this is a computer, and has no such limits. Sine waves sound better, and if you combine enough sine waves in the right combination, you can make any sound you want, even square and sawtooth waves (this is how most audio compression schemes work). That said, I may add alternate oscillator types in future versions.
It can use as many oscillators as desired – there are practical limits, such as the shell’s command line length limit (thousands of characters), and the fact that each additional oscillator added increases the time required to generate the sound. There is also in theory an internal limit based on the floating point representation of samples, but I think I’ll run out of patience with processing time long before I hit this limit.
One practical use for the extra oscillators is to add overtones to a sound. An electronic sine wave oscillator opened in a frequency analyzer will show a single spike around the primary frequency. A real-world oscillator (say a guitar string) generates a whole series of frequencies at regular intervals called overtones. The appropriate use of overtones in sound synthesis can help give a more naturalistic, less synthetic feel.
The ADSR Envelope Generator is a way of further modeling the sound. When you pluck a guitar string or strike a drum, there is a period of time where the sound ramps up from (relative) silence to the full volume of the sound. This is called the attack, and it helps define how hard (percussive) or soft the sound is. There is a similar fade out at the end of the sound, called the release. Sustain is the volume level that the sound settles to after the Attack, and Decay is how long it takes to get from the end of the attack to the sustain.
Currently, the “VCA” is constantly cranked up to the maximum all the time. I’m planning on adding the ability to turn it down. This is not critical because the gain can always be controlled during the sequencing and mixing.
These three components make a basic synthesizer. The only other common component is a VCF (Voltage-Controlled Filter) which further shapes the sound by cutting off frequencies above a particular point. This can be helpful for controlling higher aliasing frequencies which can result when mixing multiple signals. Like the VCA, this is not critical as it can be applied during the sequencing and mixing. The VCF will be the trickiest part of the synthesizer.
Here is a quick sample of a 440 Hz “A” generated with 0, 1, 2, and 3 overtones. The brighter tones are the ones with more overtones.