Ask HN: How to get started with audio programming?
This is a topic close to my heart as I&#x27;ve always been very into music production and programming, and have dabbled with a few things over the years, but have only started working professionally with audio software in the last few years.<p>What is your background, and which parts of audio programming would you like to focus on? e.g. are you interested in writing your own low-level DSP code, or more interested in hooking together higher-level blocks?<p>If you&#x27;re from a web programming background, you can have a lot of fun with the WebAudio API [1]. It provides high level building blocks like oscillators, filters, effects, etc., which you can hook together. It has some rough edges but it&#x27;s a great starting point.<p>Tone.js [2] is a great way to get started with WebAudio, it provides some useful abstractions that let you build fun things quickly, and there are some great examples of WebAudio creativity out there e.g. Blokdust [3]. If you want to go lower level, all major browsers now support the AudioWorklet API [4], which lets you write your own custom DSP algorithms and have them run efficiently within WebAudio.<p>However, WebAudio has limitations in terms of performance, and you can&#x27;t use a WebAudio synth as a plugin in your music production software of choice (well, you might be able to get a browser which runs as a plugin, but it&#x27;s not going to be ideal!).<p>If you want to write professional audio code, you can&#x27;t really avoid working with C++ - it&#x27;s the industry standard approach. This is largely because C++ allows programmers to very carefully design the performance characteristics of their code - specifically, you can avoid doing anything which might take an unknown amount of time (e.g. allocating new memory, locking) while processing on your audio thread - audio is realtime and very low latency, so you need to be sure your code is going to run in the amount of time you think it will.<p>Personally, I think JUCE [5] is a great starting point. It abstracts away some of the complexities of both C++ and audio APIs, allowing you to build cross platform audio apps and plugins without having to worry about platform-specific quirks. They have a pretty good selection of tutorials too [6]. An alternative you could look into is iPlug2 [7]. There are a couple of books by Will Pirkle on the topic of programming audio effects and synths with C++ - the author uses his own framework, but the same principles apply to other frameworks. Make sure you get the new editions if you do get these.<p>You&#x27;ll probably want to take time to learn some C++ basics first if you don&#x27;t already know it, it&#x27;s a hard language to master! I&#x27;m actually working on an integration right now to allow you to build web UIs for JUCE apps, which takes away the complexity of also building the UI in C++ - I&#x27;ll hopefully have something to share in the next few weeks.<p>If you want something a bit more straightforward and you&#x27;re happy just supporting MacOS and iOS, AudioKit [8] is worth a look. It&#x27;s kind of in between WebAudio and JUCE in terms of complexity I&#x27;d say - you write your code in Swift and it provides a load of high level building blocks, but you can drop down to a lower level if you need to write your own stuff in C++. Also the CoreAudio&#x2F;CoreMIDI APIs on Apple platforms are very powerful, though I&#x27;ve struggled to find great documentation.<p>One other option you could look at are specialist audio languages like Supercollider [9] and Faust [10], or visual programming tools like Max [11] or Pure Data [12]. I&#x27;m not very well versed in any of these, but I&#x27;ve heard good things about Supercollider especially.<p>Phew, hope that helps! As you can probably tell, I&#x27;m really interested in this stuff so please give me a shout with any questions!<p>Edit: one more resource I remembered, there&#x27;s a Youtube channel dedicated to learning audio programming, mostly using JUCE, called The Audio Programmer [13]. I haven&#x27;t actually watched much content so can&#x27;t say too much about that, but I know the guy behind it and he&#x27;s great, and also runs a great community for people interested in audio programming [14].<p>[1] <a href="https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;API&#x2F;Web_Audio_API" rel="nofollow">https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;API&#x2F;Web_Audio_A...</a><p>[2] <a href="https:&#x2F;&#x2F;tonejs.github.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;tonejs.github.io&#x2F;</a><p>[3] <a href="https:&#x2F;&#x2F;blokdust.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blokdust.com&#x2F;</a><p>[4] <a href="https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;API&#x2F;AudioWorklet" rel="nofollow">https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;API&#x2F;AudioWorkle...</a><p>[5] <a href="https:&#x2F;&#x2F;juce.com" rel="nofollow">https:&#x2F;&#x2F;juce.com</a><p>[6] <a href="https:&#x2F;&#x2F;juce.com&#x2F;learn&#x2F;tutorials" rel="nofollow">https:&#x2F;&#x2F;juce.com&#x2F;learn&#x2F;tutorials</a><p>[7] <a href="https:&#x2F;&#x2F;github.com&#x2F;iPlug2&#x2F;iPlug2" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;iPlug2&#x2F;iPlug2</a><p>[8] <a href="https:&#x2F;&#x2F;audiokit.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;audiokit.io&#x2F;</a><p>[9] <a href="https:&#x2F;&#x2F;supercollider.github.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;supercollider.github.io&#x2F;</a><p>[10] <a href="https:&#x2F;&#x2F;faust.grame.fr&#x2F;" rel="nofollow">https:&#x2F;&#x2F;faust.grame.fr&#x2F;</a><p>[11] <a href="https:&#x2F;&#x2F;cycling74.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;cycling74.com&#x2F;</a><p>[12] <a href="https:&#x2F;&#x2F;puredata.info&#x2F;" rel="nofollow">https:&#x2F;&#x2F;puredata.info&#x2F;</a><p>[13] <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;channel&#x2F;UCpKb02FsH4WH4X_2xhIoJ1A" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;channel&#x2F;UCpKb02FsH4WH4X_2xhIoJ1A</a><p>[14] <a href="https:&#x2F;&#x2F;theaudioprogrammer.com&#x2F;community&#x2F;" rel="nofollow">https:&#x2F;&#x2F;theaudioprogrammer.com&#x2F;community&#x2F;</a>