Poseidon

Virtual analog software synthesizer

Carl Seleborg

May 8, 2006

Poseidon is my attempt at creating a virtual analog synthesizer. The primary purpose of this is to learn how those things work.

Status : Now that Poseidon is polyphonic, I need to start worrying about performance and sound quality. There's a lot to do, and most importantly, get myself those highly-needed anti-aliasing oscillators. That's next on the list. I also think I will freeze the features, eventhough there are a few controls (especially down there at the LFO section) that are still not implemented yet. They'll have to wait for the next version.

Despite it being a "work-in-progress", there are already some things I think are pretty nifty. The first thing is that whereas most such synths are based around two oscillators, filters, amplifiers, etc., this one is architectured around three of each. All objects interact with each other in complex ways - this is probably a little too abstract for real-life users, but I wanted to experiment with all the possibilities.

I have recorded a few MP3s that you can listen to to get an idea of the various effects.

You can start by listening to the sound from the picture : "Pumping Bass".

Features and sound samples

The three oscillators can generate sine-waves, square waves, triangle or sawtooth waves, and white noise, and send their signal with different amounts to each of the three filters. The wave shape parameter can control the sound of the square waves (listen to an example of variable pulse width), and lets you go smoothly from triangle wave to sawtooth wave (why have I never seen that before?)

The Detune function (top left) makes each of the three oscillators follow a random frequency around the supposed frequency. With sine-waves, you get some cancellations sometimes, but with square or sawtooth waves, it really makes the sound more living. Here's a sound to hear the Detune function in action.

The filters have three modes : low, high and band-pass. They are standard state variable filters. Their cutoff frequency can be controlled by the LFOs, which is how I got that sweeping wind noise in "Pumping Bass". It can also follow the keyboard pitch, and if you combine that with the envelopes, you can get a pretty cool swelling-up sound. The Q, or resonance, can currently be controlled by the keyboard velocity and/or by the envelopes.

Each filter sends its sound down to the corresponding amplifier. The amplifiers are controlled in gain and in panning by two envelopes and two LFOs each.

The envelopes are standard ADSR generators. They generate a sample-by-sample envelope for smooth transitions between the notes. A short attack time with sine-waves give some sort of electronic piano.

Finally, the LFOs generate positive sine-waves to control the other objects (and to control each other, although that's not implemented yet!)

When tweaking a little more, you get to produce quite funny sounds. With little work, you get a complete psychedelic hymn to the rhythm of nature. Yes, I like square waves !

Planned work

There are many things to be done before Poseidon becomes a real synth (although it is already usable to produce musical sounds!).

Version 1 won't be a real soft synth with all that it implies. It will be a rather feature-poor softsynth, but with audio that sounds correctly. I'll worry about all those MIDI-pedal and preset-library stuff at a later stage.

Source code

If you want to look at the source code, read on. Before you have a peak, let me disclaim a little. This is a learning project, meaning that it is not state-of-the-art synthesis. I aim to eventually have a fairly good synth, but I'll have to go through a lot of experimentation before I get there.

My strategy for developing Poseidon was to get something (anything, really) that would make the right kind of sound up and running as fast as possible. You see, that's the only way to know if you're on the right track. I chose an object-oriented design because that's what I do best, and that's how I got a working prototype in less than three days.

Performance was never a goal until now. Actually, I think many softsynths go for that all-the-audio-engine-in-one-big-hand-coded-assembler-function, which lets them squeeze out about 200 or 300 simultaneous voices for the reasonably fast ones. Before I even started worrying about performance, I was at 10 voices. With compiler optimization turned on, I get up to 25. My first goal is 100 - when I get there, I'll stop optimizing and get back to work on the features.

The point is : this is a synth by an application-developer, not by a DSP-hacker, so bear with me here : I will make it better and faster, but that's not the point.

So, therefore, the source code is fairly clean, which is a good thing.

One last thing : the user-interface is not a user-interface. It's a prototype designed to make my life testing the parameters easier. I'm very fond of user-interface design, and I wouldn't use such an uggly synth in my whole life. But again... first things first.

The whole beast is written using Lazy C++, which really really really makes life easier. The LZZ executable is included for Linux.

Given the dependencies to Linux-specific sound drivers and other libraries (ALSA and Jack, and GTKmm and such), Poseidon is really not meant to run on Windows. That's why I include a picture and samples. Here are some of the major dependencies to build and run Poseidon :

I do have a hand-crafted Windows executable somewhere, but it comes on demand and there's a whole bunch of DLLs following it.

If you want to take a peak at the guts, feel free to download the source code. The main file explains the architecture of the synth.

Enjoy !

Carl