Deploying Neural Audio Models into Max/MSP and Pure Data
Learning objectives
- learner can load a TorchScript model as an nn~ object and route audio through its methods
- learner can export RAVE for nn~/VST and control it live via attributes and latent splitting
- learner can reason about circular-buffer latency and waveform-to-waveform pass-through
Capstone — one whole task that evidences the objectives
Build a Max/MSP (or PD) patch that runs your exported RAVE model live: load the .ts via nn~, split encode/decode to manipulate individual latent dimensions in performance, expose model attributes as live controls, and document the circular-buffer size you chose, the latency it adds, and how the forward path behaves as a waveform-to-waveform effect. Also demonstrate the same model as a RAVE VST in a DAW.
Prerequisite modules
This module crosses the gap that stops most people who train a RAVE model: getting it out of Python and onto a stage. The whole task is a performance-ready Max/MSP or Pure Data patch where your own timbre model runs live — the setting is an improvised electronic set where you sing or play into the model and sculpt its output in real time, with the same model doubling as a VST insert in a DAW session. TorchScript is the lingua franca here: understanding why a .ts file needs no Python is what makes the whole deployment story make sense.
The arc starts fully supported. First, install nn~ and load a pre-trained model (see “nn~ is a Max/PureData external that bridges trained neural audio models”) and get sound through the default forward path (“The forward method runs a neural model as an audio effect”) — a waveform-to-waveform pipe, audio in and audio out of the same length. Then swap in your own exported model, and open the hood: replace forward with separate encode/decode so the latent dimensions appear as signal outlets you can slider, LFO, and cross-fade (“Splitting RAVE encode and decode in nn~”). Add attribute messages for live control, then make a deliberate engineering choice — buffer size versus latency — which you must document in the capstone.
Every required atom gates that patch: methods, attributes, the circular buffer, waveform-to-waveform pass-through, and the VST workflow are each exercised directly. Supporting atoms widen the picture — the in_ratio/out_ratio contract that explains why latents run slower than audio, hot-swapping models mid-set with void mode, pre-trained model packs, offline batch generation, and ONNX as an alternative export — useful, but the capstone stands without them.
Runnable examples
Generated from the context/ instrument corpus by concept (redistributable idioms only). Do not edit — regenerate with gen-module-examples.mjs.
live-hot-swap
live_loop :x do; play 60; sleep 1; end
sonicpi-0048 · CC0
Ndef(\a, { SinOsc.ar(220) * 0.1 }).play
supercollider-0037 · CC0
Atoms in this module
Required — these gate the capstone
Supporting — enrichment, not gating
Part of curricula
- Generative & AI AV Artist — real-time machine-driven performance — Deploy neural audio into a live rig required
Unlocks — modules that require this one