Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
FP11c: done. A box drawn on the sound's spectrogram is a note's mark: learn-notes labels its span and keeps its pitch band in the evidence row
shinyobjectz06090e06cd1a
diff --git a/apps/fingerprint/src/approve.rs b/apps/fingerprint/src/approve.rsindex 27103ffa..6549a5fd 100644--- a/apps/fingerprint/src/approve.rs+++ b/apps/fingerprint/src/approve.rs@@ -65,6 +65,7 @@ pub(crate) fn approve(enc: &mut Encoders, dir: &Folder, fp: &Fingerprint, args:words: None,at: 0,pin: None,+ band: None,};l.push(row, &features(&c, *a, *b));}diff --git a/apps/fingerprint/src/bootstrap.rs b/apps/fingerprint/src/bootstrap.rsindex a93965a7..a40ca13c 100644--- a/apps/fingerprint/src/bootstrap.rs+++ b/apps/fingerprint/src/bootstrap.rs@@ -156,6 +156,7 @@ pub fn rows(enc: &mut Encoders, who: &str, files: &[PathBuf], per: usize, l: &muwords: None,at: 0,pin: None,+ band: None,};l.push(r, &features(c, 0.0, WIN));};diff --git a/apps/fingerprint/src/moving.rs b/apps/fingerprint/src/moving.rsindex a25cbd09..0e003990 100644--- a/apps/fingerprint/src/moving.rs+++ b/apps/fingerprint/src/moving.rs@@ -65,7 +65,7 @@ mod tests {use super::*;fn row(axis: &str, source: &str) -> Row {- Row { media: "m".into(), a: 0.0, b: 2.0, axis: axis.into(), bad: true, weight: 1.0, who: "me".into(), source: source.into(), project: "p".into(), kind: None, region: None, words: None, at: 0, pin: None }+ Row { media: "m".into(), a: 0.0, b: 2.0, axis: axis.into(), bad: true, weight: 1.0, who: "me".into(), source: source.into(), project: "p".into(), kind: None, region: None, words: None, at: 0, pin: None, band: None }}#[test]diff --git a/apps/fingerprint/src/notes.rs b/apps/fingerprint/src/notes.rsindex 6793b63b..6899c926 100644--- a/apps/fingerprint/src/notes.rs+++ b/apps/fingerprint/src/notes.rs@@ -48,6 +48,9 @@ pub struct Reading {/// the layers under the pin's x,y in the layer pass, on a render with one (FP5a)#[serde(default, skip_serializing_if = "Vec::is_empty")]pub layers: Vec<String>,+ /// a box on the sound's spectrogram: its pitch band, 0-1 of the mel scale (FP11c); its time is t..to+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub band: Option<[f32; 2]>,}@@ -88,7 +91,7 @@ pub fn pinned(project: &Path) -> Vec<Reading> {let to = n["pin"]["to"].as_f64().filter(|&to| to > t);let at = n["pin"]["x"].as_f64().zip(n["pin"]["y"].as_f64()).map(|(x, y)| [x - 0.01, y - 0.01, x + 0.01, y + 0.01].map(|v| v.clamp(0.0, 1.0)));let layers = at.map(|b| raea_sys_fingerprint_things::located::layers(&video, t, b)).unwrap_or_default();- out.push(Reading { note: n["id"].as_str().unwrap_or("").into(), text: text.into(), who: n["author"]["name"].as_str().unwrap_or("me").into(), media: video.clone(), t, project: name.clone(), to, region: raea_sys_fingerprint_use::grow::marked(&n["pin"]), layers, ..Default::default() });+ out.push(Reading { note: n["id"].as_str().unwrap_or("").into(), text: text.into(), who: n["author"]["name"].as_str().unwrap_or("me").into(), media: video.clone(), t, project: name.clone(), to, region: raea_sys_fingerprint_use::grow::marked(&n["pin"]), layers, band: raea_sys_fingerprint_use::grow::sound_band(&n["pin"]), ..Default::default() });}}out@@ -296,8 +299,9 @@ pub(crate) fn learn(enc: &mut raea_sys_columns::Encoders, dir: &Folder, l: &mut(None, true) => continue,};let c = enc.columns(&x.media)?;- // a span is the label's time; a moment, 1.5 s before the pin to 0.5 s after (FP11b)- let (a, b) = x.to.map_or(((x.t - 1.5).max(0.0), (x.t + 0.5).min(c.dur)), |to| (x.t.max(0.0), to.min(c.dur)));+ // a span is the label's time (a scene's, a box's on the sound: FP11c), half a second at least; a moment, 1.5 s+ // before the pin to 0.5 s after (FP11b)+ let (a, b) = x.to.map_or(((x.t - 1.5).max(0.0), (x.t + 0.5).min(c.dur)), |to| span(x.t, to, c.dur));if b - a < 0.5 {continue;}@@ -307,7 +311,9 @@ pub(crate) fn learn(enc: &mut raea_sys_columns::Encoders, dir: &Folder, l: &mutlet shot = seed.and_then(|s| raea_sys_fingerprint_use::grow::through(&x.media, x.t, c.dur, s, 2.0).ok().flatten()).filter(|w| !w.is_empty());for (a, b, region) in shot.map_or_else(|| vec![(a, b, seed)], |w| w.into_iter().map(|(a, b, r)| (a, b, Some(r))).collect()) {let (media, axis, who, project, kind, words) = (c.media.clone(), axis.clone(), x.who.clone(), x.project.clone(), Some(x.note.clone()), Some(x.text.clone()));- let row = raea_sys_fingerprint::evidence::Row { media, a, b, axis, bad, weight: 1.0, who, source: "note".into(), project, kind, region, words, at: 0, pin: None };+ // a defect's box on the sound keeps its pitch band (FP11c)+ let band = x.band.filter(|_| bad);+ let row = raea_sys_fingerprint::evidence::Row { media, a, b, axis, bad, weight: 1.0, who, source: "note".into(), project, kind, region, words, at: 0, pin: None, band };l.push(row, &raea_sys_fingerprint::evidence::features(&c, a, b));}made += 1;@@ -315,6 +321,17 @@ pub(crate) fn learn(enc: &mut raea_sys_columns::Encoders, dir: &Folder, l: &mutOk(format!("{made} notes are evidence now (defects and praise; directions stay with the brief)\n"))}+/// A span pin's label: t..to inside the piece, widened about its middle to half a second when it's shorter (a box on a+/// click of sound)+fn span(t: f64, to: f64, dur: f64) -> (f64, f64) {+ let (a, b) = (t.max(0.0), to.min(dur));+ if b - a >= 0.5 {+ return (a, b);+ }+ let mid = ((a + b) / 2.0).clamp(0.25, (dur - 0.25).max(0.25));+ ((mid - 0.25).max(0.0), (mid + 0.25).min(dur))+}+#[cfg(test)]mod tests {use super::*;@@ -333,6 +350,27 @@ mod tests {assert!(prompt(&fp, &n).contains("n1: ") && prompt(&fp, &n).contains("(pinned on Floor)"), "the reader is told the layer");}+ #[test]+ fn a_box_on_the_sound_is_a_reading_s_span_and_band_not_a_region() {+ let dir = std::env::temp_dir().join(format!("fp11c-{}", std::process::id()));+ std::fs::create_dir_all(dir.join(".raea/feed")).unwrap();+ std::fs::write(dir.join("a.mp4"), b"").unwrap();+ let note = json!({"id": "n1", "text": "that hiss", "author": {"kind": "person", "name": "me"}, "pin": {"kind": "time", "t": 2.0, "to": 4.0, "marks": [{"kind": "box", "on": "sound", "points": [[0.2, 0.9], [0.4, 0.6]]}]}});+ std::fs::write(dir.join(".raea/feed/p.json"), json!({"media": [{"kind": "video", "path": "a.mp4"}], "notes": [note]}).to_string()).unwrap();+ let r = pinned(&dir);+ std::fs::remove_dir_all(&dir).ok();+ assert_eq!(r.len(), 1);+ assert_eq!((r[0].t, r[0].to, r[0].band, r[0].region), (2.0, Some(4.0), Some([0.6, 0.9]), None));+ }++ #[test]+ fn a_span_is_the_label_and_a_short_one_is_widened() {+ assert_eq!(span(2.0, 4.0, 10.0), (2.0, 4.0));+ let (a, b) = span(2.0, 2.1, 10.0);+ assert!((a - 1.8).abs() < 1e-9 && (b - 2.3).abs() < 1e-9, "a box on a click of sound is half a second about it: {a}..{b}");+ assert_eq!(span(9.9, 10.0, 10.0), (9.5, 10.0), "kept inside the piece");+ }+#[test]fn notes_train_only_once_the_person_agrees_enough() {let r = |k: bool, a: bool| Reading { kind_ok: Some(k), axis_ok: Some(a), ..Default::default() };diff --git a/apps/fingerprint/src/pairing.rs b/apps/fingerprint/src/pairing.rsindex 7707e878..edf67021 100644--- a/apps/fingerprint/src/pairing.rs+++ b/apps/fingerprint/src/pairing.rs@@ -14,7 +14,7 @@ use raea_sys_fingerprint::pairs::difference;use std::path::Path;fn row(media: &str, a: f64, b: f64, axis: &str, weight: f32, who: &str, project: String, words: Option<String>) -> Row {- Row { media: media.into(), a, b, axis: axis.into(), bad: true, weight, who: who.into(), source: "pair".into(), project, kind: None, region: None, words, at: 0, pin: None }+ Row { media: media.into(), a, b, axis: axis.into(), bad: true, weight, who: who.into(), source: "pair".into(), project, kind: None, region: None, words, at: 0, pin: None, band: None }}diff --git a/apps/fingerprint/src/postmortem.rs b/apps/fingerprint/src/postmortem.rsindex 5b204e4e..9e16d0ba 100644--- a/apps/fingerprint/src/postmortem.rs+++ b/apps/fingerprint/src/postmortem.rs@@ -30,7 +30,7 @@ pub(crate) fn run(enc: &mut Encoders, args: &[String], cwd: &Path, eval: Eval) -continue;}let who = fp.who.clone().unwrap_or_else(|| "me".into());- let row = Row { media: c.media.clone(), a, b, axis: x.axis.clone(), bad: *yes, weight: 1.0, who, source: "postmortem".into(), project: name.clone(), kind: None, region: None, words: Some(x.words.clone()), at: 0, pin: None };+ let row = Row { media: c.media.clone(), a, b, axis: x.axis.clone(), bad: *yes, weight: 1.0, who, source: "postmortem".into(), project: name.clone(), kind: None, region: None, words: Some(x.words.clone()), at: 0, pin: None, band: None };l.push(row, &features(&c, a, b));}dir.write_ledger(&l)?;diff --git a/apps/fingerprint/src/verbs.rs b/apps/fingerprint/src/verbs.rsindex 1aa48bc7..c80ba25b 100644--- a/apps/fingerprint/src/verbs.rs+++ b/apps/fingerprint/src/verbs.rs@@ -252,6 +252,7 @@ fn teach(enc: &mut Encoders, args: &[String], cwd: &Path, eval: Eval) -> Result<words: flag(args, "--words").map(str::to_string),at: 0,pin: None,+ band: None,};let mut l = dir.ledger()?;l.push(row, &features(&c, a, b));diff --git a/docs/fingerprint.feature b/docs/fingerprint.featureindex cd052838..89a0f252 100644--- a/docs/fingerprint.feature+++ b/docs/fingerprint.feature@@ -596,14 +596,22 @@ Feature: Fingerprint: a person's or a team's sense of good work, learned on theifollowed it left across the frame, a looser box (overlap 0.41). A blind seed in the middle of an app renderkept only the note's frame, so only its own window- @needs:FP11b+ @needs:FP11b @doneScenario: FP11c. Marks on the soundGiven the review player shows a sound's spectrogram under its picture (or in its place, for sound alone)Then a box drawn on it is a note's mark there, kept in 0-1 of the span shown (time) and of the frequencies (mel)And on a defect note on a sound axis, `learn-notes` makes its time the label's span and keeps its band in the row- And decided 11-12: not in 0.1.2. The player draws no spectrogram, and raea-feed is fixed at what 0.1.2 ships.- Until then a sound note's span (FP11a) is its time label, and the sound heads are per window, so a band- would be kept but not yet learned from+ And decided 11-12: not in 0.1.2; built 11-13 for 0.1.3 (raea-feed #9). The host draws a mel+ spectrogram (host/spectrum.ts: 22.05 kHz, 64 bands to 11.025 kHz, a column every 25 ms, the loudest 80 dB),+ the timeline's sound track offers it as Spectrogram (opened tall), and Listen shows it under the waveform.+ A box dragged on it (with the Comment tool on the timeline, any drag in Listen) opens the moment card naming+ its span and band in Hz; the note's pin is a time pin over the box's span with one mark {kind: "box", on:+ "sound", points: [[time, mel], [time, mel]]} in 0-1 of the piece and of the mel scale, drawn again on the+ spectrogram in its author's hue, and the agent reads it as "Marked on the sound (box, T0 to T1, LO to HI)"+ (e2e/sound-marks.spec.ts, src/detail/marks.test.ts, host/spectrum.test.ts). `marked` ignores a sound box (it+ is no place in the frame); `sound_band` reads its band into the reading, and `learn-notes` labels t..to+ (widened to half a second about its middle when shorter) and keeps a defect's band in the evidence row's+ `band`. The sound heads are still per window, so the band is kept but not yet learned fromRule: FP12. Heatmaps: a picture axis says where, not only whether@needs:FP11b,FP2c @donediff --git a/docs/manual/guides/fingerprint.md b/docs/manual/guides/fingerprint.mdindex e6bad097..2e837246 100644--- a/docs/manual/guides/fingerprint.md+++ b/docs/manual/guides/fingerprint.md@@ -61,6 +61,12 @@ each kind from 3 projects, ranks real defects above clean work on projects it ne`raea fingerprint report` says where each one stands. An axis that is still under its bar with 300 labels is**stuck**: more labels won't help it, so `report` names it as one to try on another encoder.+A note can also say exactly what it's about. On the picture, drop a pin and mark, box or lasso the thing you mean. On+the sound, choose **Spectrogram** on the timeline's sound track and, with the Comment tool, drag a box around the part+you mean, such as a hiss up high or a hum down low. A sound on its own shows its spectrogram under the waveform, where+any drag draws a box. The note keeps the+box's time as its span and its pitch band. `learn-notes` labels that span and keeps the band in the label.+## Scripts, briefs and stillsA fingerprint reads more than video. A script, a brief or another text file gets EmbeddingGemma 2 rows, one per@@ -147,4 +153,5 @@ finds the media.Axes judge two-second moments, so a fingerprint can't say whether a piece works as a whole, or judge story and paceacross shots. It can say where in the frame only for blur, glitches and flat, barren surfaces; glow it can only-flag. A stylised look or a held shot can read as a defect. And taste axes with only words never hold a post back.+flag. Sound axes judge the whole sound in each moment, so a box's pitch band is kept but not yet learned from. A+stylised look or a held shot can read as a defect. And taste axes with only words never hold a post back.diff --git a/systems/fingerprint-use/src/fixed.rs b/systems/fingerprint-use/src/fixed.rsindex de947f10..27084994 100644--- a/systems/fingerprint-use/src/fixed.rs+++ b/systems/fingerprint-use/src/fixed.rs@@ -89,7 +89,7 @@ mod tests {use raea_sys_fingerprint::evidence::{Row, width};fn row(axis: &str, source: &str, bad: bool, kind: Option<&str>) -> Row {- Row { media: "m".into(), a: 0.0, b: 2.0, axis: axis.into(), bad, weight: 1.0, who: "me".into(), source: source.into(), project: "p".into(), kind: kind.map(Into::into), region: None, words: None, at: 0, pin: None }+ Row { media: "m".into(), a: 0.0, b: 2.0, axis: axis.into(), bad, weight: 1.0, who: "me".into(), source: source.into(), project: "p".into(), kind: kind.map(Into::into), region: None, words: None, at: 0, pin: None, band: None }}#[test]diff --git a/systems/fingerprint-use/src/grow.rs b/systems/fingerprint-use/src/grow.rsindex e18a3a00..6d33b1f4 100644--- a/systems/fingerprint-use/src/grow.rs+++ b/systems/fingerprint-use/src/grow.rs@@ -186,10 +186,10 @@ fn own(mut w: Vec<(f64, f64, [f32; 4])>, t: f64, a: f64, b: f64, win: f64, seed:}/// The region a note's marks name: the box around its marks, boxes and lassos (a click as a small square around it).-/// Arrows and strikes are instructions for the agent, never a region+/// Arrows and strikes are instructions for the agent, never a region; nor is a box on the sound (FP11c: [`sound_band`])pub fn marked(pin: &serde_json::Value) -> Option<[f32; 4]> {let mut r: Option<[f32; 4]> = None;- for m in pin["marks"].as_array().into_iter().flatten() {+ for m in pin["marks"].as_array().into_iter().flatten().filter(|m| m["on"] != "sound") {let reach = match m["kind"].as_str() {Some("mark") => CLICK,Some("box" | "lasso") => 0.0,@@ -204,6 +204,15 @@ pub fn marked(pin: &serde_json::Value) -> Option<[f32; 4]> {r.filter(|a| a[2] > a[0] && a[3] > a[1])}+/// The pitch band of a box drawn on the sound's spectrogram (FP11c), low and high in 0-1 of the mel scale: its points are+/// [time, pitch], and its time is the pin's own t..to+pub fn sound_band(pin: &serde_json::Value) -> Option<[f32; 2]> {+ let m = pin["marks"].as_array()?.iter().find(|m| m["on"] == "sound" && m["kind"] == "box")?;+ let p: Vec<f32> = m["points"].as_array()?.iter().filter_map(|p| p[1].as_f64()).map(|v| v.clamp(0.0, 1.0) as f32).collect();+ let (lo, hi) = (p.iter().copied().fold(f32::INFINITY, f32::min), p.iter().copied().fold(f32::NEG_INFINITY, f32::max));+ (p.len() == 2 && hi > lo).then_some([lo, hi])+}+#[cfg(test)]mod tests {use super::*;@@ -258,6 +267,10 @@ mod tests {assert!(near(r[0], 0.2) && near(r[1], 0.05) && near(r[2], 0.95) && near(r[3], 0.7), "{r:?}");assert_eq!(marked(&json!({"marks": [{"kind": "strike", "points": [[0.1, 0.1], [0.9, 0.9]]}]})), None, "a strike is for the agent");assert_eq!(marked(&json!({"kind": "place", "x": 0.5, "y": 0.5})), None, "a pin is never a mark");+ let sound = json!({"kind": "time", "t": 2.0, "to": 4.0, "marks": [{"kind": "box", "on": "sound", "points": [[0.2, 0.8], [0.4, 0.3]]}]});+ assert_eq!(marked(&sound), None, "a box on the sound is no place in the frame");+ assert_eq!(sound_band(&sound), Some([0.3, 0.8]), "it is a pitch band, low then high");+ assert_eq!(sound_band(&json!({"marks": [{"kind": "box", "points": [[0.1, 0.1], [0.5, 0.5]]}]})), None, "a box on the picture has none");}}diff --git a/systems/fingerprint-use/src/postmortem.rs b/systems/fingerprint-use/src/postmortem.rsindex 3ae20a38..1a6ffcc9 100644--- a/systems/fingerprint-use/src/postmortem.rs+++ b/systems/fingerprint-use/src/postmortem.rs@@ -147,7 +147,7 @@ mod tests {let s = Scored { file: "v1.mp4".into(), media: "h1".into(), dur: 30.0, fingerprint: "me".into(), moments: vec![], windows: vec![win(0.0, 1.5, true), win(10.0, 0.1, true), win(20.0, -1.9, false), win(11.0, 0.15, true)] };let mut l = Ledger::default();// the person approved the first moment: a flag there disagrees with them- let r = Row { media: "h1".into(), a: 0.0, b: 2.0, axis: "*".into(), bad: false, weight: 1.0, who: "me".into(), source: "approval".into(), project: "p".into(), kind: None, region: None, words: None, at: 0, pin: None };+ let r = Row { media: "h1".into(), a: 0.0, b: 2.0, axis: "*".into(), bad: false, weight: 1.0, who: "me".into(), source: "approval".into(), project: "p".into(), kind: None, region: None, words: None, at: 0, pin: None, band: None };l.push(r, &vec![0.0; width()]);let p = picks(&[s], &trained, &fp, &l, 10);assert_eq!(p.iter().map(|x| (x.a, x.why.as_str())).collect::<Vec<_>>(), [(0.0, "disagrees with you"), (10.0, "least sure"), (20.0, "least sure")], "11 s is the same moment as 10 s");diff --git a/systems/fingerprint-use/src/tests.rs b/systems/fingerprint-use/src/tests.rsindex eb2cba88..0235056e 100644--- a/systems/fingerprint-use/src/tests.rs+++ b/systems/fingerprint-use/src/tests.rs@@ -7,7 +7,7 @@ use raea_sys_fingerprint::words::Words;/// A blur label in a project, its window `at` seconds infn row(bad: bool, project: &str, at: f64) -> Row {- Row { media: "m".into(), a: at, b: at + 2.0, axis: "blur".into(), bad, weight: 1.0, who: "t".into(), source: "teach".into(), project: project.into(), kind: None, region: None, words: None, at: 0, pin: None }+ Row { media: "m".into(), a: at, b: at + 2.0, axis: "blur".into(), bad, weight: 1.0, who: "t".into(), source: "teach".into(), project: project.into(), kind: None, region: None, words: None, at: 0, pin: None, band: None }}/// Features with the label's sign in the picture's first values and a little made-up spread in the restdiff --git a/systems/fingerprint/src/evidence.rs b/systems/fingerprint/src/evidence.rsindex d5af2069..e8c22705 100644--- a/systems/fingerprint/src/evidence.rs+++ b/systems/fingerprint/src/evidence.rs@@ -69,6 +69,9 @@ pub struct Row {/// to be re-embedded or re-labelled, and no head trains on it#[serde(default, skip_serializing_if = "Option::is_none")]pub pin: Option<String>,+ /// a box on the sound's spectrogram: its pitch band, low and high in 0-1 of the mel scale up to 11.025 kHz (FP11c)+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub band: Option<[f32; 2]>,}fn one() -> f32 {diff --git a/systems/fingerprint/src/tests.rs b/systems/fingerprint/src/tests.rsindex c9148315..95e390af 100644--- a/systems/fingerprint/src/tests.rs+++ b/systems/fingerprint/src/tests.rs@@ -26,6 +26,7 @@ fn row(axis: &str, bad: bool, project: &str) -> Row {words: None,at: 0,pin: None,+ band: None,}}