coding a synth? - Programmers Heaven

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# coding a synth?

Posts: 1Member
I've been messing around with some soft-synths (mostly Reason), and I'd like to learn more about what is going on behind the scenes by coding my own. Can anybody give me any advice or point me to some resources about this topic?

I'm (unfortunately) running Windows, and I'd probably be writing in C/C++. Any good tools, libraries, or other resources would be helpful. Thanks!

• Posts: 2,914Member
: I've been messing around with some soft-synths (mostly Reason), and I'd like to learn more about what is going on behind the scenes by coding my own. Can anybody give me any advice or point me to some resources about this topic?
:
: I'm (unfortunately) running Windows, and I'd probably be writing in C/C++. Any good tools, libraries, or other resources would be helpful. Thanks!
:
If you're doing addative synthesis, a fairly common method where you build the signal up through a few processes, then you basically need to implement code for an oscillator, an envelope and probably a filter.

Oscillators generate a waveform. It could be a sine curve, or a square wave, or some other waveform. In reality all periodic waveforms are made by summing sine curves, but doing that summation in realtime is slow, so you have what is called a wavetable. The oscillator code is not too hard to write.

The envelope takes the signal from the oscillator which is all at the same amplitude and allows you to do things like attack and decay on it. Essentially it fits a shape to the amplitude. Exponential decay is common, because that's what's normally found in natural oscillating systems (see damped SHM). The envolope is not too hard to implement either.

Filters tend to do stuff in the frequency domain. My experience with filters is tiny; I've never built a digital one, though I have done a few analogue ones in my time (the usual "build an AM radio" style things). I plan to learn more about these at some time soon. But time is short right now.

Info on Fourier Synthesis, which is useful for helping build the oscillator, can be found here:-
http://www.jwcs.net/developers/dap/algorithms/index.html

I'll try and write some articles on wavetables and envolopes in the future, maybe with some implementations that plug in to my open source audio engine project (http://amamp.sourceforge.net/).

Hope this helps, and if you need any more in-depth info feel free to ask. I may even know the answer. :-)

Have fun,

Jonathan

###
for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
(tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
/(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");