js-to-cpp-dsp-port
Skill0 starsChanged 23 days agoMITView on GitHub
Use when DSP written in JavaScript (a mockup engine) must be ported to C++ with the same results: function by function, same test cases, rounding and FFT conventions, STFT, phase vocoder, undo steps.
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
- juce-audio-thread-handoffSkill
- 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
2 rules. About 0 are common, 1 is distinctive, and 1 is 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.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Run the JS tests too, so both sides stay in step.
- Very specific: line 20
Use a double precision pi.
≈ “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
Porting a JavaScript DSP engine to C++ with identical behaviour
Labels: MEASURED (ported spectral editing, phase vocoder stretch, formant preserving pitch shift, warp, YIN note detection and tempo detection; 662 checks pass), UNVERIFIED.
Method
- Port ONE function at a time, in a header only file with no JUCE (
MeowDsp.hstyle), in the same order as the JS file. Keep the constants and the comments. - Port the JS test file to C++ as checks, with the same inputs and tolerances. A port is done when the same cases pass, not when it compiles. Add a second layer: the plugin's editor calls the engine through one undo step (
ed.transform("Label", fn)). - Run the JS tests too, so both sides stay in step. Keep the JS as the reference for the mockup.
Conventions that bite
Math.round(x)rounds halves UP: usefloor(x + 0.5), notstd::round(which rounds away from zero for negatives).- JS typed arrays are zero filled and
Float32Arrayrounds on store: keep intermediates indouble, storefloatat the same places. - Inverse FFT by conjugation:
conj(fft(conj(x))) / n. Overlap add with a Hann window at 75 percent overlap divides by 1.5. - Pitch tracks use NaN for "no pitch": test with
isnan, never==. Guard every neighbour index in smoothing windows. - Use a double precision pi. A float
kPialready existed in the core and gave small errors in sinc kernels. - Phase vocoder with peak locking: keep the previous analysis phase and the synthesis phase per bin, assign every bin to its nearest peak, and note the analysis hop is
st - prevSt(an integer). Time stretch then resample gives pitch shift; formant keeping needs a spectral envelope pass. - Randomness (grain texture mode) cannot match the JS generator: test length and level only.
Results that need no reference
- Resample 48k to 44.1k keeps pitch within 1.5 Hz and RMS within 0.01. Stretch by 1.5 gives exactly 1.5 times the frames with the pitch within 3 Hz. Note detection finds 220 Hz as MIDI 57 within 0.1. MEASURED.
- Spectral cut of a box removes the tone inside it by more than 50 dB and leaves tones outside it within 0.2 dB. MEASURED.
UI notes
- Long jobs (stretch of minutes of audio) block the message thread: say so in the panel, or move them to a thread before shipping.
- Preview = run the process on a copy and play that copy; never touch the real sound until Apply.
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.

