Finally got around to writing down some audio programming tips for the musically inclined trying to learn, based on my own personal experiences and struggles learning how to do it myself:


> Code is a terrible way to learn DSP

yeh this has given me problems with code in general. optimized code is difficult to glean much out of. especially since its extremely non-obvious how they got from "i need a low pass gate" to "so here's this SIMD operation with a 4-variable biquad approximation"
@paul i've wondered if a notebook interface would be a better way to deal with high performance code. the theory here is that optimizers run on passes but they tend to use a fixed set and you have to play footsies to see when GCC does or doesn't make your shit work better. so instead, start with writing in a DSL and then show (in the notebook) running each optimization step and the result, kind of like those compiler explorers, except the notebook stays around as the actual source file.

when i poked around with Nile (a reasonably complete canvas library in <1,000 SLOC) that was close to they did; they just wrote stream processing kernels and a mini-compiler turned it in to C/JS with all the boilerplate crammed on.
> zig

eh not a fan of zig. lack of operator overloads is pants.

i do enjoy nim, which compiles to c, largely in part because its very pliant and straightforward. you can easily do something like `type CV* = distinct float` and now you have what is basically a float and does all the float things but the compiler will :blobcatpolice: if you try to accidentally put the control voltage in something else without coercing it.

@icedquinn I don't really miss operator overloads for audio programming. I do for graphics though.

From what I can tell, Nim seems suitable for realtime, sometimes. Maybe things have changed, but don't you have to pass some extra options to get it to work?

@paul -gc:arc if you don't have cyclic references, -gc:orc if you do, replaces the GC with reference counters.
@paul there is newruntime which is supposed to have introduced uniqueptr semantics. araq wanted to migrate over to it but they chose to stabilize 1.0 before messing around with deep runtime shit again
Sign in to participate in the conversation

Welcome to, an instance for discussions around cultural freedom, experimental, new media art, net and computational culture, and things like that.