Skip to content

armgit / raea

Public Imported from GitHub
0

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.

TL8d: a composition's <Audio> has its noise reduced and its voice changed. sdk/timeline: a media row carries its file (its staticFile path) and, when it plays a copy, what the copy was made from and how (heard: of, denoise, voice); its clip's props are its own file and the copy (file, voiced, denoise, voice), as a film's sound clip has them; a set of those props on an <Audio> is the host's new heard edit (raea-feed 9094259 writes src={staticFile(copy)} data-voice-of data-denoise data-voice, and the src as it was when both are off). Each voice's copy is as loud as its source now (the voices had moved a line with pauses -12.5 to +8.6 dB). raea renders the result: a scratch composition's line at 105 Hz voiced, 140 its own. The manual's editor page regenerated (pbr.md's drift is the paint lane's, left out)

shinyobjectzfad2dbcbf4ea
diff --git a/docs/manual/reference/sdk/editor.md b/docs/manual/reference/sdk/editor.md
index e201343b..fdcde778 100644
--- a/docs/manual/reference/sdk/editor.md
+++ b/docs/manual/reference/sdk/editor.md
@@ -1030,6 +1030,8 @@ the lane it sits on (nested ones below their parent, overlapping ones apart), an
| `startFrom` | `number` | its media's first frame used, in frames of its file |
| `volume` | `number` | its media's level, 1 as recorded |
| `muted` | `boolean` | a <Video> whose own sound was taken out (muted): its sound is an <Audio> of its own |
+| `file` | `string` | its media's file, a path in the composition's media folder (where its src is staticFile("…")) |
+| `heard` | `{ of: string; denoise?: boolean; voice?: string }` | that file is a copy of `of` with its noise reduced or its voice changed |
### `Showing`
diff --git a/docs/timeline.feature b/docs/timeline.feature
index bc074314..448ce3a8 100644
--- a/docs/timeline.feature
+++ b/docs/timeline.feature
@@ -62,8 +62,8 @@ Feature: The timeline SDK (0.1.5): CapCut's timeline, on the composition, in the
Here 11-14: Basic (TL3h, TL5) with stabilise (TL7k, a film's footage; a composition's not yet), auto cutout
of a person or the subject (TL7l, a film's footage, on a Mac) and a custom one brushed on the picture (TL7m), Retouch (TL7n: smooth, brighten, slim face and bigger eyes, a film's footage or a file from Media, on a Mac), Mask, chroma key and Blend (TL7f) with the key's colour picked from
the picture (TL7h) and the mask's handles dragged there (TL7i), Animation (TL7d, TL7e), Speed (TL6), Audio's
- volume and fades (TL8a) and its noise reduction and voice changer (TL8d, a film's sounds; a composition's
- not yet), Text's words, styles and captions (TL7c) and its words read aloud (TL7j), Adjust as effect clips
+ volume and fades (TL8a) and its noise reduction and voice changer (TL8d, a film's sounds and a composition's
+ <Audio>), Text's words, styles and captions (TL7c) and its words read aloud (TL7j), Adjust as effect clips
over a span (TL7b, raea's ten) and as the clip's own twelve sliders (TL7g, on the film and on a file from Media
over it), every number of these keyed (TL5a).
@@ -182,7 +182,11 @@ Feature: The timeline SDK (0.1.5): CapCut's timeline, on the composition, in the
tenth, a phase vocoder for pitch, biquads for the bands, a delay line for the echo; on made sounds hiss
down 16 dB with the tone within 0.04 dB, 3 minutes in 2.3 s; on a real voice the chipmunk moves its
spectral centroid x1.46 and deep x0.77, each setting 25-73 ms for 1.2 s, kept under media/voice and
- read again in under 1 ms), TL7k (footage held steady: host/shake.ts in TypeScript on 320 px
+ read again in under 1 ms; each voice's copy as loud as its source short of clipping, where on a line
+ with pauses they had moved it -12.5 dB (robot) to +8.6 dB (megaphone); in a composition, an <Audio>'s
+ copy made from its own file and kept in its media folder's voice/, the <Audio> playing it and saying
+ what it was made from and how (data-voice-of, data-denoise, data-voice), both off its src as it was;
+ raea renders it, a scratch composition's line at 105 Hz voiced, 140 its own), TL7k (footage held steady: host/shake.ts in TypeScript on 320 px
grey frames from `raea media still`, eight at a time; the window over a block read again where
the first reading put the move, since a fixed window reads big moves short; the path smoothed by
a Gaussian-weighted line, so a pan stays a pan to the clip's ends; on a shaky clip made from a real
@@ -254,7 +258,8 @@ Feature: The timeline SDK (0.1.5): CapCut's timeline, on the composition, in the
written into the working version the moment it is made, its draft played over the picture (TL9a,
TL10d), finished and posted on Send with the agent told (TL9b). A scene's sequences: move, trim,
split, delete written into the scene's own file, which the stage opens again (TL14c). A sound's
- clips: span, place in the file, level (TL14b)
+ clips: span, place in the file, level (TL14b). An <Audio>'s sound from its copy with its noise
+ reduced or its voice changed: its src the copy, and data-voice-of, data-denoise and data-voice (TL8d)
plays TL10a for a film's own frames: cuts, moves, trims, speeds, freezes and reversed footage at once, the
player's buffer on the ruler. TL10f: a timed 3D scene's frames are drawn ahead by the host a few
seconds at a time at draft quality and kept by range, each range under what it is drawn from (the
diff --git a/sdk/timeline/src/read.ts b/sdk/timeline/src/read.ts
index 545eec5c..989a969e 100644
--- a/sdk/timeline/src/read.ts
+++ b/sdk/timeline/src/read.ts
@@ -78,6 +78,10 @@ export interface SeqRow {
volume?: number
/** a <Video> whose own sound was taken out (muted): its sound is an <Audio> of its own (TL4c) */
muted?: boolean
+ /** its media's file, a path in the composition's media folder (where its src is staticFile("…")) */
+ file?: string
+ /** that file is a copy of `of` with its noise reduced or its voice changed (TL8d) */
+ heard?: { of: string; denoise?: boolean; voice?: string }
}
/** A sequence's still placement: its <Nudge>'s props (sdk/video nudge.tsx). `crop` is left, top, right, bottom. */
export interface SeqLook {
@@ -134,6 +138,8 @@ export type SeqEdit =
| { op: "edge"; i: number; side: "in" | "out" | "combo"; kind: string; frames: number }
/** a <Video>'s or an <Audio>'s own level (TL8a) */
| { op: "level"; i: number; volume: number }
+ /** an <Audio> played from `file`, a copy of `of` with its noise reduced or its voice changed; no `of`, `file` as it is (TL8d) */
+ | { op: "heard"; i: number; file: string; of?: string; denoise?: boolean; voice?: string }
/** a <Video>'s own sound taken out (TL4c): the <Video> muted, and an <Audio> of the same file, from the same place
* at the same pace and level, in a new sequence from `at` for `frames` after the composition's last */
| { op: "extract"; i: number; at: number; frames: number }
@@ -208,7 +214,7 @@ export function fromSequences(rows: SeqRow[], fps: number): Timeline {
const mediaTracks = (kind: "video" | "audio"): Track[] => {
const out: Track[] = []
for (const r of media.filter((m) => m.media === kind).sort((a, b) => a.from - b.from)) {
- const c: Clip = { id: seqId(r.i), kind, name: r.label ?? r.name, start: r.from, length: Math.max(1, r.to - r.from), in: r.startFrom ?? 0, ...(r.speed && r.speed !== 1 && { speed: r.speed }), ...(r.volume !== undefined && { volume: r.volume }), ...(r.muted && kind === "video" && { muted: true }), ...(r.locked && { locked: r.locked }) }
+ const c: Clip = { id: seqId(r.i), kind, name: r.label ?? r.name, start: r.from, length: Math.max(1, r.to - r.from), in: r.startFrom ?? 0, ...(r.speed && r.speed !== 1 && { speed: r.speed }), ...(r.volume !== undefined && { volume: r.volume }), ...(r.muted && kind === "video" && { muted: true }), ...(r.locked && { locked: r.locked }), ...(r.file && { props: { file: r.heard?.of ?? r.file, ...(r.heard && { voiced: r.file, denoise: !!r.heard.denoise, voice: r.heard.voice ?? "" }) } }) }
const home = out.find((k) => k.clips.every((o) => end(o) <= c.start || o.start >= end(c)))
if (home) home.clips.push(c)
else out.push({ id: `${kind === "audio" ? "sound" : "footage"}-${out.length + 1}`, kind: kind === "audio" ? "sound" : "overlay", name: kind === "audio" ? "Sound" : "Footage", clips: [c] })
@@ -269,7 +275,11 @@ export function seqEdits(t: Timeline, op: Op): SeqEdit[] | { why: string } {
}
if (ids.some(isMedia)) {
if (op.op === "set" && Object.keys(op.set).filter((k) => op.set[k as keyof typeof op.set] !== undefined).join() === "volume") return ids.flatMap((id) => { const i = seqOf(id); return i === undefined ? [] : [{ op: "level", i, volume: Math.round(Math.max(0, op.set.volume!) * 1000) / 1000 } as SeqEdit] })
- return { why: "footage and sound play where their sequence does: move, trim or speed the sequence; here only the level is its own" }
+ // a sound's copy made on the host (TL8d): the <Audio> plays it, and says what it was made from and how
+ const p = op.op === "set" && Object.keys(op.set).join() === "props" ? op.set.props : undefined
+ if (p && Object.keys(p).every((k) => ["denoise", "voice", "voiced"].includes(k)) && ids.every((id) => find(t, id)?.clip.kind === "audio" && typeof find(t, id)?.clip.props?.file === "string"))
+ return ids.map((id) => { const of = find(t, id)!.clip.props!.file as string; return p.voiced ? { op: "heard", i: seqOf(id)!, file: String(p.voiced), of, ...(p.denoise === true && { denoise: true }), ...(p.voice && { voice: String(p.voice) }) } : { op: "heard", i: seqOf(id)!, file: of } })
+ return { why: "footage and sound play where their sequence does: move, trim or speed the sequence; here only its level and a sound's voice are its own" }
}
const each = (ids: string[], f: (r: { i: number; clip: Clip }) => SeqEdit): SeqEdit[] | { why: string } => {
const rows = ids.map(row)
diff --git a/sdk/timeline/test/read.test.ts b/sdk/timeline/test/read.test.ts
index 03132855..78ef2cdb 100644
--- a/sdk/timeline/test/read.test.ts
+++ b/sdk/timeline/test/read.test.ts
@@ -104,7 +104,7 @@ describe("TL0c: a timeline is read from a composition", () => {
expect(t.tracks[2].clips[0]).toMatchObject({ kind: "video", in: 30, start: 90, length: 90 })
expect(t.tracks[3].clips[0]).toMatchObject({ kind: "audio", volume: 0.5 })
expect(seqEdits(t, { op: "set", id: "seq-6", set: { volume: 0.8 } })).toEqual([{ op: "level", i: 6, volume: 0.8 }])
- expect(seqEdits(t, { op: "move", ids: ["seq-6"], by: 10 })).toEqual({ why: "footage and sound play where their sequence does: move, trim or speed the sequence; here only the level is its own" })
+ expect(seqEdits(t, { op: "move", ids: ["seq-6"], by: 10 })).toEqual({ why: "footage and sound play where their sequence does: move, trim or speed the sequence; here only its level and a sound's voice are its own" })
// the sequences themselves are as before
expect(seqEdits(t, { op: "move", ids: ["seq-1"], by: 10 })).toEqual([{ op: "move", i: 1, from: 25, to: 70 }])
})
@@ -124,6 +124,24 @@ describe("TL0c: a timeline is read from a composition", () => {
expect(fromSequences([{ ...media[media.length - 1], muted: true }], 30).tracks[0].clips[0].muted).toBeUndefined()
})
+ test("a sound's noise reduced or its voice changed is its <Audio> playing a copy, which says what it was made from (TL8d)", () => {
+ const sound = { i: 6, name: "Audio", label: "line.wav", from: 0, to: 180, lane: 0, media: "audio" as const, file: "line.wav" }
+ const t = fromSequences([...rows, sound], 30)
+ expect(find(t, "seq-6")!.clip.props).toEqual({ file: "line.wav" })
+ // the copy made: the <Audio> plays it and says it was made from line.wav, and how
+ const made = { op: "set" as const, id: "seq-6", set: { props: { denoise: true, voice: "deep", voiced: "voice/line-clean-deep-0123456789.wav" } } }
+ expect(seqEdits(t, made)).toEqual([{ op: "heard", i: 6, file: "voice/line-clean-deep-0123456789.wav", of: "line.wav", denoise: true, voice: "deep" }])
+ // read back from that code: the clip's own file is still line.wav, and it plays the copy
+ const back = fromSequences([...rows, { ...sound, file: "voice/line-clean-deep-0123456789.wav", heard: { of: "line.wav", denoise: true, voice: "deep" } }], 30)
+ expect(find(back, "seq-6")!.clip.props).toEqual({ file: "line.wav", voiced: "voice/line-clean-deep-0123456789.wav", denoise: true, voice: "deep" })
+ // both off: its own file again, as it is
+ expect(seqEdits(back, { op: "set", id: "seq-6", set: { props: { denoise: false, voice: "", voiced: "" } } })).toEqual([{ op: "heard", i: 6, file: "line.wav" }])
+ // footage, or a sound whose src isn't a file of the media folder, has no copy to play
+ const footage = fromSequences([...rows, { ...sound, name: "Video", media: "video" as const }], 30)
+ expect(seqEdits(footage, made)).toHaveProperty("why")
+ expect(seqEdits(fromSequences([...rows, { ...sound, file: undefined }], 30), made)).toHaveProperty("why")
+ })
+
test("a file of the project's is a new sequence holding it; on the magnet's main track the clips after it move on and it goes in beside the one before it (TL3j)", () => {
const t = fromSequences(rows, 30)
const add = (kind: string, track: string, start: number, length: number, asset = "/p/media/beach.mp4") => seqEdits(t, { op: "add", kind: track, clip: { id: "m", kind, name: "beach.mp4", start, length, ...(kind !== "image" && { in: 0, source: length }), props: { asset } } })