juce-audio-thread-handoff
Skill0 starsChanged 23 days agoMITView on GitHub
Use when a JUCE plugin must record, play back edited audio or share big data with the audio thread without allocating or locking: FIFO to a worker, published snapshots, state flags.
In this repository69 other files it gives its agents.
- ableton-liveSkill
- ableton-push-expertSkill
- ardourSkill
- arduino-electronics-solderingSkill
- audacitySkill
- audio-driver-stacksSkill
- audio-interface-digital-ioSkill
- av-receiver-specialistSkill
- bazzite-kde-linuxSkill
- bitwig-studioSkill
- color-palette-expertSkill
- couch-pc-cec-gaming-modeSkill
- cubaseSkill
- daw-hubSkill
- denon-prime-sc5000-x1800Skill
- design-software-guideSkill
- dj-gig-guideSkill
- dj-specialistSkill
- drawing-tabletsSkill
- dsp-references-and-licencesSkill
- electronic-music-producerSkill
- fl-studioSkill
- fx-plugin-designSkill
- gha-supply-chain-hardeningSkill
- github-for-beginnersSkill
- github-repo-lockdownSkill
- grapheneosSkill
- graphic-design-expertSkill
- hard-dance-productionSkill
- hardstyle-sound-design-notesSkill
- hardware-protocol-captureSkill
- home-network-specialistSkill
- js-to-cpp-dsp-portSkill
- juce-expertSkill
- juce-headless-test-snapshotSkill
- knulli-handhelds-m8Skill
- korg-logue-sdk-expertSkill
- linux-audio-productionSkill
- linux-expertSkill
- linux-security-hardeningSkill
- linux-terminal-expertSkill
- logic-proSkill
- loudness-and-lowend-deliverySkill
- man-page-expertSkill
- max-for-live-expertSkill
- mockup-is-the-pluginSkill
- mockup-to-juce-layoutSkill
- nextcloud-specialistSkill
- photo-editing-color-gradingSkill
- pihole-raspberry-piSkill
- plugin-dsp-qualitySkill
- plugin-fleet-auditSkill
- plugin-performance-profilingSkill
- plugin-security-fuzzingSkill
- plugin-ship-checklistSkill
- pro-toolsSkill
- reaperSkill
- rog-ally-x-bazziteSkill
- sound-engineer-acousticsSkill
- sound-forgeSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Stop = drain once more under the mutex, then take the result.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Audio thread handoff patterns that held up
Companion to juce-expert and vst-maker section 2. Labels: MEASURED (a recorder and sample editor plugin with a headless test), VERIFIED (Bencina's realtime audio programming rules), UNVERIFIED.
Rule
The audio thread never allocates, frees, locks a mutex another thread can hold, or does file I/O. Talk to it with lock-free FIFOs and atomics. VERIFIED (rossbencina.com).
Pattern 1: record without allocating
juce::AbstractFifowith two preallocated float vectors.processBlockcopies the input in (drop on overflow) and returns.- A worker
juce::Threaddrains it into an engine that is allowed to allocate (push_backgrowth). Message thread commands (arm, stop) take a shortstd::mutexshared only with the worker, never with the audio thread. - Stop = drain once more under the mutex, then take the result.
Pattern 2: play edited audio
- The editor owns the editable sound. After every change it publishes an immutable
shared_ptr<const Audio>into a slot guarded byjuce::SpinLock. The audio thread takes the lock withScopedTryLock; on failure it plays nothing this block. - The audio thread copies the shared_ptr to a local and releases it at the end of the block. To make sure that release never frees memory on the audio thread, the message thread keeps the last four published snapshots alive in a deque.
- Playback position, range and flags are atomics. Interpolate (linear is enough) when the file rate differs from the host rate.
- Preview = publish a processed COPY into the same slot and play it; restoring means publishing the real sound again.
Pattern 3: metering and the count-in
- Peaks go out through
std::atomic<float>with a per block decay. A ring of atomics (512 entries) feeds a live strip. - A count-in is generated in
processBlockfrom atomics (position, beat length, total): a short decaying sine per beat, added after the monitor mute so it stays audible. When it ends, the audio thread sets a flag and the worker arms the recorder.
Checks
ScopedNoDenormalsat the top ofprocessBlock; a helper thread that does DSP needs its own.- Report latency honestly; parameters through APVTS with stable IDs.
- Known limits: the snapshot copies the whole sound on every edit, so minutes of audio edit slowly. Say so in the ROADMAP.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

