diff --git a/docs/video2raea-sound.feature b/docs/video2raea-sound.feature new file mode 100644 index 00000000..58c31cf6 --- /dev/null +++ b/docs/video2raea-sound.feature @@ -0,0 +1,137 @@ +@spec +Feature: video2raea sound: a film's soundtrack split into dialogue, music and effects, and each layer written as code + Goal, 2026-11-17: "have our own version of reverse engineer anything video skill or threejs one we were playing + with too that bring it to raea and then just take the audio layers demuxed and separated and then map them to the + code." + + img2raea (docs/img2raea.feature) turns a picture into raea objects. This is the same for a video's sound: the mix + is split into the stems films are mixed from (dialogue, music, effects), and each stem becomes the raea code that + would make it: dialogue as lines from the transcript, music as a beat map and a cue composed to it + (`raea song`, sdk/guides/craft/motion/music.md), effects as one placed call per sound (its frame, the take or + prompt that makes it, its gain) and, through the foley adapter, the control curves that keep a new sound on the + old one's timing. + + The test set is our own films, so every answer is known: tools/foley.ts-style mixes log each placement, and + `raea render --manifest` lists every sound a render played (element, time, gain, model and prompt). + + Rule: our own films are the answer key + + @wip + Scenario: VS1. The goose film as the first answer key + Given projects/swamp-goose's mix (the song and 205 effect placements from 32 takes, tools/foley.ts) levelled to + -14 LUFS under a limiter (tools/mix.sh) + And the effects-only stem from the same code (STEM=foley), and a key that logs each take's first sample and + whether it was placed by its peak (173 of the 205 are, so the logged time is not the take's start) + When the mix is separated, its effects stem's onsets found (the foley lab's meter) and each matched within 30 ms + to the onsets the code predicts (every placed take's own onsets inside the span it plays) + Then measured on 11-17 (lab: ~/.cache/raea-foley/lab/goose, bin/sep_score.py and bin/eventmap.py): + | stem | effects SI-SDR | events found | loud events found | onsets the code explains | take named (top 1) | + | the true effects stem | - | 72% | 77% | 89% | 57% | + | MRX, adapted-loudness | -5.1 dB | 61% | 65% | 59% | 17% | + | MRX, default | -5.1 dB | 43% | 55% | 61% | 24% | + | the mix, unseparated | -12.7 dB | 27% | 28% | 56% | 4% | + And always naming the commonest take (a footstep, 82 of the 205) scores 29-47% on the same matches, so naming + from a separated stem is below that baseline: separation finds the events, the log-mel matcher can't yet say + which take each one is through the music that leaks into the stem + And the mix sits 87 samples (2 ms) behind its stems: the limiter's lookahead, removed before scoring + + Rule: separation + + @needs + Scenario: VS2. A separator that runs on the Mac and keeps its licence + Given the candidates read on 11-17: MRX (MERL, MIT, weights in the repo; 90 s in 5 s on the CPU), DBS-TIGER + (Apache-2.0; one 3 s chunk ran past 3 minutes on the CPU, its window code fails on MPS), TIGER-DnR (Apache-2.0, + an 8-bit ONNX of 7 MB exists), MVSEP's Demucs4 for CDX23 (MIT code; the weights' terms to read), BandIt + (CC BY-NC weights: never), SAM-Audio (Meta's SAM License: not on the permissive list) + And every DnR-trained model's training data mixes LibriSpeech, FMA and FSD50K, whose clips carry their own + licences: noted beside the model, as ml-tracks.feature notes HTDemucs's MUSDB + When each is run on VS1's mix + Then the one kept beats MRX's effects SI-SDR and events found on VS1, and runs 90 s of audio in under 90 s on a + 16 GB Mac + + Rule: effects as code + + @needs + Scenario: VS3. Naming a sound through the leak + Given VS1's separated effects stem + When each onset is named from the film's own takes (or, on a reference with no takes, given a prompt) + Then the take is right more often than always naming the commonest take, scored on VS1's matches + And candidates are tried cheapest first: the log-mel matcher with the music stem subtracted from the segment, + CLAP or YAMNet embeddings (FP2f already loads both), then a text-queried separator run per candidate take + + @needs + Scenario: VS4. A reference re-sounded on its own timing + Given a separated effects stem + When its loudness, onset and centroid curves drive the foley adapter (out/train_v2, the scene gate's G1-G4) with + a prompt of the person's choosing + Then the new effects pass G1 and G4 against the stem's own onsets, and the code written is one foley() call per + span with the curves' digest, not a pasted clip + + Rule: licences + + @spec + Scenario: VS5. Timing only from someone else's film + Given a reference the person doesn't own + Then only its timing and curves are kept: every sound in the code is generated or comes from a permissive pack, + and nothing from the reference's audio trains a model (training stays on CC0, our own sounds and SAO's + outputs, docs/sound.feature SN2) + + Rule: open footage, read from the picture + + @wip + Scenario: VS6. Human interaction: Greatest Hits re-sounded as raea code + Given Greatest Hits (Owens et al. 2016, CC BY 4.0, credited): videos of a hand hitting and scratching materials + with a drumstick, their recorded sound, and human labels for each action's time, material and hit or scratch; + single recordings read out of the 20 GB zip by HTTP range (remotezip), five on 11-17 (metal, cloth, plastic, + ceramic, glass, wood; 149 labelled hits) + When hits are read from the picture (the stick's motion reversing: optical flow on the fastest 1% of pixels; + MediaPipe's hand landmarker alongside, which sees a hand in 13-61% of frames as it leaves the frame's edge), + from the sound (onsets), and from both (an onset kept where the picture shows an impact within 67 ms) + Then measured on 11-17 against the labels (lab bin/gh_hits.py, gh_fuse.py): + | read from | labelled hits found | of what it finds, real actions | time error | + | the sound | 100% | 6-27% (hits only) | 9 ms | + | the picture | 61-90% | 11-23% (hits only) | 20-34 ms | + | both | 72% | 63% (all actions) | 9-18 ms | + And one clip (2015-09-12-04-15-35-1, 84 s) written as raea code (gh_recreate.py: 79 hits, each an