3 ms·
My advice would be to start with JUCE. It's a great framework for audio development, and has a lot of example projects for making plugins and hosts. Audio progr
by seertaak 5y ago
My advice would be to start with JUCE. It's a great framework for audio development, and has a lot of example projects for making plugins and hosts. Audio programming is definitely tricky and something of a black art. Even making a simple square wave synth that doesn't sound crap is surprisingly difficult, because of unintuitive artefacts engendered by the sampling theorem. (In a nutshell you have to make the square waves wiggle a bit for them to sound good, otherwise you get lots of high frequency garbage which sounds metallic and ugly.)
Ross Bencina also has some good articles about the realtime aspect. Basically, you shouldn't use locks and should become intimately familiar with ring buffers :)
- seertaak 5y agoOne other comment. There are two rates: audio rate and control rate. Audio rate is "for each sample". Control rate is roughly "once per frame" i.e. once per buffer. If you want to do anything useful you'll need a GUI which can control the parameters of the audio plugin. The GUI will communicate with the audio thread at control rate. The audio thread will usually pick up messages from the GUI via a ring buffer. And by the way, this can happen in reverse, e.g. for level meters, where you do a moving average of squared amplitude (RMS), and output this as a control rate. You can use ring buffers for this, but another approach is to use atomic variables. And in x86 architectures you can actually even use just regular variables because of its strong memory architecture.