posted: July 29, 2009
For the past 1-2 weeks I've been working on an audio synthesizer in Silverlight 3. The app is in enough of a stable state that I decided to throw it out into the world.
Try it out: http://kindohm.com/ksynth
Source code: http://code.google.com/p/kindohm-ksynth/
kSynth is a synthesizer. I've been caught off guard when people ask me where I got the audio for the app. I have to explain that the app is generating the audio from scratch (thus, a synthesizer). The app generates raw sound waves from sine, saw, square, and triangle wave calculations. It then mixes manipulates the generated waves through other controls.
The other half of kSynth is a sequencer. Using the note grid you can arrange up to eight pitches over a maximum of 32 timed steps. Each placed note will play a sound from the synthesizer.
The synthesizer itself is made up of three voices. Each voice has five parameters that you can manipulate:
- Wave form (sine, saw, square, triangle, or noise)
- Level - a.k.a. volume
- Pan - how far to the right or left each voice is played
- Phase - an offset of how much the wave calculation is delayed
- Detune - a slight variation of the voice's pitch
These parameters are fairly common parameters used with most modern synthesizer hardware or software.
The synthesizer also has a dynamic envelope that is used to control the shape of each note played from the synthesizer. The dynamic envelope has four parameters:
- Attack - how abruptly or smoothly the note "fades in"
- Sustain - the length of the note
- Decay - how abruptly or smoothly the note "fades out"
- Pitch - bends the pitch of each note up or down
The sequencer also has some additional controls:
- Level - the master volume
- Tempo - speeds or slows up the playback of notes
- Steps - the number of slots available in the sequencer grid
- Delay - adds a delay or "echo" effect to the audio
You can save the voice, envelope, and delay settings by using 16 preset banks:
Click and hold down a preset bank to save the current state of the voices, envelope, and delay to that bank. Recall a preset by clicking once on a bank.
What is the purpose of this application? Easy: to have fun. It's not a musical plugin that will work with any other audio software. I suppose you could use it as an instrument - although it doesn't have a keyboard. It's more of a sequencer than a true instrument.
For me, I had a huge interest in developing an application like this because 1) I love working with synthesizers in electronic music and 2) I knew Silverlight 3 would have audio synthesis capabilities. From the day Silverlight 3 was released (7/10/2009) I started trying to learn how to build this app.
I can't finish writing this without referencing Charles Petzold's article on building a simple sequencer in Silverlight 3. His example helped with the sequencer logic along with some of the base calculations used in the fundamental wave forms and attenuation (amplitude). I also took some idea's from Pete Brown's Silverlight synthesizer.
What doesn't the app have? I really wanted to add a custom wave form editor where you could draw your own wave form and use it in the app. However, this feature got scrapped after successfully proving it out. It was just much more work from a UI perspective than I wanted to invest.
In addition to custom wave forms, there are a few other possible enhancements to this app that I may implement some day:
- Save audio output to wave file
- Save sequencer state
- Upload custom wave files to sequence with
- Support for unlimited number of voices
- EQ and high/low pass filters
I hope to write a few blog posts soon detailing some of the technical aspects of this application.
Enjoy, and happy noisemaking!