feat(samples): drop a pack in, keep playing — the rig picks it up in a minute
PLN, mid-compose: "can we build a parvagues samples watcher tool. watches every
min the samples folder. on new found, loads in current service running sc the
sample pack?"
Three pieces, and the interesting part is what each one REFUSES to do.
sample_watch.scd — an OSC responder (/pv/ping, /pv/loadBank) so a new bank can
be registered into the RUNNING rig. Sourced from start_and_midi.scd, and safe
to evaluate standalone mid-session since OSCdef replaces its own key. Loading
is cheap because lazy mode reads WAV headers only.
tools/pvbanks.py — ONE definition of "what banks exist", mirroring the boot's
three loaders. A watcher and a checker that disagreed about what a bank is
would be the worst bug available here: the checker says clean, the watcher
loads something else, and the rig plays a sound nobody chose.
tools/sample-watcher.py — the loop, plus a systemd --user unit that is
deliberately NOT PartOf the SuperCollider unit, because a supervisor coupled
to its supervisee launders its own restart limit.
WHAT IT REFUSES
Shadowing. `~dirt.loadSoundFiles` cannot append even if you ask it to —
SuperDirt.sc:132 passes `appendToExisting = false` as an ASSIGNMENT rather than
forwarding the argument, so every load replaces. A pack shipping a folder
called `kick` would therefore free the existing bank's buffers and take the
name, changing what an old track plays with no error anywhere. Any new name
claimed by two folders is reported and SKIPPED for a human.
Claiming success at a silent rig. It pings first, and a load that gets no
reply is NOT written to the state file, so the next pass retries instead of
believing itself. Verified against a mock rig: no-reply pass loads 0 and marks
nothing known.
TWO BUGS CAUGHT BEFORE THEY SHIPPED
PathName.folderName returns the PARENT for a directory path — it is built for
file paths. The responder would have looked up the wrong bank and reported a
wrong file count on every success. It now diffs soundLibrary.buffers.keys
before and after, so whatever key APPEARS is the bank name by construction,
and no assumption about basename-with-trailing-separator is needed.
My own protocol test wrote to the real state file, which then made --dry-run
report all 1425 banks as new. Fixed the test isolation and, separately, made
the baseline branch honour --dry-run instead of saving.
Also verified against the real tree: 1425 banks, 19396 playable files, zero
shadowed names. File counts follow SuperDirt's pathMatch("*"), which skips
dotfiles — the AppleDouble `._X.wav` trap that once made a folder look clean
to `ls` while a naive glob double-counted it.
NOT YET VERIFIED: the .scd against a live SuperDirt. PLN is composing and the
responder needs one eval in his session; the Python half is proven end to end
against a mock.
Showing
sample_watch.scd
0 → 100644
tools/bank-check.py
0 → 100644
tools/parvagues-samples.service
0 → 100644
tools/pvbanks.py
0 → 100644
tools/sample-watcher.py
0 → 100644
Please
register
or
sign in
to comment