12 ms·
Ask HN: How to get started with audio programming?
I recently picked up 'The Audio Programming Book' [0] and so far, I am really liking it. But I am not sure which resource to pick after reading that. Can you recommend me some audio programming resources which are beginner friendly?
[0] https://mitpress.mit.edu/books/audio-programming-book https://mitpress.mit.edu/books/audio-programming-book
Edit: My goal is to make a mini-synth which takes input from the computer keyboard.
- Flex247A 5y agoReading 'The Audio Programming Book' also clarified the concept of OOP for me. There was a small section where function pointers in C structs was discussed. Just after that, there was a section on struct classes in C++ which made it clear why data members should be grouped with their related functions.
- anigbrowl 5y agoLiterally go with this other project on the front page right now, it's good a good pedigree and a healthy ecosystem: https://news.ycombinator.com/item?id=27269589 https://news.ycombinator.com/item?id=27269589 If you want a really gentle start, try Sassy: https://sol-hsa.itch.io/sassy https://sol-hsa.itch.io/sassy
- smlss_sftwr 5y agoHaven't read that book so I'm not familiar with the contents, but if you're interested in creating VST plugins you might want to check out some frameworks out there like JUCE: https://juce.com/ https://juce.com/ I don't know if you're a musician yourself but I'd highly recommend downloading a DAW and playing around with the plugins to get a sense of common audio processing modules, you can perhaps make it a near-term goal to create an EQ or filter plugin that you can install and use in the DAW. IIRC I think Ableton Lite should have a free demo, Reaper is another well-regarded free DAW from what I've heard
- throwaway721 5y agoDepends on what audio programming do you want to do really. If you are interested in the audio side, I would recommend https://puredata.info/ https://puredata.info/ (it has tutorial on synthesis and everything). If you want to explorer the programming side, I would just go picking apart small synths: https://github.com/grumdrig/jsfxr https://github.com/grumdrig/jsfxr http://www.pouet.net/prod.php?which=20656 http://www.pouet.net/prod.php?which=20656 (click on source, there's a mini synth there in that demo).
- gerlofs 5y agoIt depends on what you're trying to achieve. I'd say pick a project you want to work on and go from there, resources on JUCE/C++ aren't always going to be helpful if you don't want to write plugins.
- wrnr 5y agoTake a look at the source code of the Pink Thrombone, there are some interesting link in the comments of the source: https://dood.al/pinktrombone/ https://dood.al/pinktrombone/
- rmnclmnt 5y agoTwo books I loved during my digital signal processing studies (especially in the audio field): - "Introduction to Computer Music"[0] by Nick Collins: very focused on audio programming for musical applications but you can easily extrapolate for other domains. Lots of pseudo-code algorithms are provided. - "The Scientist and Engineer's Guide to Digital Signal Processing"[1] by Steven W. Smith: the bread and butter for everything concept related to DSP. Everything is explained in a crystal-clear fashion, lots of sample code to get you started with digital filters and analysis (although written in BASIC but easily translatable to C/C++ or even Python). Also there is this one article "Real-time audio programming 101: time waits for nothing"[2] by Ross Bencina (creator of AudioMulch, Portaudio, etc.) about the basics concepts of real-time audio programming [0] https://www.wiley.com/en-gb/Introduction+to+Computer+Music-p-9780470714553 https://www.wiley.com/en-gb/Introduction+to+Computer+Music-p... [1] https://www.dspguide.com/ https://www.dspguide.com/ [2] http://www.rossbencina.com/code/real-time-audio-programming-101-time-waits-for-nothing http://www.rossbencina.com/code/real-time-audio-programming-...
- Flex247A 5y agoThank you so much!
- clauswitt 5y agoI wrote a CLI version of a sequencer (multitrack sequencing with plugins and automation where a simple xml format controls the sequencer events) a couple of years ago. I had a quite clear vision of what I wanted to achieve, and then picked C++ and JUCE and just started figuring things out. I generally learn best by having a real thing to build; and then finding the resources I need when I get stuck. I buy books aspirationally (I have bought the Audio Programming Book as well come to think of it) - so I often end up with many books on subjects that interests me, without learning much from them.
- lxdesk 5y agoImplement a MIDI 1.0 sequencer and get it to play back SMF files with a sine wave synth - you can have it output a WAV file, or learn an API to do realtime rendering. It's not a large spec, there are lots of old documents on how the protocol functions in practice, and then once you start getting it working you'll get results instantly(lots of SMF files around to test with) but will want more features, better synthesis; complications start to arise and you will then pick up a lot of knowledge by doing.
- Grustaf 5y agoNot answering your question, but if you're interested in audio programming you might find Pure Data interesting, it's sort of visual audio programming. It might seem like a toy but it's actually incredibly powerful: https://puredata.info https://puredata.info
- yummypaint 5y agoSecond for puredata. It's pretty different from other options but very powerful. It's also quite visual and uses the same kind of design concepts involved in setting up a traditional modular synth.
- Nekorosu 5y agoThere is a more up to date fork of it called Purr Data https://www.purrdata.net/ https://www.purrdata.net/
- spacechild1 5y agoPurr Data is not really more “up to date“, it is rather Pd vanilla with batteries included + a nicer UI. Both are actively developed. Note, however, that they are not 100% compatible: both have features that the other one is (still) missing.
- tomduncalf 5y agoThis is a topic close to my heart as I'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. 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? If you'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's a great starting point. 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. However, WebAudio has limitations in terms of performance, and you can'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's not going to be ideal!). If you want to write professional audio code, you can't really avoid working with C++ - it'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. 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. You'll probably want to take time to learn some C++ basics first if you don't already know it, it's a hard language to master! I'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'll hopefully have something to share in the next few weeks. If you want something a bit more straightforward and you're happy just supporting MacOS and iOS, AudioKit [8] is worth a look. It's kind of in between WebAudio and JUCE in terms of complexity I'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/CoreMIDI APIs on Apple platforms are very powerful, though I've struggled to find great documentation. 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'm not very well versed in any of these, but I've heard good things about Supercollider especially. Phew, hope that helps! As you can probably tell, I'm really interested in this stuff so please give me a shout with any questions! Edit: one more resource I remembered, there's a Youtube channel dedicated to learning audio programming, mostly using JUCE, called The Audio Programmer [13]. I haven't actually watched much content so can't say too much about that, but I know the guy behind it and he's great, and also runs a great community for people interested in audio programming [14]. [1] https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_A... [2] https://tonejs.github.io/ https://tonejs.github.io/ [3] https://blokdust.com/ https://blokdust.com/ [4] https://developer.mozilla.org/en-US/docs/Web/API/AudioWorklet https://developer.mozilla.org/en-US/docs/Web/API/AudioWorkle... [5] https://juce.com https://juce.com [6] https://juce.com/learn/tutorials https://juce.com/learn/tutorials [7] https://github.com/iPlug2/iPlug2 https://github.com/iPlug2/iPlug2 [8] https://audiokit.io/ https://audiokit.io/ [9] https://supercollider.github.io/ https://supercollider.github.io/ [10] https://faust.grame.fr/ https://faust.grame.fr/ [11] https://cycling74.com/ https://cycling74.com/ [12] https://puredata.info/ https://puredata.info/ [13] https://www.youtube.com/channel/UCpKb02FsH4WH4X_2xhIoJ1A https://www.youtube.com/channel/UCpKb02FsH4WH4X_2xhIoJ1A [14] https://theaudioprogrammer.com/community/ https://theaudioprogrammer.com/community/
- imvetri 5y agoYou can try to build an visual audio editor and learn everything else from there, step by step.
- Flex247A 5y agoI am building one currently :)
- imvetri 5y ago:)
- degif 5y agoThat is how I learned the very basics of web audio and modular synthesizers at once (here's the result https://github.com/spectrome/patchcab https://github.com/spectrome/patchcab). Setting a clear goal makes the learning much easier.
- imvetri 5y agoLooks cool
- joshka 5y ago* Valhalla DSP Blog - so many good articles on the real world idea. https://valhalladsp.com/blog/ https://valhalladsp.com/blog/ * JUCE for making VSTs. https://juce.com/ https://juce.com/ * ELK Audio for hardware / audio. https://elk.audio/ https://elk.audio/ * Find open source projects that meet your needs / desires.
- antfarm 5y agoThink DSP is a free book on digital signal processing in Python: https://greenteapress.com/wp/think-dsp/ https://greenteapress.com/wp/think-dsp/
- vnorilo 5y agoprof. Julius Smith has a huge amount of music dsp resources available freely [1] 1: https://ccrma.stanford.edu/~jos/sitemap.html https://ccrma.stanford.edu/~jos/sitemap.html
- antfarm 5y agoIf you are on macOS, AudioKit is a nice simplified layer on top of CoreAudio and CoreMidi: https://github.com/AudioKit/AudioKit https://github.com/AudioKit/AudioKit It ccomes with many Xcode playgrounds for interactive exploration of the SDK.
- heldrida 5y agohttps://llllllll.co/t/lower-level-audio-programming/1259/8 https://llllllll.co/t/lower-level-audio-programming/1259/8 https://theaudioprogrammer.com https://theaudioprogrammer.com
- Crusoe123 5y agoDesigning Audio Effect Plugins - https://www.routledge.com/Designing-Audio-Effect-Plugins-in-C-For-AAX-AU-and-VST3-with-DSP-Theory/Pirkle/p/book/9781138591936 https://www.routledge.com/Designing-Audio-Effect-Plugins-in-... This book teaches you DSP and also how to apply those DSP algorithms by employing them inside an audio plugin.
- haywirez 5y agoJoin the Audio Programmer community: https://theaudioprogrammer.com/ https://theaudioprogrammer.com/
- satao 5y agois this page's discord group still active? i couldn't join
- Mizza 5y agoIt depends what you're trying to accomplish, but I found VCV Rack to be a great environment to implement synth ideas without having to worry about reinventing the wheel. Trying making a Rack module! https://vcvrack.com/ https://vcvrack.com/
- Archit3ch 5y agoIf you're interested in synths, there is a new version of the Pirkle synth book coming out soon. Also, I second the suggestion to join the Audio Programmer community.
- qiqitori 5y agoOnly related if you just read the title and ignore the rest, but I loved this article: https://zserge.com/posts/etude-in-c/ https://zserge.com/posts/etude-in-c/ Covered on HN late last year https://news.ycombinator.com/item?id=24940624 https://news.ycombinator.com/item?id=24940624 ("How to create minimal music with code in any programming language") Also related to bytebeats: https://soundcloud.com/robertskmiles/bitshift-variations-in-c-minor https://soundcloud.com/robertskmiles/bitshift-variations-in-...
- gregsadetsky 5y agoI’ll repost a comment I made a few years ago. Hopefully the (informative, and authoritative) reference will be useful! —— The founder, and sole developer of Mutable Instruments (a well known modular audio/synth maker) wrote about her recommendations on how to get started in audio programming here [0]. Much recommended for the cited books, and general/business advice on making a hardware audio product. [0] https://modwiggler.com/forum/viewtopic.php?p=2858814#p2858814 https://modwiggler.com/forum/viewtopic.php?p=2858814#p285881... —— My own post about this was from a mini thread on HN about programming sound that may also interest you: https://news.ycombinator.com/item?id=20491766 https://news.ycombinator.com/item?id=20491766 —— Last note! Another synth maker personally recommended the same DSP book as noted in the comment above (on Modwiggler), so it’s probably worth checking out! Udo Zolzer's "DAFX"
- ratww 5y ago> https://modwiggler.com/forum/viewtopic.php?p=2858814#2858814 https://modwiggler.com/forum/viewtopic.php?p=2858814#2858814 Fixed link (anchor is broken!): https://modwiggler.com/forum/viewtopic.php?p=2858814#p2858814 https://modwiggler.com/forum/viewtopic.php?p=2858814#p285881... As an EE that only became a programmer later, I would like to add that those are amazing tips.
- gregsadetsky 5y agoThanks a lot, I edited and simplified my comment, linking directly to the post!
- capableweb 5y agoJust today there was a Audio Operating System featured on HN that looks like a great starting point for audio programming and it comes with everything you need. Unfortunately it looks like everything is out of stock, but looks interesting none the less and you can probably run it in a VM until they get the development kits in stock again. - https://news.ycombinator.com/item?id=27269589 https://news.ycombinator.com/item?id=27269589 - Elk OS – Audio Operating System - https://elk.audio/audio-os/ https://elk.audio/audio-os/
- adriancooney 5y agoShameless plug for my own audio programming experiment: https://noise.sh https://noise.sh It's not as powerful as something like PureData but it does give you a simple and intuitive introduction to DSP and audio synthesis.
- squishy47 5y agoCycling 74's Max is a really good way to get into audio (and visual) programming. It introduces the concepts of programming and DSP whilst still keeping things beginner friendly. It's a lot more beginner friendly that something like JUCE which, while super powerful, has a much steeper learning curve and requires you to know C++. Major downside is that it's not suitable for making full audio plugin products, rather I would use it to prototype a plugin, the DSP logic and even the UI before writing any text-based code for a VST/AU. You can absolutely make a nice synth that takes input from pretty much anything you can attach to a computer. And as everyone else has said - theAudioProgrammer is good too. (Edit) - Pure Data (PD) is an open source alternative to Max which is free. I've heard people recommend it but never used it myself.
- severak_cz 5y agoHi, I started with Csound and Cabbage framework[1] which I used to create some VST plugins. Then I moved to javascript lands (as everyone already has runtime called web browser) and I am creating sort of DAW using webaudio. I used Tone.js, but it was somewhat confusing, so I started my own library[2]. It's not finished yet but I have already nice and usable demo - comb organ playable with computer or MIDI keyboard with built-in "tape recorder"[3]. Good news is that is open source so you can actually stole some ideas from me. [1]: https://cabbageaudio.com/ https://cabbageaudio.com/ [2]: https://github.com/severak/cyber-music-studio/blob/main/js/heartbeat.md https://github.com/severak/cyber-music-studio/blob/main/js/h... [3]: https://severak.github.io/cyber-music-studio/regenschori.html https://severak.github.io/cyber-music-studio/regenschori.htm...
- weavie 5y agoCabbage has some great testimonials! > My music used to make children cry. But since using Cabbage the children laugh and dance with joy. > Julie, Montreal
- severak_cz 5y agoalso: > No vegetables were harmed in the making of this software
- dvh 5y agoIn your demo, if you are not using <button> for buttons, please at least set css "user-select: none" so that when I move mouse 1px after clicking it still works as button.
- tristanMatthias 5y agoI used tone.js for https://synthia.app https://synthia.app
- Insanity 5y agoI've used The Audio Programming book in conjunction with "Musimathics" http://musimathics.com/ http://musimathics.com/ to write many parts of GoAudio. (https://github.com/DylanMeeus/GoAudio https://github.com/DylanMeeus/GoAudio).
- 0x737368 5y agoBrowsers have a very accessible API for audio programming now[0]. Comes with the benefits of being platform independent, using JS(okay, this as a benefit is arguable to some), and easily distributable(perhaps too easy since you can't hide your source code either, unless you do some form of SaaS and introduce latency). [0] - https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_A...
- beardyw 5y agoIt is surprisingly good, though programming per sample seemed unusable on my plenty fast enough machine.
- seertaak 5y agoMy 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.
- ioseph 5y agoI found writing a module for VCV rack quite accessible
- CraigJPerry 5y agoI watched CppCon 2015: Timur Doumler “C++ in the Audio Industry” https://m.youtube.com/watch?v=boPEO2auJj4 https://m.youtube.com/watch?v=boPEO2auJj4 not long ago and enjoyed it. He was a developer at Roli working on synths and he goes through real time strategies to keep the response time under around 30ms IIRC
- am_lu 5y agoHave a look at Teensy microcontrollers and Audio shield available for them. https://www.pjrc.com/store/teensy3_audio.html https://www.pjrc.com/store/teensy3_audio.html
- kesor 5y agoIt is even better to learn audio in its analog form first, great explanations by Moritz here https://www.youtube.com/channel/UCzfW6SlNEyxmAPtdr3n-_Og https://www.youtube.com/channel/UCzfW6SlNEyxmAPtdr3n-_Og
- JoeDaDude 5y agoThere is an online course in audio signal processing, FWIW. Caveat: I have not taken this course. https://online.stanford.edu/courses/sohs-ymusic0001-audio-signal-processing-music-applications https://online.stanford.edu/courses/sohs-ymusic0001-audio-si... See also this book about computational music synthesis: https://cs.gmu.edu/~sean/book/synthesis/ https://cs.gmu.edu/~sean/book/synthesis/
- jimktrains2 5y agoI've been working on a little synthesizer as a means of learning rust. https://github.com/jimktrains/synth https://github.com/jimktrains/synth Sound on sound has a series on synthesizer concepts. https://www.soundonsound.com/series/synth-secrets https://www.soundonsound.com/series/synth-secrets Dsp guide is a great resource. http://dspguide.com/ http://dspguide.com/ Music dsp also has some good information and implementations. https://www.musicdsp.org/en/latest/index.html https://www.musicdsp.org/en/latest/index.html
- adityatb 5y agoIf you're new to programming, it might also help you to get started with Max/MSP and YouTube videos that already show you how to make the mini-synth you're after (terrible as a programming environment but great as a learning/prototyping tool). The Computer Music Tutorial by Curtis Roads is a good companion here if you want inner workings. You might be able to snag a PDF copy online to see if it's for you. Audio Programming Book is entirely in C and can be a bit of a pain to get things working in C if you're new to programming (although highly worth the initial struggle if you're looking at it with a career in mind), although I'd still recommend stepping from Max/MSP into MATLAB/Python, which focuses on functionality rather than programming itself. Python is also bit more beginner friendly, although C++ will probably end up being your long term bet. I'd pick up the Pyo library for python, and/or a tutorial like this one, after dabbling with Max/MSP a bit: https://python.plainenglish.io/build-your-own-python-synthesizer-part-3-162796b7d351 https://python.plainenglish.io/build-your-own-python-synthes... Then if you want to get even deeper into the DSP, you could go with pretty much any of the other resources the others have mentioned here. My personal faves are the Steven Smith DSP book, Julius Smith's resources (with its runnable MATLAB scripts), and DAFX book by Udo Zolzer.
- cactus2093 5y agoThere are other programming toolkits for audio programming as well, like pure data and JUCE. Idk maybe it’s just me but I’m an experienced programmer and I’ve spent hours learning max/msp and really don’t like the visual aspect. I like programming in vim normally and zipping around the file manipulating text very efficiently without ever taking my hands off the keyboard. Max/msp is the exact opposite, everything is drag and drop mouse movements, and then you can’t just insert new lines in a file to extend something you have to constantly be dragging your existing components out of the way to make room for new components. I find it way more tedious than any other programming environment I’ve used.
- tomduncalf 5y agoI find the same personally, but then I've seen people who would never consider themselves programmers fluently create things in Max, so I guess it depends on your background. Max actually does have a Javascript API, it's a bit old fashioned and you couldn't use it for any DSP related stuff, but can be useful for some stuff. I used it to build a prototype of something that I'd have no idea how to build visually in Max (basically a macro parameter fader for Max for Live), but is fairly straightforward in code, and took some time to figure out a nice(ish) workflow for working with it with Typescript: https://github.com/tomduncalf/livefader https://github.com/tomduncalf/livefader I wonder if you could use that plus the "gen~" object and/or dynamically generating Max objects from JS to do more advanced synthesis-type stuff. May be more trouble than it's worth though.
- ArtWomb 5y agoSolid Gold List! I got into audio with ChucK: Strongly-timed, Concurrent, and On-the-fly Music Programming Language. Concurrency primitives are built right into the language spec, so it's easy for programmers to grok per sample digital sound. Powers laptop orchestras, but simple enough that you can build a laptop synthesizer in 100 lines of code http://chuck.stanford.edu/ http://chuck.stanford.edu/
- shog_hn 5y agoIt might not be inline with your exact goals, but I've really been enjoying doing audio visualization lately. I'm using the Unity game engine, and am leaning heavily on already-implemented FFT algorithms available on the Unity AudioSource component, but the fun part is taking the spectrum data, dividing it up into bands, and doing visuals with those. Here is a short video showing a simple audio visualization demo I created: https://www.youtube.com/watch?v=kYt0dcUY3i8 https://www.youtube.com/watch?v=kYt0dcUY3i8 It led me down a bit of a rabbit hole with watching videos about Fast Fourier Transforms, and learning more about audio specific programming.
- Jimpulse 5y agoHave any resource recommendations? I have a future project lined up for audio visualization on a custom LED array.
- daviddever23box 5y agoI manage a team in this field presently; the answer to your question depends on whether you want to be gainfully employed doing so, or not. Web Audio API and JUCE are the modern building blocks for mostly everything out there; if you're familiar with these, that's a really good place to start. If you're looking for something accessible, SOUL is an excellent domain-specific scripting language that leverages JUCE underneath; see https://github.com/julianstorer https://github.com/julianstorer for more context. I'm not as sold on Max/MSP or Pd, though they're fun to play with for a brief moment.
- pier25 5y agoWhat is the Web Audio API used for?
- Tade0 5y agoGames mostly, but there exist web-based digital audio workstations as well: https://filmora.wondershare.com/audio/best-free-daw-online.html https://filmora.wondershare.com/audio/best-free-daw-online.h...
- jacquesm 5y agoThis for instance: https://tonejs.github.io/ https://tonejs.github.io/ Go wild: https://tonejs.github.io/demos https://tonejs.github.io/demos
- anchpop 5y agoI'm super interested in SOUL. I noticed the keynote was two years ago and it's still being developed, makes me hopeful for its future.
- nexttime 5y agoMost of the good resources where already mentioned, but these are some I missed: - Musimathics Vol I & II: This will teach you the basics of Music and DSP in a very approachable way. I wish I had these when I started writing audio software. - The Art of VA Filter Design: https://www.native-instruments.com/fileadmin/ni_media/downloads/pdf/VAFilterDesign_2.1.0.pdf https://www.native-instruments.com/fileadmin/ni_media/downlo... If you are programming in C, these libraries are very useful: - PortAudio: Cross platform audio playback - libsndfile: Easy and cross platform sound file io - ladspa: Really simple plugin API, useful if you want to make or use audio plugins without all the boilerplate of vst or lv2
- Flex247A 5y agoIf you don't mind, what music software did you start writing?
- timdaub 5y agoHey, I asked myself too how I should get started with Audio Programming in 2019. I ended up building my own little synth in the progress and I ended up talking to people from Ableton and even gave a talk at Native Instrument's headquarters here in Berlin. I blogged about my experience and my product here: https://timdaub.github.io/2020/02/19/wasm-synth/ https://timdaub.github.io/2020/02/19/wasm-synth/
- oilbagz 5y agoGet into Zynthian: http://zynthian.org/ http://zynthian.org/ Tons of great code to read and projects to understand .. Also, the Basic Synth book is a dream: http://basicsynth.com/ http://basicsynth.com/
- fortran77 5y agoA great, fun, system is CSOUND https://csound.com/ https://csound.com/
- rustybolt 5y agoLong, long ago I made a simple synthesizer for windows using the CoreAudio API (there is a newer one, WASAPI, but I never got it to work well myself since it is so complicated). It's a fun project. It is also easy to add some simple filters this way. If you don't want to do realtime synthesis, you can also dive in the (uncompressed) WAV file format and make programs that generate sound files. Another thing that might be nice (but I personally haven't tried) is to synthesize your own drums, 808-style. Google 'kick synthesis' for example.
- gwbas1c 5y agoShort answer: Just do it. Now that you've read a book, pick an extremely simple task and just do it. For example, maybe try writing a command-line program that will just play a square wave through the speakers. Then, build up your skills by making options for sawtooth, triangle, and sine waves. Finally, in the callback from the audio API, poll the keyboard to decide what tones to play. ;) FWIW: A few years ago I wrote a functional keyboard and mouse synth program that just did sine, triangle, square waves and harmonics. It sounded a lot like an organ. (I later lost interest.) What helped was that I found a wrapper for MacOS CoreAudio that dramatically simplified the API so all I needed to do was provide a stream of floats. (I don't remember the name.) Don't fall under the illusion that you can just read books and at the end you'll know how to do this. You'll need to work through simplified tasks to build your skills and understanding before you can write your mini-synth.
- 33degrees 5y agoA couple of lists with tons of resources: https://github.com/olilarkin/awesome-musicdsp https://github.com/olilarkin/awesome-musicdsp https://github.com/DolbyIO/awesome-audio https://github.com/DolbyIO/awesome-audio
- skripp 5y agoHere are four videos on the subject from my absolute favorite Yotuber, One Lone Coder (whom, sadly, is more or less on a hiatus now after having a kid. Damn those pesky kids!!!!) https://m.youtube.com/watch?v=tgamhuQnOkM&t=77s https://m.youtube.com/watch?v=tgamhuQnOkM&t=77s https://m.youtube.com/watch?v=OSCzKOqtgcA&t=2s https://m.youtube.com/watch?v=OSCzKOqtgcA&t=2s https://m.youtube.com/watch?v=kDuvruJTjOs https://m.youtube.com/watch?v=kDuvruJTjOs https://m.youtube.com/watch?v=roRH3PdTajs https://m.youtube.com/watch?v=roRH3PdTajs
- iainctduncan 5y agoThe Will Pirkle books are excellent, and he did a new edition of the synthesizer one. "Designing Software Synthesizer Plugins in C++: With Audio DSP" Also, you can learn a ton by looking at various other higher level languages do it: Csound, SuperCollider, PureData are all open source. Oli Larkin made a brilliant page of resources on github: https://github.com/olilarkin/awesome-musicdsp https://github.com/olilarkin/awesome-musicdsp
- khiner 5y agoShameless plug but I put together some Jupyter notebooks that walk through several of the fantastic books recommended in this thread: https://github.com/khiner/notebooks https://github.com/khiner/notebooks I wanted to help myself and other folks develop better intuitions around the material, particularly focusing on short animations to develop better visual intuition along with working code examples of the material in the books. Books covered (with a notebook for each chapter): * Musimathics volumes 1 & 2 by Gareth Loy * Introduction to the DFT by Julius Smith * Introduction to Digital Filters by Julius Smith * Physical Audio Signal Processing by Julius Smith also a couple not directly about audio but helpful for the domain: * Coding the Matrix by Philip Klein * Accelerated C++ by Andrew Koenig and Barbara Moo Hope someone gets some value from these - have fun!
- kragen 5y agoI second the recommendation of Steven W. Smith's dspguide.com, which will get you from (I think) zero to a profound understanding of DSP. I've also learned a lot from Julius O. Smith's Physical Audio Signal Processing, which I see a couple of other people have also recommended: https://ccrma.stanford.edu/~jos/pasp/ https://ccrma.stanford.edu/~jos/pasp/ But if you're using an existing computer music programming environment like Csound (used in The Audio Programming Book), SuperCollider, or PureData, you can make a mini-synth which takes input from the computer keyboard without any of that stuff! (Stay away from Max/MSP; it's proprietary.) The most fun I've had with audio programming has been bytebeat, though: http://canonical.org/~kragen/bytebeat http://canonical.org/~kragen/bytebeat. I didn't invent bytebeat but I did write that page about it. Also, there are a lot of the hassles involved in audio latency on CTSS-derived OSes like MacOS, Linux (especially Android), or Microsoft Windows; it's easy to end up with 100+ ms of latency, and hard to do better than 10 ms, and either of those is a super shitty musician experience. If you do your stuff on an Arduino or similar microcontroller instead, those problems evaporate, and your computer music system will fit into an effects pedal. You need a DAC and, if you're taking audio input, an ADC; the built-in PWM and ADC in a standard AVR may not be sufficient. (And, beware, a 31.25 kHz PWM carrier can go right through a stereo system and burn out your venue's tweeters if it's turned up high enough. Filtering is required.)
- xipho 5y agoDo look at SonicPi [0][1]. [0] https://sonic-pi.net/ https://sonic-pi.net/ [1] https://github.com/sonic-pi-net/sonic-pi https://github.com/sonic-pi-net/sonic-pi
- jrm4 5y agoSince we are all here, I have a question. I personally am much more interested in audio sample triggering and/or loop based production in this context than synthesis/wave generation -- and it seems like the overwhelming majority of tools are focused on the latter. In my head, I'm imagining a more programmatic approach to "arrangement of samples and loops," as in, instead of, or perhaps complementing, the classic "grid" or "buttons" view -- something like,e.g.: - Specify 4/4 @ 95bpm for the piece - Sample 1, a drum loop stretched/and or pitched - Sample 2, a hit on the 2nd beat of each interval - Sample 3, a simple electric piano melody, repeating over X intervals. - Sample 4, a pad with an echo/reverb etc. Now, what should be easy to do is to switch out, e.g. which drum loop, or change your piano to a trumpet. I get that MIDI is okay for this -- but is of course better for the latter situation and not great for effects and audio samples. Your Abletons and so forth are not bad at this, of course, but - and maybe this what I'm describing -- Ableton's features -- but doable in vim, perhaps with the ability to create functions et al on the fly, which strikes me as a potentially powerful way to "group" musical sounds/ideas/intervals/melodies/chords/effects etc etc
- smrq 5y agoSounds like you might be more interested in live coding. Overtone [1] can do what I think you are describing, and more--it's a frontend to SuperCollider, which has all the audio synthesis stuff you aren't interested in, but it can trigger samples fine. Of course, if Clojure isn't your thing, there are other live coding tools out there. I'm partial to Orca [2] myself. [1] https://github.com/overtone/overtone https://github.com/overtone/overtone [2] https://github.com/hundredrabbits/Orca https://github.com/hundredrabbits/Orca
- deleted 5y ago[deleted]
- deleted 5y ago[deleted]
- qrv3w 5y agoEchoing a lot of sentiment here, you can do pretty much all of these things with SuperCollider. I'd go straight to SuperCollider rather than a "frontend" like Overtone/SonicPi. Not that these frontends are bad, but SuperCollider also has a nice frontend - the IDE works great with builtin doc searching, autocompletion, etc. Sample wrangling becomes pretty thorny quickly as if you are triggering samples you want to make sure they don't "clip"/"pop" when you change them (due to discontinuities between the abrupt stop and the new start). I wrote a SuperCollider tutorial that demo's how to make a really high-quality sample player that takes care of these kinds of things plus gives you lots of control over rates, looping, etc. [1] That was my main hurdle with SuperCollider as that it has surprisingly few tutorials for such a long-running and deep program. Hopefully that helps :) [1] https://schollz.com/blog/sampler/ https://schollz.com/blog/sampler/
- squarefoot 5y ago> My goal is to make a mini-synth which takes input from the computer keyboard. It might be worth studying the sources of some working soft synths such as Helm, Surge or ZynAddSubFx or mixed firmware-hardware synths such as TSynth. The latter in particular is a low cost polyphonic external module built around a Teensy microcontroller, so the code base isn't that big, and it sounds great. https://tytel.org/helm/ https://tytel.org/helm/ https://surge-synthesizer.github.io/ https://surge-synthesizer.github.io/ https://github.com/zynaddsubfx/zynaddsubfx https://github.com/zynaddsubfx/zynaddsubfx https://github.com/ElectroTechnique/ https://github.com/ElectroTechnique/ https://electrotechnique.cc/ https://electrotechnique.cc/
- anotheryou 5y agoDepends a bit on where you want to go with this. If you want this to play nicely musically you want low latency and I'd look for programming languages made for audio. Just watch a few introductions and pick what you like best. More professionally I'm not experienced, but maybe writing a VST MIDI instrument would make sense. If it's just about the sound maybe you should start at the DAW end and use Bitwigs Grid or Ableton (possibly with max/msp).
- nitrogen 5y agoEdit: My goal is to make a mini-synth which takes input from the computer keyboard. If you are a Ruby programmer on Linux, you could use this rubygem I wrote: https://github.com/mike-bourgeous/mb-sound https://github.com/mike-bourgeous/mb-sound A video about using that gem to make a synthesizer: https://m.youtube.com/watch?v=aS43s6TWnIY&feature=youtu.be https://m.youtube.com/watch?v=aS43s6TWnIY&feature=youtu.be Part of a long-running experiment of mine to make educational videos about sound, which I hope might help you on your audio programming journey: https://www.youtube.com/playlist?list=PLpRqC8LaADXnwve3e8gI239eDNRO3Nhya https://www.youtube.com/playlist?list=PLpRqC8LaADXnwve3e8gI2... There have been recent posts to HN about the difficulty of reading key-up events from the terminal. I used MIDI and a separate MIDI keyboard app for my video demo.
- noxee 5y agoI haven't started the course yet but I've been looking at doing this one: Learn C++ Real-Time Audio Programming with Bela - https://hackaday.io/course/171240-learn-c-real-time-audio-programming-with-bela https://hackaday.io/course/171240-learn-c-real-time-audio-pr.... The course does recommend buying the Bela development board from https://shop.bela.io/ https://shop.bela.io/ but I don't think it's a hard requirement.
- jasunflower 5y agoDoes anybody have a good tutorial on the Fast Fourier Transform? It always feels to be just out of my grasp and I wonder if someone has broken it down in an intuitive way.
- psyc 5y agoYou’re in luck. There was a thread about it 5 days ago. https://news.ycombinator.com/item?id=27229836 https://news.ycombinator.com/item?id=27229836 My favorite was https://youtu.be/spUNpyF58BY https://youtu.be/spUNpyF58BY
- munificent 5y agoI've been getting into this over the past couple of years too and I feel like I sort of hit a wall. I am comfortable writing low level efficient real-time code in C (I'm an ex game dev). I understand most synthesis techniques in pretty good detail. I could probably write a book on subtractive synthesis, and I have implemented a complete functioning FM synth. I get the fundamental concepts around DSP: Nyquist, sampling, Fourier analysis, etc. But when it comes to sitting down and, say, designing and implementing a filter from scratch, I'm pretty well stuck. Part of it is that most of the material I've found either goes straight to heavy calculus (which I can kind of hack but am pretty rusty on) or to MATLAB (which I don't have). Likewise, implementing a simple digital sawtooth or square oscillator analytically is trivial. Sample playback is also a piece of cake. But doing those without aliasing seems to jump from super-easy mode all the way to hardcore nightmare. All of a sudden I'm trying to understand what minBLEPs are and other stuff that feels over my head. Any recommendations on how to get over this hump? Should I get MATLAB?
- Flex247A 5y agoHave you tried GNU Octave? It seems to be a replacement for MATLAB.
- munificent 5y agoI have not, that's a good pointer. Thanks!
- rmnclmnt 5y agoAs an alternative to MATLAB/Octave, may I suggest using Python with Jupyter Notebooks? For exploratory/analysis/prototyping work, I have not found a better platform and ecosystem. These notebooks are really powerful feature-wise, you can mix Markdown notes/documentation with code blocks with data visualization natively, which is a no brainer when doing your research work.
- munificent 5y agoI don't think it's an issue of having some general language for doing math work. My understanding is that MATLAB specifically has a ton of built in functionality for filter design and coefficient calculation.
- rgbrgb 5y agoAnyone have thoughts on JUCE vs SOUL for writing a VST?
- trypwire 5y agoAwesome discussion in here, I'm happy to see it! I thought I might throw my hat in the ring of shameless self promotion since you might be interested: I'm working on a project called Elementary Audio, which is a brand new javascript runtime and framework for writing native audio applications– meaning desktop apps, like perhaps the mini-synth you're hoping to make, as well as audio plugins (VST, AU, AAX, etc) and even embedded hardware, all in JavaScript. The project is still in an early stage (and macOS only right now). I'm planning to share it more widely here on HN once it's ready for beta, but I thought this thread might be interested in it before then. Website: https://www.elementary.audio/ https://www.elementary.audio/ And here's an example MIDI Synth: https://github.com/nick-thompson/elementary/blob/master/examples/03_Synth/index.js https://github.com/nick-thompson/elementary/blob/master/exam... You could even spin up an Electron frontend to take input from your computer keyboard and send those over to Elementary to render the synth sounds. It's actually an example project I was considering doing myself but you might beat me to it at this point! Lastly, I'll say briefly that there are a lot of tools out there (as we're seeing in these comments), different things work for different people, and there's no single "right" way to start audio programming– find the path that makes it fun for you, because it's such an awesome field to get into.
- mxmilkiib 5y agoCome hang in #lad on libera.chat
- 8bitsrule 5y ago"Richard Boulanger" is the C-Sound [0] guy. I mention that because anyone interested in audio programming might want to be familiar with C-sound first. Programming audio in C is way more complex than programming audio in C-sound. Starting from scratch might not be preferable to using a toolkit that's been developed for 35 years! [1] A book I thought was great has no code in it, but is FULL of very useful info about audio and computing it. Computer Music by Dodge and Jerse, ISBN 0028646827 (1997) ... a little pricey, might be hard to find, but very hard to beat. [0] https://csound.com/ https://csound.com/ [1] I haven't seen Richard's book (I'm sure it's great - and I will see it, thanks for the tip) ... he just might be pitching this idea in there!
- iainctduncan 5y agoAnother nice thing about Csound is that if you want to start doing C level dsp in baby steps, extending Csound is very straightforward. MUCH easier than adding objects in Max or PD for example. Max and PD externals require a ton of platform specific boilerplate.
- ChrisArchitect 5y agohow about sharing the link to the book and asking in the comments for more resources instead of Ask HN
- probinso 5y ago"listening in the ocean" by lammers can give you a resource for applications of audio programming. it's all about marine acoustics