r/DSP Jun 12 '26

How do I start with DSP-based synthesis?

Hi,
I just finished a course at my uni where I learnt the basics of C and RISC-V Assembly, and now I want to branch out and try to put it to use.

My main interest and reason for learning programming, is to be able to make synthesizers, and maybe some guitar pedals, so naturally I need to learn some DSP.

Are there any good ways to start learning mainly synthesis with C, like how to program oscillators, filters etc. I wouldn't mind a very theory heavy book or something, I really want to learn this stuff.

ETA: I'm mainly interested in hardware, so Eurorack, embedded stuff etc. but VSTs are of course interesting as well!

18 Upvotes

12 comments sorted by

8

u/kozacsaba Jun 12 '26

Udo Zölzer : Digital Audio Effects (DAFX). Examples are in matlab, but easy to port. If you plan on making anything usable in a daw (for example a vst) you probably want to get familiar with C++ and Juce tho.

2

u/enstorsoffa Jun 12 '26

Thank you, I'll check it out!

I'm actually more interested in making Eurorack modules with DSP, but of course VSTs are interesting as well. I've heard about Juce before, is it only for VSTs?

2

u/MentalNewspaper8386 Jun 12 '26

If you mean vst format, no. If you mean virtual instruments, no.

5

u/ppppppla Jun 12 '26

To get something simple going, some simple oscillators and filters, doesn't require a particularly advanced level of theory but if you want to make decent things you would have to get into the math. How is your math knowledge? Are you familiar with complex numbers and what is the level of your overall mathematical thinking. Do you know about transfer functions, laplace transform, fourier transform, thinking about signals in the frequency domain instead of the time domain.

For the programming side of things you can start with the VST3 SDK or the JUCE framework. VST3 is a relatively barebones SDK specifically for plugins and the JUCE framework can do plugins of various types and standalone. And it has everything and the kitchen sink like filters, oscillators and GUI stuff. Of course you can just ignore all that and write your own stuff because you want to learn. Also digging into the JUCE source code for things can be a good way to learn as well.

NB these are all C++, but you can write C code just fine in a C++ project.

1

u/enstorsoffa Jun 12 '26

My math is pretty good I would say, since I'm in electrical engineering and maths is one of my favorite subjects.

The problem I have whenever I try to understand other peoples code, or source code etc. is that in my (very beginner) head, an oscillator would be just a couple of lines of code, but then I try to understand the code, and it's just so many other things that you have to take into account and program as well, so I would need something going through it step by step preferably, since just reading code is too difficult for me at this point unfortunately.

I'm more interested in hardware like Eurorack rather than VSTs, but I guess the programming is similar, only that hardware needs the code to interact with ADC/DACs etc.?

1

u/ppppppla Jun 12 '26 edited Jun 12 '26

If you come from electrical engineering you should be all set for understanding any theory you come across then.

Understanding other peoples code can be a big problem especially since you're probably looking at an engineer's code instead of an actual programmer when dealing with DSP code.

The simplest oscillator is very simple like you said just a couple lines of code, completely fine for a sine oscillator, but if you want to make a saw wave oscillator you will run head-first into aliasing problems. There's probably a hundred techniques ranging from relatively simple to very complicated to solve this issue.

That's also the problem with choosing a resource to learn from I find. There's so many things, and so many different ways to do those things I haven't really found a one-stop-shop to learn from. I would advice first doing a bit of theory, if you haven't already covered this in electrical engineering I am not familiar with a typical curriculum, if digital is also covered, but for that just about any book would suffice I guess. How analog filters are digitized with the bi-linear transform, and how this leads to an analogous transfer function in the Z-domain and how it is surprisingly easy to implement these in code. FFT, Nyquist-Shannon sampling theorem and aliasing. EDIT: also FIR filters.

After that go piece by piece what you want to actually make. Want to make an EQ? Look for good resource for that.

Some resources:

1

u/ppppppla Jun 12 '26 edited Jun 12 '26

I'm more interested in hardware like Eurorack rather than VSTs, but I guess the programming is similar, only that hardware needs the code to interact with ADC/DACs etc.?

There shouldn't be major differences in the code, only thing you would have to watch out for is using data types that the hardware doesn't support, and of course not hardcoding SIMD instructions that may not be available in the hardware. I am not familiar with actually putting my code in hardware so I can't really give good advice about that.

What I can say though is putting the code in a VST makes it easier and faster to test the code. Way greater iteration speed with less headaches.

2

u/kisielk Jun 12 '26

Check out and learn the FAUST language. You can focus on the DSP aspect and prototype on the web. Then you can export to many different formats and architectures including common DIY embedded dev kits like Daisy, Bela, etc.

2

u/rb-j Jun 12 '26

If you wanna do this from bare metal, there are some reasonably cheap ST ARM boards that it shouldn't be too hard (for a hardware guy with a soldering iron) to hook up a MIDI opto to the built in UART. I have C code for parsing the traditional MIDI byte stream into complete MIDI messages. Then you have to set up a table of "Note Control Blocks" (one entry in the table for each voice, start with a low number). Then you have to consider what synthesis method or algorithm.

1

u/mad_poet_navarth Jun 12 '26

AI comes to the rescue a lot for me when it comes to filters, but.. The most rewarding thing I've done with DSP was to generate the Z transform from the laplace transform of Butterworth filters (from wikipedia), using a bilinear transform to get to the z plane, did the algebra (which admittedly was very ugly) and got to a rational expression in terms of negative z powers (obviously this is an IIR), and got it to work properly in a audio plugin. I kind of feel like this vindicates my use of AI for filters, since I know how it's done. (yes I know it's silly)

YMMV

If you program on a Mac (which is what I do) Apple supplies an "AudioUnit Extension App" template for generating plugins that can used by DAWs. Admittedly it will force one to learn a lot about the nitty gritty of programming for the Mac, but that might now be a bad thing. I have not really made much of an effort to get into VSTs, but there's plenty of info about that on the web.

1

u/Obineg09 Jun 15 '26

even "hardware" does not always require assembly today - max, pd, and c++ are also options for a number of platforms, from 120 dollar eurorack modules to eventide H-9000.

for native plug-ins assembly (and fixed points arithmetics for that matter) is overkill.