Use & author libs/codes helpers
The libs/codes/ system lets you factor reusable JS helpers out of clips and load them globally into the coding Note Effect runtime. Helpers can be app-wide (shared across every project) or project-scoped (saved next to a project file).
App libs vs. Project libs
Section titled “App libs vs. Project libs”| Type | Path | Scope |
|---|---|---|
| App libs/codes | {appData}/libs/codes/ | All projects on this machine |
| Project libs/codes | libs/codes/ next to the project file | This project only |
| Factory libs | Bundled with the app (read-only) | All projects, all machines |
The Project libs folder itself is not created until you press the Create button in the file browser.
Enable a lib
Section titled “Enable a lib”In the file browser, each .js file has a checkbox on its left.
- ON — added to this project’s
loadedLibs. The file’s source is prepended to your user code when the coding Note Effect runs. - OFF — removed from
loadedLibs(the file itself stays).
After turning a lib ON, any clip code can call its functions directly — no import is needed.
How to author
Section titled “How to author”Use export function (or plain function declarations) and the helpers become callable from clip code.
export function houseKick(b, len = 0.25, vel = 100) { noteOn(36, len, vel, b);}
export function arpUp(rootPitch, lenBeats, step = 0.25) { for (let b = 0; b < lenBeats; b += step) { setNote({ pitch: rootPitch + ((b / step) % 8), startBeat: b, lengthBeats: step, }); }}In a clip:
onBeat((b) => { houseKick(b);});ESM syntax is stripped
Section titled “ESM syntax is stripped”The runtime executes user code with new Function(...), which does not support ESM. The host stripModuleSyntax() removes export / import keywords before injecting the lib. So:
export function add()-> the function exists in the script’s global scopeimport x from "..."-> stripped and effectively a no-op
You cannot import from URLs or other modules. Keep helpers self-contained, or use the host API.
Editing UI
Section titled “Editing UI”- Open a
.jsfile by clicking it -> editor modal opens Cmd/Ctrl + Sto saveEscto close (asks for confirmation if there are unsaved changes)- Factory libs are read-only
Re-rendering after a save
Section titled “Re-rendering after a save”Saving a lib refreshes the file browser, but clips that are already open are not re-rendered automatically. The clip’s render dependencies are clip.code and loadedLibs, not the lib source.
To pick up the change:
- Edit the clip’s Code by one character (re-render trigger), or
- Toggle the lib OFF then ON in the file browser
This is documented further in Troubleshooting.
Caching
Section titled “Caching”Lib sources are cached by path + mtime + size. The cache is invalidated automatically when a file changes on disk.
Related
Section titled “Related”- Coding Note Effect overview — how the script context works
- File browser — UI for libs/codes
- Host API reference — globals available in clip code