Urgent.News

What's breaking now, across thousands of outlets.

Tech

writing audio dsp without juce: notes from infinite

juce is the de facto standard for audio software development, but it brings substantial architectural gravity: a massive monolithic codebase, custom string classes, complex licensing, and heavy abstractions. when building infinite , an open-source modular workstation, we chose to write the entire pull-based audio engine in modern standard c++ (c++20) from scratch. here is what we learned and how…

Developing audio software often means adhering to the widely-used juce framework, which can be complex with a large, monolithic codebase. However, Infinite, an open-source modular workstation, decided to craft its pull-based audio engine entirely in modern standard C++ (C++20) from scratch. This decision provided valuable insights into the architecture design.

One key principle is to avoid any memory allocations on the audio thread. At a 48kHz sample rate with a 128-sample buffer, the deadline is tight - two point six six milliseconds to process audio before the digital-to-analog converter (DAC) overflows and produces an audible click. To ensure strict real-time safety, all audio buffers, voice allocations, and delay memory are pre-allocated during the prepareToPlay() function. There are no malloc or free operations during audio processing.

Another crucial aspect is minimizing cross-thread communication. The UI thread and audio thread interact via atomic pointers, lock-free single-producer single-consumer (SPSC) ring buffers, and double-buffered modulation arrays - all without the need for mutexes. This design ensures smooth, cache-line aligned processing where audio frames are laid out contiguously in memory, allowing SIMD instructions to vectorize filter stages without cache stalls.

Infinite also hosts native AU and VST3 plugins directly. It loads the VST3 component bundle, queries IComponent and IAudioProcessor interfaces, maps parameters to continuous modulation arrays, and schedules sample-accurate note events. For AU, it interacts directly with CoreAudio's audio unit v2 and v3 C-API on MacOS. Parameters in third-party plugins can be modulated in real-time by any signal on the canvas, whether it's an audio LFO, envelope follower, or a generative JavaScript sketch.

For users wishing to craft custom filters or physical modeling synths, Infinite introduced Field - an embedded DSP language. A 1-pole filter in Field consists of just four lines: a parameter float cutoff ranging from 0.25 to 0.99, a state float z initialized at 0, an update statement where z is incremented by (in - z) multiplied by cutoff, and an output statement setting out to z.

The compiler translates this into optimized vector loops evaluated per-sample on the audio thread, enabling powerful custom DSP without a recompilation step.

Infinite is available for free and open-source use. To try it out, visit https://infinitedevices.org. The codebase can be found at https://github.com/n1m21n/infinite.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Announcing the Theory of Computation (TOC) Master Track on Binary Dose

🚀 CoreDose Launch: Theory of Computation (TOC) Master Track "Our goal is to provide the absolute best learning experience to our students so they grasp mental models in under 3 seconds." We are…

  • Theory of Computation Master Track launched on Binary Dose
  • 10 modules covering Finite Automata, Grammars, and Computability
  • Interactive State Transition Diagrams and Zero Paywalls

More from Saturday 24 October →