Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
T
Tidal
  • Overview
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • PLN
  • Tidal
  • Repository

Switch branch/tag
  • Tidal
  • sample_watch.scd
Find file
BlameHistoryPermalink
  • PLN (Algolia)'s avatar
    feat(samples): drop a pack in, keep playing — the rig picks it up in a minute · 446d7a44
    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.
    PLN (Algolia) authored Aug 14, 2026
    446d7a44
sample_watch.scd 3.82 KB
EditWeb IDE
×

Replace sample_watch.scd

Attach a file by drag & drop or click to upload


Cancel
A new branch will be created in your fork and a new merge request will be started.