Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

refactor(composition): separate semantic performance from visual layout

kashorin1f203a4f9f23
diff --git a/docs/guide/packages.md b/docs/guide/packages.md
index 2383ec6e..1653eee5 100644
--- a/docs/guide/packages.md
+++ b/docs/guide/packages.md
@@ -95,7 +95,6 @@ specific Provider deployment.
@hypit/speech shared speech products
@hypit/speech-evidence acoustic evidence products
@hypit/speech-alignment speech alignment
-@hypit/semantic-take-estimate explicit syllable-weighted preview alignment
@hypit/semantic-track continuous semantic program skeleton
@hypit/speech-track ordered speech-take compilation
@hypit/whisperx WhisperX component
diff --git a/docs/quickstart/composition.md b/docs/quickstart/composition.md
index 6140428e..00e7aa98 100644
--- a/docs/quickstart/composition.md
+++ b/docs/quickstart/composition.md
@@ -23,7 +23,7 @@ and layers them by stacking order.
```svml
<space:Canvas id="vertical" width="1080" height="1920"/>
<film:Film id="main" canvas={vertical} semantic={speech.semantic} appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={performance.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={captions.track}/>
<film:Track source={product-broll.visual}/>
@@ -50,7 +50,7 @@ Common Track sources:
| Source | Type | From |
|---|---|---|
-| `{speech.visual}` | VisualTrack | `speech:Track` — sparse same-source speech visuals |
+| `{performance.visual}` | VisualTrack | `media-track:Track` — presentation of the semantic performance |
| `{speech.audio}` | AudioTrack | `speech:Track` — synchronized audio |
| `{captions.track}` | VisualTrack | a Caption Style-family Track — timed captions |
| `{cards.visual}` | VisualTrack | `media-track:Track` — media overlays or B-roll |
@@ -66,7 +66,7 @@ Typical stacking order:
| stack-order | Content |
|---|---|
-| 10 | Example Speech visual (author-selected, not a built-in default) |
+| 10 | Performance presentation (author-selected) |
| 40 | Media overlays |
| 70 | Captions |
| 90 | Text overlays |
@@ -174,10 +174,13 @@ illustration. The complete runnable project is `examples/podcast/`; the commands
video="primary-moving" audio="none" span-authority="video" clock={clock}/>
<whisperx:SemanticTake id="opening-semantic" narrative={story}
segment={story.segment.opening} media={take-media.media} language="en"/>
- <speech:Track id="speech"
- visual-frame={speech-frame} visual-appearance={recipes.speech.visual} visual-z="0">
+ <speech:Track id="speech">
<speech:Take source={opening-semantic.take}/>
</speech:Track>
+<media-track:Track id="performance" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={speech-frame}
+ appearance={recipes.media.performance}/>
+</media-track:Track>
<!-- 4. Tracks: captions, Media, text -->
<fonts:Stack id="caption-font" family="inter" weight="700" style="normal"/>
@@ -202,7 +205,7 @@ illustration. The complete runnable project is `examples/podcast/`; the commands
<!-- 5. Film: compose all tracks -->
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={performance.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={cards.visual}/>
<film:Track source={captions.track}/>
@@ -228,7 +231,7 @@ width and is rejected.
film.vertical {
background: #09090B;
}
- speech.visual { fit: cover; }
+ media.performance { stack-order: 0; fit: cover; }
media.card {
stack-order: 40; fit: cover; playback: hold-start;
frame-paint: #111116; clip: rounded; radius: 20;
diff --git a/docs/quickstart/generation.md b/docs/quickstart/generation.md
index dcced0ea..e6625f36 100644
--- a/docs/quickstart/generation.md
+++ b/docs/quickstart/generation.md
@@ -68,9 +68,8 @@ hypit measure main.svml --segment hook --language en --pace normal --rounding ro
`hypit measure` counts pronunciation units of the Segment's speech at a delivery policy — `language`,
`pace` (`slow = 4.2`, `normal = 4.6`, `fast = 5.0` syllables per second for English) or a numeric
`rate` and `rounding` — with no external call. Nothing in the graph computes a duration,
-so `hypit plan` is complete before a Build starts. The same policy, written on
-`estimated:SemanticTake` or as an SVS Recipe it names (see
-[SVS Stylesheets](./styles.md#speech-estimation)), weights a Segment's words across preview media.
+so the requested durations are available before a Build starts. Use the estimate to shape the
+wording and choose a supported request duration; the produced performance supplies actual word timing.
## text:Value
diff --git a/docs/quickstart/preview.md b/docs/quickstart/preview.md
index ed75c34b..503f1e4d 100644
--- a/docs/quickstart/preview.md
+++ b/docs/quickstart/preview.md
@@ -7,7 +7,11 @@ description: Open a satisfied Run, inspect its picture and timeline, and edit re
Hypit Studio opens one `.svrun`, traces its Film or Render target back to explainable Semantic and Track projections, and presents four regions: Source at the upper left, Preview in the center, Inspector at the upper right, and Timeline below.
-Studio never submits generation or creates a Build. Generated material must be selected explicitly by the Run: from a project file, an earlier Build through `<build-record>`, or an ordinary stand-in Fragment selected with `satisfy`. Studio may ask the selected Runtime Profile to execute exact media Needs whose Provider marks them safe for transient authoring, such as inspection and normalization. It does not infer that permission from pricing, choose another Candidate or invent a placeholder. Other Needs fail with their capability named.
+Studio opens the composition selected by the Run, using project files and completed Build Outputs.
+Use `<build-record>` and `satisfy` to keep the material being edited. Studio can ask the selected
+Runtime Profile to perform media operations such as inspection and normalization when the Provider
+supports transient authoring. Generation and Build submission use the CLI; Studio provides playback,
+semantic navigation and edits to the actual Sources.
```bash
hypit-studio --run examples/ranking-football/swap-effect-banana/studio.svrun \
diff --git a/docs/quickstart/run.md b/docs/quickstart/run.md
index cfefb5e1..e291c011 100644
--- a/docs/quickstart/run.md
+++ b/docs/quickstart/run.md
@@ -27,7 +27,7 @@ hypit get <build-id> --output final.video --to output/final.mp4
The Quickstart installs the Distribution once. Every command on this page then works as `hypit`
from any independent video project.
-Only `build` submits work. `plan` is the normal preview. `check` is an editing aid; `doctor` is a
+Only `build` submits work. `plan` shows the selected work. `check` is an editing aid; `doctor` is a
deployment diagnostic. They are safe to run, but not mandatory ceremony before every Build.
One convenient layout for a project with several Author, Recipe and Run Sources is:
@@ -47,7 +47,7 @@ my-video/
final.svrun final delivery intention
assets/ project-owned input media
kits/ optional project-authored Recipe Kits
- packages/ optional project-local Author packages
+ packages/ project-local Author packages when the work introduces them
output/ explicit exports for people and other tools
hypit.runtime.json execution environment
hypit.results.json optional Result repository selection
@@ -219,7 +219,7 @@ to one current Logical Output:
The file is read relative to the `.svrun`. If it becomes a completed public Output on the Target
route, it is written into the Build Result like any generated media. There is no hidden history
-lookup. A black video, preview image or human-supplied result uses the same mechanism.
+lookup. A supplied image, recorded video or other compatible result uses the same mechanism.
## Runtime Profile
diff --git a/docs/quickstart/styles.md b/docs/quickstart/styles.md
index 308e8f8f..c07018ae 100644
--- a/docs/quickstart/styles.md
+++ b/docs/quickstart/styles.md
@@ -6,8 +6,7 @@ description: The SVS Recipe language — CSS-like stylesheets for film, caption,
# SVS Stylesheets
SVS (`.svs`) files define reusable, typed configuration values using a CSS-like syntax. They
-configure Film appearance, caption appearance, Media presentation and motion, text styling, speech estimation
-parameters, generation settings, and typography choices. SVS values are called **Recipes** — they are
+configure Film appearance, caption appearance, Media presentation and motion, text styling, generation settings, and typography choices. SVS values are called **Recipes** — they are
immutable typed Records that consuming components validate and interpret.
## Basic syntax
@@ -238,40 +237,6 @@ Compiled with exact font bytes into a `text:Style`, then referenced by a concret
</text:Area>
```
-## Speech estimation
-
-Parameters for deterministic speech duration estimation.
-
-```svs
-speech.normal {
- language: en;
- pace: normal;
- rounding: round;
-}
-```
-
-| Property | Description |
-|---|---|
-| `language` | Language code (e.g. `en`) |
-| `pace` | Speaking pace: `slow`, `normal`, `fast` |
-| `rate` | Positive pronunciation units per second; mutually exclusive with `pace` |
-| `rounding` | Rounding mode: `none`, `round`, `ceil` |
-
-The English named presets resolve to `4.2`, `4.6`, and `5.0` syllables per
-second. Use a numeric `rate` in place of `pace` when the project needs a
-continuous author-controlled value.
-Every property is explicit: `language`, `rounding`, and exactly
-one of `pace` or `rate` are required. The Estimate package supplies no hidden policy defaults.
-
-Referenced by `estimated:SemanticTake` via the `policy` attribute, and used by `hypit measure`
-when the author measures a line before writing its literal duration:
-
-```svml
-<estimated:SemanticTake id="hook-estimated" narrative={story}
- segment={story.segment.hook} media={hook-media.media}
- policy={recipes.speech.normal}/>
-```
-
## Speaker Text Template
The Recipe selects the prompt axes declared by the data-only `speaker-v1` Text Template. Model,
@@ -397,11 +362,6 @@ A complete `recipes.svs` file for a four-take talking-head project:
<?svml using="@hypit/svs@1"?>
<sheet version="1" id="studio">
- speech.normal {
- language: en;
- pace: normal;
- rounding: round;
- }
speaker.host {
composition-stability: soft-locked;
@@ -436,10 +396,6 @@ This file is imported once in the `.svml` source and its values are referenced t
```svml
<import as="recipes" source="./recipes.svs"/>
-<estimated:SemanticTake id="hook-estimated" narrative={story}
- segment={story.segment.hook} media={hook-media.media}
- policy={recipes.speech.normal}/>
-
<text:Render id="hook-prompt" template={speaker-kit.speaker-v1}
recipe={recipes.speaker.host}>...</text:Render>
diff --git a/docs/quickstart/timing.md b/docs/quickstart/timing.md
index 58168490..887d2ed3 100644
--- a/docs/quickstart/timing.md
+++ b/docs/quickstart/timing.md
@@ -61,30 +61,30 @@ the completed `SemanticTake`, not a second evidence-shaped timing structure.
## Assemble the SemanticTrack
-`speech:Track` concatenates already-semantic Takes in document order and projects three aligned
-facets from the same items:
+`speech:Track` concatenates already-semantic Takes in document order and provides the semantic
+timeline and its original sound. Media presents the performance separately:
```svml
<space:Canvas id="vertical" width="1080" height="1920"/>
<space:Frame id="speech-frame" within={vertical}
left="0%" top="0%" right="100%" bottom="100%"/>
-<speech:Track id="speech"
- visual-frame={speech-frame}
- visual-appearance={recipes.speech.visual}
- visual-z="0">
+<speech:Track id="speech">
<speech:Take source={opening-semantic.take}/>
<speech:Take source={answer-semantic.take}/>
</speech:Track>
+<media-track:Track id="performance" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={speech-frame}
+ appearance={recipes.media.performance}/>
+</media-track:Track>
```
| Output | Type | Meaning |
|---|---|---|
| `{speech.semantic}` | SemanticTrack | Global semantic and frame-domain authority |
-| `{speech.visual}` | VisualTrack | Same-source pictures, aligned to the semantic items |
| `{speech.audio}` | AudioTrack | Same-source sound, aligned to the semantic items |
-The three facets are projections of the same ordered Takes. They cannot drift independently.
+Picture consumers and the original audio use the same prepared Takes and source positions.
`SemanticTrack` derives global frames by prefix-summing the local Take lengths, and also supplies the
program duration and frame domain required by Film and Render.
@@ -108,7 +108,7 @@ deterministic Track:
<film:Film id="main" canvas={vertical}
semantic={speech.semantic} appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={performance.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={cards.visual}/>
<film:Track source={captions.track}/>
@@ -123,13 +123,8 @@ for a point event, and `during="program"` for the complete SemanticTrack domain.
`semantic={speech.semantic}`.
```text
-raw take ─► Normalize ─► SynchronizedMedia ─► SemanticTake ─┐
-raw take ─► Normalize ─► SynchronizedMedia ─► SemanticTake ─┤
- ▼
- speech:Track
- ┌───────────┼───────────┐
- ▼ ▼ ▼
- .semantic .visual .audio
- │ │ │
- └──────► Film / Tracks ◄─┘
+prepared Takes → Speech Track ── .semantic → Media / project scene → .visual ─┐
+ │ └──→ Caption / semantic graphics ───┤
+ └───── .audio ────────────────────────────────────┤
+ Film
```
diff --git a/docs/quickstart/tracks.md b/docs/quickstart/tracks.md
index 6b606730..959b7ec1 100644
--- a/docs/quickstart/tracks.md
+++ b/docs/quickstart/tracks.md
@@ -566,7 +566,7 @@ All four track families together in one source file:
<!-- All peer tracks feed into Film -->
<film:Film id="main" canvas={vertical} semantic={speech.semantic} appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={performance.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={cards.visual}/>
<film:Track source={captions.track}/>
diff --git a/docs/zh/guide/packages.md b/docs/zh/guide/packages.md
index 5e26d396..cab583a3 100644
--- a/docs/zh/guide/packages.md
+++ b/docs/zh/guide/packages.md
@@ -88,7 +88,6 @@ Frontend;不存在一个认识全部语法的中央解析器。
@hypit/speech shared speech products
@hypit/speech-evidence acoustic evidence products
@hypit/speech-alignment speech alignment
-@hypit/semantic-take-estimate 显式的音节加权预览对齐
@hypit/semantic-track continuous semantic program skeleton
@hypit/speech-track ordered speech-take compilation
@hypit/whisperx WhisperX component
diff --git a/docs/zh/quickstart/composition.md b/docs/zh/quickstart/composition.md
index a4191a0d..02f39dfb 100644
--- a/docs/zh/quickstart/composition.md
+++ b/docs/zh/quickstart/composition.md
@@ -22,7 +22,7 @@ Composition。然后渲染器将该 Composition 编译为 MP4 视频。
```svml
<space:Canvas id="vertical" width="1080" height="1920"/>
<film:Film id="main" canvas={vertical} semantic={speech.semantic} appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={performance.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={captions.track}/>
<film:Track source={product-broll.visual}/>
@@ -49,7 +49,7 @@ Composition。然后渲染器将该 Composition 编译为 MP4 视频。
| 来源 | 类型 | 来自 |
|---|---|---|
-| `{speech.visual}` | VisualTrack | `speech:Track`——稀疏的同源口播视觉 |
+| `{performance.visual}` | VisualTrack | `media-track:Track`——语义表演的画面呈现 |
| `{speech.audio}` | AudioTrack | `speech:Track`——同步音频 |
| `{captions.track}` | VisualTrack | Caption 样式族 Track——定时字幕 |
| `{cards.visual}` | VisualTrack | `media-track:Track`——Media 叠加层或 B-roll |
@@ -170,10 +170,13 @@ Build Target,也可以直接接到媒体裁切、音频/帧提取或模型参
video="primary-moving" audio="none" span-authority="video" clock={clock}/>
<whisperx:SemanticTake id="opening-semantic" narrative={story}
segment={story.segment.opening} media={take-media.media} language="en"/>
- <speech:Track id="speech"
- visual-frame={speech-frame} visual-appearance={recipes.speech.visual} visual-z="0">
+ <speech:Track id="speech">
<speech:Take source={opening-semantic.take}/>
</speech:Track>
+<media-track:Track id="performance" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={speech-frame}
+ appearance={recipes.media.performance}/>
+</media-track:Track>
<!-- 4. Tracks: captions, Media, text -->
<fonts:Stack id="caption-font" family="inter" weight="700" style="normal"/>
@@ -198,7 +201,7 @@ Build Target,也可以直接接到媒体裁切、音频/帧提取或模型参
<!-- 5. Film: compose all tracks -->
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={performance.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={cards.visual}/>
<film:Track source={captions.track}/>
@@ -222,7 +225,7 @@ Build Target,也可以直接接到媒体裁切、音频/帧提取或模型参
film.vertical {
background: #09090B;
}
- speech.visual { fit: cover; }
+ media.performance { stack-order: 0; fit: cover; }
media.card {
stack-order: 40; fit: cover; playback: hold-start;
frame-paint: #111116; clip: rounded; radius: 20;
diff --git a/docs/zh/quickstart/generation.md b/docs/zh/quickstart/generation.md
index 209c0c35..06365599 100644
--- a/docs/zh/quickstart/generation.md
+++ b/docs/zh/quickstart/generation.md
@@ -62,7 +62,7 @@ hypit measure main.svml --segment hook --language en --pace normal --rounding ro
</seedance:ReferenceVideo>
```
-`hypit measure` 按口播策略——`language`、`pace`(英语 `slow = 4.2`、`normal = 4.6`、`fast = 5.0` 音节/秒)或数值 `rate`、`rounding`——统计 Segment 台词的读音单位,不调用任何外部服务。图里没有任何东西在计算时长,所以 `hypit plan` 在 Build 开始前就是完整的。同一套策略写在 `estimated:SemanticTake` 上或它引用的 SVS Recipe 里(参见 [SVS 样式表](./styles.md#speech-estimation)),用于把 Segment 的词按音节权重铺到预览媒体上。
+`hypit measure` 按口播策略——`language`、`pace`(英语 `slow = 4.2`、`normal = 4.6`、`fast = 5.0` 音节/秒)或数值 `rate`、`rounding`——统计 Segment 台词的读音单位,不调用任何外部服务。请求时长在 Build 开始前已经明确。用估时结果调整稿子并选择模型支持的时长;实际词时间由生成表演后的语义处理提供。
## text:Value
diff --git a/docs/zh/quickstart/preview.md b/docs/zh/quickstart/preview.md
index 99e6af68..dcab9919 100644
--- a/docs/zh/quickstart/preview.md
+++ b/docs/zh/quickstart/preview.md
@@ -7,7 +7,7 @@ description: 打开一份素材已经满足的 Run,检查画面、时间线并
Hypit Studio 打开一份 `.svrun`,把它的 Film 或 Render target 回溯到可解释的 Semantic 与 Track 投影,并用四个区域呈现:左上 Source、中上 Preview、右上 Inspector、下方 Timeline。
-Studio 不提交生成,也不创建 Build。需要生成的素材必须由 Run 明确选择:可以是项目文件、由 `<build-record>` 引用的历史 Build Output,也可以是用 `satisfy` 选择的普通替身 Fragment。Studio 可以请求所选 Runtime Profile 执行 Provider 明确允许临时创作执行的媒体 Need,例如检查和归一化;它不根据价格猜权限、不替换 Candidate,也不暗中制造占位。其余 Need 会带着准确 capability 失败。
+Studio 打开 Run 选择的编排,使用项目文件和已完成的 Build Output。通过 `<build-record>` 和 `satisfy` 保留正在编辑的素材。Provider 支持临时创作执行时,Studio 可请求所选 Runtime Profile 完成检查、归一化等媒体操作。生成和 Build 提交通过 CLI 进行;Studio 提供播放、语义定位和对实际 Source 的编辑。
```bash
hypit-studio --run examples/ranking-football/swap-effect-banana/studio.svrun \
diff --git a/docs/zh/quickstart/run.md b/docs/zh/quickstart/run.md
index 065ea9d3..f074ab7f 100644
--- a/docs/zh/quickstart/run.md
+++ b/docs/zh/quickstart/run.md
@@ -24,7 +24,7 @@ hypit get <build-id> --output final.video --to output/final.mp4
快速开始只需全局安装一次 Distribution。此后本页所有命令都直接写作 `hypit`,在任何独立视频项目中都一样。
-只有 `build` 会真正提交工作。`plan` 是普通预览;`check` 用于编辑源码,`doctor` 用于配置和排查部署。它们都安全,但不是每次 Build 前必须重复的仪式。
+只有 `build` 会真正提交工作。`plan` 展示选中的工作;`check` 用于编辑源码,`doctor` 用于配置和排查部署。它们都安全,但不是每次 Build 前必须重复的仪式。
当项目包含多份 Author、Recipe 和 Run Source 时,一种顺手的目录约定是:
@@ -43,7 +43,7 @@ my-video/
final.svrun 最终交付意图
assets/ 项目自己的输入素材
kits/ 可选的项目内 Recipe Kit
- packages/ 可选的项目本地 Author 包
+ packages/ 作品需要时创建的项目本地 Author 包
output/ 显式导出给人或其他工具的副本
hypit.runtime.json 执行环境
hypit.results.json 可选的 Result 仓库选择
@@ -186,7 +186,7 @@ Core 不再给 Candidate 标注 `exact` 或 `substitute`。选择 Candidate 本
<satisfy output="opening-shot.video" candidate="approved-opening"/>
```
-文件相对于 `.svrun` 读取。如果它在 Target 路线上成为已经完成的公开 Output,就像生成媒体一样写入 Build Result。系统没有隐式历史查找;黑场、预览图与人工交付的产物也使用同一个机制。
+文件相对于 `.svrun` 读取。如果它在 Target 路线上成为已经完成的公开 Output,就像生成媒体一样写入 Build Result。系统没有隐式历史查找;用户提供的图片、录制的视频和其他兼容产物也使用同一个机制。
## Runtime Profile
diff --git a/docs/zh/quickstart/styles.md b/docs/zh/quickstart/styles.md
index d94cff1e..b0b066fc 100644
--- a/docs/zh/quickstart/styles.md
+++ b/docs/zh/quickstart/styles.md
@@ -5,7 +5,7 @@ description: SVS Recipe 语言——用于影片、字幕、媒体、文本及
# SVS 样式表
-SVS(`.svs`)文件使用类 CSS 语法定义可复用的类型化配置值。它们用于配置影片外观、字幕外观、Media 呈现与运动、文本样式、语音估算参数、生成设置和字体选择。SVS 中的值称为 **Recipe**——它们是不可变的类型化记录,由消费组件进行验证和解释。
+SVS(`.svs`)文件使用类 CSS 语法定义可复用的类型化配置值。它们用于配置影片外观、字幕外观、Media 呈现与运动、文本样式、生成设置和字体选择。SVS 中的值称为 **Recipe**——它们是不可变的类型化记录,由消费组件进行验证和解释。
## 基本语法
@@ -233,36 +233,6 @@ text.title {
</text:Area>
```
-## 语音估算
-
-确定性语音时长估算的参数。
-
-```svs
-speech.normal {
- language: en;
- pace: normal;
- rounding: round;
-}
-```
-
-| 属性 | 描述 |
-|---|---|
-| `language` | 语言代码(如 `en`) |
-| `pace` | 语速:`slow`、`normal`、`fast` |
-| `rate` | 正数的每秒读音单位数;不能和 `pace` 同时使用 |
-| `rounding` | 取整模式:`none`、`round`、`ceil` |
-
-英语三个具名档位分别解析为每秒 `4.2`、`4.6`、`5.0` 个音节。项目需要连续可调值时,用数值 `rate` 代替 `pace`。所有属性都必须显式提供:`language`、`rounding`,并且在 `pace` 与
-`rate` 中恰好选择一个。Estimate 包不会补充隐藏策略默认值。
-
-通过 `estimated:SemanticTake` 的 `policy` 属性引用;作者写字面量时长之前用 `hypit measure` 量稿,用的也是同一套策略:
-
-```svml
-<estimated:SemanticTake id="hook-estimated" narrative={story}
- segment={story.segment.hook} media={hook-media.media}
- policy={recipes.speech.normal}/>
-```
-
## Speaker Text Template
这个 Recipe 选择纯数据 `speaker-v1` Text Template 声明的 Prompt 轴。模型、分辨率、参考素材与时长仍是 `seedance:ReferenceVideo` 的显式输入,不藏在 Recipe 里。
@@ -372,11 +342,6 @@ Caption Recipe 不再重复家族、字重或字形。CJK 与 Emoji 即使由多
<?svml using="@hypit/svs@1"?>
<sheet version="1" id="studio">
- speech.normal {
- language: en;
- pace: normal;
- rounding: round;
- }
speaker.host {
composition-stability: soft-locked;
@@ -411,10 +376,6 @@ Caption Recipe 不再重复家族、字重或字形。CJK 与 Emoji 即使由多
```svml
<import as="recipes" source="./recipes.svs"/>
-<estimated:SemanticTake id="hook-estimated" narrative={story}
- segment={story.segment.hook} media={hook-media.media}
- policy={recipes.speech.normal}/>
-
<text:Render id="hook-prompt" template={speaker-kit.speaker-v1}
recipe={recipes.speaker.host}>...</text:Render>
diff --git a/docs/zh/quickstart/timing.md b/docs/zh/quickstart/timing.md
index 8f6d1f7f..538d3ff7 100644
--- a/docs/zh/quickstart/timing.md
+++ b/docs/zh/quickstart/timing.md
@@ -58,29 +58,29 @@ Hypit 不会根据 Script 文本或音频自动检测、分流语言。
## 装配 SemanticTrack
-`speech:Track` 按文档顺序拼接已经语义化的 Take,并从同一批 item 投影出三个严格对齐的侧面:
+`speech:Track` 按文档顺序拼接已经语义化的 Take,提供语义时间线及原声音频;Media 独立呈现表演画面:
```svml
<space:Canvas id="vertical" width="1080" height="1920"/>
<space:Frame id="speech-frame" within={vertical}
left="0%" top="0%" right="100%" bottom="100%"/>
-<speech:Track id="speech"
- visual-frame={speech-frame}
- visual-appearance={recipes.speech.visual}
- visual-z="0">
+<speech:Track id="speech">
<speech:Take source={opening-semantic.take}/>
<speech:Take source={answer-semantic.take}/>
</speech:Track>
+<media-track:Track id="performance" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={speech-frame}
+ appearance={recipes.media.performance}/>
+</media-track:Track>
```
| 输出 | 类型 | 含义 |
|---|---|---|
| `{speech.semantic}` | SemanticTrack | 全局语义与帧域真相 |
-| `{speech.visual}` | VisualTrack | 与语义 item 对齐的同源画面 |
| `{speech.audio}` | AudioTrack | 与语义 item 对齐的同源声音 |
-三个侧面都是同一批有序 Take 的投影,不能各自漂移。`SemanticTrack` 通过局部 Take 长度的前缀和
+画面组件和原声音频使用同一批素材及源位置。`SemanticTrack` 通过局部 Take 长度的前缀和
得到全局帧位置,同时提供 Film 和 Render 所需的节目时长与帧域。
## 消费语义时间
@@ -102,7 +102,7 @@ SemanticTrack,并在构建确定性 Track 时把这些身份投影成帧:
<film:Film id="main" canvas={vertical}
semantic={speech.semantic} appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={performance.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={cards.visual}/>
<film:Track source={captions.track}/>
@@ -115,13 +115,8 @@ SemanticTrack,并在构建确定性 Track 时把这些身份投影成帧:
整段使用 `during={story.segment.answer}`,作者范围使用 Selection,点事件使用 Moment,完整节目使用 `during="program"`。组件统一消费 `semantic={speech.semantic}`。
```text
-原始 Take ─► Normalize ─► SynchronizedMedia ─► SemanticTake ─┐
-原始 Take ─► Normalize ─► SynchronizedMedia ─► SemanticTake ─┤
- ▼
- speech:Track
- ┌───────────┼───────────┐
- ▼ ▼ ▼
- .semantic .visual .audio
- │ │ │
- └──────► Film / Tracks ◄─┘
+prepared Takes → Speech Track ── .semantic → Media / project scene → .visual ─┐
+ │ └──→ Caption / semantic graphics ───┤
+ └───── .audio ────────────────────────────────────┤
+ Film
```
diff --git a/docs/zh/quickstart/tracks.md b/docs/zh/quickstart/tracks.md
index 9366f8e3..220619d3 100644
--- a/docs/zh/quickstart/tracks.md
+++ b/docs/zh/quickstart/tracks.md
@@ -473,7 +473,7 @@ Track 接受 `id`、`canvas` 与 `semantic`。时长写作 `12f`、`250ms` 或 `
<!-- 所有对等 Track 都进入 Film -->
<film:Film id="main" canvas={vertical} semantic={speech.semantic} appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={performance.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={cards.visual}/>
<film:Track source={captions.track}/>
diff --git a/examples/interview/recipes.svs b/examples/interview/recipes.svs
index a8162329..b968207d 100644
--- a/examples/interview/recipes.svs
+++ b/examples/interview/recipes.svs
@@ -9,7 +9,7 @@
gesture: expressive;
}
- speech.visual {
+ media.performance { stack-order: 10;
fit: cover;
}
diff --git a/examples/interview/reference.svml b/examples/interview/reference.svml
index 596e3e98..2788bce5 100644
--- a/examples/interview/reference.svml
+++ b/examples/interview/reference.svml
@@ -1,6 +1,7 @@
<?svml using="@hypit/markup@1"?>
<svml>
+ <import as="media-track" from="@hypit/media-track@1"/>
<import from="@hypit/script@1"/>
<import as="text" from="@hypit/text@1"/>
<import as="media" from="@hypit/media@1"/>
@@ -236,12 +237,15 @@
<whisperx:SemanticTake id="bitcoin-rule-semantic" narrative={story}
segment={story.segment.bitcoin-rule} media={bitcoin-rule-media.media} language="en"/>
- <speech:Track id="speech" visual-frame={full-frame}
- visual-appearance={recipes.speech.visual} visual-z="10">
+ <speech:Track id="speech">
<speech:Take source={manifest-rule-semantic.take}/>
<speech:Take source={real-estate-rule-semantic.take}/>
<speech:Take source={bitcoin-rule-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={full-frame}
+ appearance={recipes.media.performance}/>
+ </media-track:Track>
<audio-track:Track id="music-bed" semantic={speech.semantic}>
<audio-track:Clip source={soundtrack-media.media} during="program"
@@ -288,7 +292,7 @@
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={captions.track}/>
<film:Track source={rule-reveal.track}/>
diff --git a/examples/interview/reference.svs b/examples/interview/reference.svs
index 1d67cc31..e7f3b703 100644
--- a/examples/interview/reference.svs
+++ b/examples/interview/reference.svs
@@ -9,7 +9,7 @@
gesture: compact;
}
- speech.visual {
+ media.performance { stack-order: 10;
fit: cover;
}
diff --git a/examples/interview/swap-host.svml b/examples/interview/swap-host.svml
index ad377a5d..50faf7be 100644
--- a/examples/interview/swap-host.svml
+++ b/examples/interview/swap-host.svml
@@ -1,6 +1,7 @@
<?svml using="@hypit/markup@1"?>
<svml>
+ <import as="media-track" from="@hypit/media-track@1"/>
<import from="@hypit/script@1"/>
<import as="text" from="@hypit/text@1"/>
<import as="media" from="@hypit/media@1"/>
@@ -178,12 +179,15 @@
<whisperx:SemanticTake id="bitcoin-rule-semantic" narrative={story}
segment={story.segment.bitcoin-rule} media={bitcoin-rule-media.media} language="en"/>
- <speech:Track id="speech" visual-frame={full-frame}
- visual-appearance={recipes.speech.visual} visual-z="10">
+ <speech:Track id="speech">
<speech:Take source={manifest-rule-semantic.take}/>
<speech:Take source={real-estate-rule-semantic.take}/>
<speech:Take source={bitcoin-rule-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={full-frame}
+ appearance={recipes.media.performance}/>
+ </media-track:Track>
<audio-track:Track id="music-bed" semantic={speech.semantic}>
<audio-track:Clip source={soundtrack-media.media} during="program"
@@ -230,7 +234,7 @@
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={captions.track}/>
<film:Track source={rule-reveal.track}/>
diff --git a/examples/interview/swap-lang.svml b/examples/interview/swap-lang.svml
index 2a30c49d..c2da1934 100644
--- a/examples/interview/swap-lang.svml
+++ b/examples/interview/swap-lang.svml
@@ -1,6 +1,7 @@
<?svml using="@hypit/markup@1"?>
<svml>
+ <import as="media-track" from="@hypit/media-track@1"/>
<import from="@hypit/script@1"/>
<import as="text" from="@hypit/text@1"/>
<import as="media" from="@hypit/media@1"/>
@@ -182,12 +183,15 @@
<adjust:Anchor at={story.moment.aja} frame="63"/>
</adjust:SemanticTake>
- <speech:Track id="speech" visual-frame={full-frame}
- visual-appearance={recipes.speech.visual} visual-z="10">
+ <speech:Track id="speech">
<speech:Take source={manifest-rule-corrected.take}/>
<speech:Take source={real-estate-rule-semantic.take}/>
<speech:Take source={bitcoin-rule-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={full-frame}
+ appearance={recipes.media.performance}/>
+ </media-track:Track>
<audio-track:Track id="music-bed" semantic={speech.semantic}>
<audio-track:Clip source={soundtrack-media.media} during="program"
@@ -234,7 +238,7 @@
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={captions.track}/>
<film:Track source={rule-reveal.track}/>
diff --git a/examples/interview/swap-ride.svml b/examples/interview/swap-ride.svml
index 2a2c9225..6604de4e 100644
--- a/examples/interview/swap-ride.svml
+++ b/examples/interview/swap-ride.svml
@@ -1,6 +1,7 @@
<?svml using="@hypit/markup@1"?>
<svml>
+ <import as="media-track" from="@hypit/media-track@1"/>
<import from="@hypit/script@1"/>
<import as="text" from="@hypit/text@1"/>
<import as="media" from="@hypit/media@1"/>
@@ -183,12 +184,15 @@
<whisperx:SemanticTake id="first-place-rule-semantic" narrative={story}
segment={story.segment.first-place-rule} media={first-place-rule-media.media} language="en"/>
- <speech:Track id="speech" visual-frame={full-frame}
- visual-appearance={recipes.speech.visual} visual-z="10">
+ <speech:Track id="speech">
<speech:Take source={uber-rule-semantic.take}/>
<speech:Take source={shortcuts-rule-semantic.take}/>
<speech:Take source={first-place-rule-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={full-frame}
+ appearance={recipes.media.performance}/>
+ </media-track:Track>
<audio-track:Track id="music-bed" semantic={speech.semantic}>
<audio-track:Clip source={soundtrack-media.media} during="program"
@@ -237,7 +241,7 @@
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={captions.track}/>
<film:Track source={rule-reveal.track}/>
diff --git a/examples/minimal-author-package/packages/example-component/preview/preview.svml b/examples/minimal-author-package/packages/example-component/preview/preview.svml
index 684a51ea..25f31f6c 100644
--- a/examples/minimal-author-package/packages/example-component/preview/preview.svml
+++ b/examples/minimal-author-package/packages/example-component/preview/preview.svml
@@ -3,6 +3,7 @@
<!-- A complete catalogue Source. Its Run is ordinary: Studio can open it once the required media
Candidates are supplied, and a normal Build of the same Run can regenerate the catalogue frame. -->
<svml>
+ <import as="media-track" from="@hypit/media-track@1"/>
<import from="@hypit/script@1"/>
<import as="wording" from="@hypit/text@1"/>
<import as="seedance" from="@hypit/seedance@1"/>
@@ -28,13 +29,17 @@
<seedance:TextVideo id="take" model="mini" prompt={direction} duration="4" generate-audio="true"/>
<pipeline:Normalize id="take-media" source={take.video} recipe={recipes.media.aroll} clock={clock}/>
<whisperx:SemanticTake id="showcase-semantic" narrative={story} segment={story.segment.showcase} media={take-media.media} language="en"/>
- <speech:Track id="speech" visual-frame={speech-frame} visual-appearance={recipes.speech.visual} visual-z="0">
+ <speech:Track id="speech">
<speech:Take source={showcase-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={speech-frame}
+ appearance={recipes.media.performance}/>
+ </media-track:Track>
<example:Box id="box" semantic={speech.semantic}/>
<film:Film id="main" canvas={vertical} semantic={speech.semantic} appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={box.track}/>
</film:Film>
diff --git a/examples/minimal-author-package/packages/example-component/preview/recipes.svs b/examples/minimal-author-package/packages/example-component/preview/recipes.svs
index 4471c8a8..a2ebf8cc 100644
--- a/examples/minimal-author-package/packages/example-component/preview/recipes.svs
+++ b/examples/minimal-author-package/packages/example-component/preview/recipes.svs
@@ -2,7 +2,7 @@
<sheet version="1">
film.vertical { background: #09090B; }
- speech.visual { fit: cover; }
+ media.performance { stack-order: 0; fit: cover; }
speech.normal { language: en; pace: normal; rounding: round; }
media.aroll { video: primary-moving; audio: default; span-authority: video; }
</sheet>
diff --git a/examples/podcast/recipes.svs b/examples/podcast/recipes.svs
index 46079464..759d740c 100644
--- a/examples/podcast/recipes.svs
+++ b/examples/podcast/recipes.svs
@@ -63,13 +63,8 @@
gesture: natural;
}
- speech.preview {
- language: en;
- pace: normal;
- rounding: none;
- }
- speech.visual {
+ media.performance { stack-order: 10;
fit: cover;
}
diff --git a/examples/podcast/reference.svml b/examples/podcast/reference.svml
index 85ca5e54..b06b185d 100644
--- a/examples/podcast/reference.svml
+++ b/examples/podcast/reference.svml
@@ -358,12 +358,15 @@
segment={story.segment.arms-are-asking} media={arms-are-asking-media.media} language="en"/>
- <speech:Track id="speech" visual-frame={full-frame}
- visual-appearance={recipes.speech.visual} visual-z="10">
+ <speech:Track id="speech">
<speech:Take source={opening-semantic.take}/>
<speech:Take source={daily-creatine-semantic.take}/>
<speech:Take source={arms-are-asking-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={full-frame}
+ appearance={recipes.media.performance}/>
+ </media-track:Track>
<audio-track:Track id="music-bed" semantic={speech.semantic}>
<audio-track:Clip source={soundtrack-media.media} during="program"
@@ -390,7 +393,7 @@
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={lifestyle.visual}/>
<film:Track source={captions.track}/>
diff --git a/examples/podcast/reference.svs b/examples/podcast/reference.svs
index 4a282d9d..74774e9c 100644
--- a/examples/podcast/reference.svs
+++ b/examples/podcast/reference.svs
@@ -27,7 +27,7 @@
gesture: natural;
}
- speech.visual {
+ media.performance { stack-order: 10;
fit: cover;
}
diff --git a/examples/podcast/swap-app.svml b/examples/podcast/swap-app.svml
index 222e5c00..b2910948 100644
--- a/examples/podcast/swap-app.svml
+++ b/examples/podcast/swap-app.svml
@@ -187,12 +187,15 @@
<whisperx:SemanticTake id="brain-is-asking-semantic" narrative={story}
segment={story.segment.brain-is-asking} media={brain-is-asking-media.media} language="en"/>
- <speech:Track id="speech" visual-frame={full-frame}
- visual-appearance={recipes.speech.visual} visual-z="10">
+ <speech:Track id="speech">
<speech:Take source={opening-semantic.take}/>
<speech:Take source={daily-cheatgpt-semantic.take}/>
<speech:Take source={brain-is-asking-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={full-frame}
+ appearance={recipes.media.performance}/>
+ </media-track:Track>
<audio-track:Track id="music-bed" semantic={speech.semantic}>
<audio-track:Clip source={soundtrack-media.media} during="program"
@@ -219,7 +222,7 @@
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={lifestyle.visual}/>
<film:Track source={captions.track}/>
diff --git a/examples/podcast/swap-host.svml b/examples/podcast/swap-host.svml
index 18340852..7aa9809c 100644
--- a/examples/podcast/swap-host.svml
+++ b/examples/podcast/swap-host.svml
@@ -9,7 +9,6 @@
<import as="program" from="@hypit/program-space@1"/>
<import as="pipeline" from="@hypit/media-pipeline@1"/>
<import as="whisperx" from="@hypit/whisperx@1"/>
- <import as="estimated" from="@hypit/semantic-take-estimate@1"/>
<import as="speech" from="@hypit/speech-track@1"/>
<import as="audio-track" from="@hypit/audio-track@1"/>
<import as="caption" from="@hypit/caption@1"/>
@@ -196,22 +195,15 @@
<whisperx:SemanticTake id="arms-are-asking-semantic" narrative={story}
segment={story.segment.arms-are-asking} media={arms-are-asking-media.media} language="en"/>
- <estimated:SemanticTake id="opening-estimated" narrative={story}
- segment={story.segment.opening-question} media={opening-media.media}
- policy={recipes.speech.preview}/>
- <estimated:SemanticTake id="daily-creatine-estimated" narrative={story}
- segment={story.segment.daily-creatine} media={daily-creatine-media.media}
- policy={recipes.speech.preview}/>
- <estimated:SemanticTake id="arms-are-asking-estimated" narrative={story}
- segment={story.segment.arms-are-asking} media={arms-are-asking-media.media}
- policy={recipes.speech.preview}/>
-
- <speech:Track id="speech" visual-frame={full-frame}
- visual-appearance={recipes.speech.visual} visual-z="10">
+ <speech:Track id="speech">
<speech:Take source={opening-semantic.take}/>
<speech:Take source={daily-creatine-semantic.take}/>
<speech:Take source={arms-are-asking-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={full-frame}
+ appearance={recipes.media.performance}/>
+ </media-track:Track>
<audio-track:Track id="music-bed" semantic={speech.semantic}>
<audio-track:Clip source={soundtrack-media.media} during="program"
@@ -238,7 +230,7 @@
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={lifestyle.visual}/>
<film:Track source={captions.track}/>
diff --git a/examples/podcast/swap-item.svml b/examples/podcast/swap-item.svml
index 0fd2bc85..245a3dbf 100644
--- a/examples/podcast/swap-item.svml
+++ b/examples/podcast/swap-item.svml
@@ -195,12 +195,15 @@
<whisperx:SemanticTake id="skin-is-asking-semantic" narrative={story}
segment={story.segment.skin-is-asking} media={skin-is-asking-media.media} language="en"/>
- <speech:Track id="speech" visual-frame={full-frame}
- visual-appearance={recipes.speech.visual} visual-z="10">
+ <speech:Track id="speech">
<speech:Take source={opening-semantic.take}/>
<speech:Take source={daily-retinol-semantic.take}/>
<speech:Take source={skin-is-asking-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={full-frame}
+ appearance={recipes.media.performance}/>
+ </media-track:Track>
<audio-track:Track id="music-bed" semantic={speech.semantic}>
<audio-track:Clip source={soundtrack-media.media} during="program"
@@ -227,7 +230,7 @@
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={lifestyle.visual}/>
<film:Track source={captions.track}/>
diff --git a/examples/ranking-football/column-recipes.svs b/examples/ranking-football/column-recipes.svs
index 850c9c39..fb45e3d0 100644
--- a/examples/ranking-football/column-recipes.svs
+++ b/examples/ranking-football/column-recipes.svs
@@ -11,7 +11,7 @@
film.vertical { background: #090A0F; }
- speech.visual {
+ media.performance { stack-order: 0;
fit: cover;
frame-x: 0.5;
frame-y: 0.5;
diff --git a/examples/ranking-football/recipes.svs b/examples/ranking-football/recipes.svs
index 9f70519f..84f798ff 100644
--- a/examples/ranking-football/recipes.svs
+++ b/examples/ranking-football/recipes.svs
@@ -11,7 +11,7 @@
film.vertical { background: #090A0F; }
- speech.visual {
+ media.performance { stack-order: 0;
fit: cover;
frame-x: 0.5;
frame-y: 0.5;
diff --git a/examples/ranking-football/reference-banana-from-swap/recipes.svs b/examples/ranking-football/reference-banana-from-swap/recipes.svs
index 9f70519f..84f798ff 100644
--- a/examples/ranking-football/reference-banana-from-swap/recipes.svs
+++ b/examples/ranking-football/reference-banana-from-swap/recipes.svs
@@ -11,7 +11,7 @@
film.vertical { background: #090A0F; }
- speech.visual {
+ media.performance { stack-order: 0;
fit: cover;
frame-x: 0.5;
frame-y: 0.5;
diff --git a/examples/ranking-football/reference-banana-from-swap/reference-banana-from-swap.svml b/examples/ranking-football/reference-banana-from-swap/reference-banana-from-swap.svml
index 914848e6..cf2eb685 100644
--- a/examples/ranking-football/reference-banana-from-swap/reference-banana-from-swap.svml
+++ b/examples/ranking-football/reference-banana-from-swap/reference-banana-from-swap.svml
@@ -7,7 +7,6 @@
<import as="gpt" from="@hypit/gpt-image@1"/>
<import as="seedance" from="@hypit/seedance@1"/>
<import as="pipeline" from="@hypit/media-pipeline@1"/>
- <import as="estimated" from="@hypit/semantic-take-estimate@1"/>
<import as="whisperx" from="@hypit/whisperx@1"/>
<import as="speech" from="@hypit/speech-track@1"/>
<import as="media-track" from="@hypit/media-track@1"/>
@@ -64,8 +63,7 @@
<text:Value id="benzema-icon-prompt">A photograph with the texture of real iPhone footage. Generate a close portrait, as one frame cut out of video actually shot on an iPhone: genuinely real rather than glossy, carrying the texture of video and not of a posed photograph. The background stays clearly visible, with no depth-of-field blur. Skin texture is fine and real, the light is natural, and no part of the picture is broken. olive-skinned French-Algerian footballer in his mid-thirties with a broad square face, dark brown eyes, thick brows, a strong nose, heavy jaw, and a full dense beard. His head is shaved close; he has a thick neck, very broad muscular shoulders, and a calm serious expression. He wears a plain white shirt.. Keep the portrait centered, shoulders visible, and use a simple neutral background with no readable text or logos.</text:Value>
<gpt:Image id="benzema-icon" prompt={benzema-icon-prompt} aspect-ratio="1:1" resolution="1K"/>
- <!-- Real Seedance Takes use explicit fixed ten-second requests. These
- estimates belong only to the optional static preview candidates. -->
+ <!-- The performed media supplies actual word timing. -->
<text:Value id="ronaldo-action">
Keep the handheld microphone in the same hand throughout, and use only the free hand for gestures. At the opening, widen his eyes and nod emphatically as he begins speaking. On "hair gel", deliberately run the free hand over his hair. On "Greek god", react with exaggerated surprise. On "Greek tragedy", shake his head with a mocking laugh. On "But hey", lean his body forward and raise the free index finger as if he has just thought of something. On the final sentence, give a sarcastic shrug.
@@ -196,29 +194,14 @@
<whisperx:SemanticTake id="messi-semantic" narrative={story}
segment={story.segment.messi} media={messi-media.media} language="en"/>
- <!-- Preview candidate path: the authored presenter image is formally encoded
- as a silent MP4, normalized through the same waist, then given an honest
- syllable-weighted estimated alignment over its complete frame count. -->
- <pipeline:StillVideo id="ronaldo-still" source={presenter.image}
- duration="10" clock={clock}/>
- <pipeline:StillVideo id="messi-still" source={presenter.image}
- duration="9" clock={clock}/>
- <pipeline:Normalize id="ronaldo-preview-media" source={ronaldo-still.video}
- video="primary-moving" audio="none" span-authority="video" clock={clock}/>
- <pipeline:Normalize id="messi-preview-media" source={messi-still.video}
- video="primary-moving" audio="none" span-authority="video" clock={clock}/>
- <estimated:SemanticTake id="ronaldo-preview" narrative={story}
- segment={story.segment.ronaldo} media={ronaldo-preview-media.media}
- language="en" pace="normal" rounding="round"/>
- <estimated:SemanticTake id="messi-preview" narrative={story}
- segment={story.segment.messi} media={messi-preview-media.media}
- language="en" pace="normal" rounding="round"/>
-
- <speech:Track id="speech" visual-frame={speech-frame}
- visual-appearance={recipes.speech.visual} visual-z="0">
+ <speech:Track id="speech">
<speech:Take source={ronaldo-semantic.take}/>
<speech:Take source={messi-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={speech-frame}
+ appearance={recipes.media.performance}/>
+ </media-track:Track>
<audio-track:Track id="music-bed" semantic={speech.semantic}>
<audio-track:Clip source={soundtrack-media.media} during="program"
playback="once-start" gain="0.12" fade-in="300ms" fade-out="600ms"/>
@@ -294,7 +277,7 @@
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={football-tiers.visual}/>
<film:Track source={football-tiers.audio}/>
diff --git a/examples/ranking-football/reference-banana/recipes.svs b/examples/ranking-football/reference-banana/recipes.svs
index 9f70519f..84f798ff 100644
--- a/examples/ranking-football/reference-banana/recipes.svs
+++ b/examples/ranking-football/reference-banana/recipes.svs
@@ -11,7 +11,7 @@
film.vertical { background: #090A0F; }
- speech.visual {
+ media.performance { stack-order: 0;
fit: cover;
frame-x: 0.5;
frame-y: 0.5;
diff --git a/examples/ranking-football/reference-banana/reference-banana.svml b/examples/ranking-football/reference-banana/reference-banana.svml
index 914848e6..cf2eb685 100644
--- a/examples/ranking-football/reference-banana/reference-banana.svml
+++ b/examples/ranking-football/reference-banana/reference-banana.svml
@@ -7,7 +7,6 @@
<import as="gpt" from="@hypit/gpt-image@1"/>
<import as="seedance" from="@hypit/seedance@1"/>
<import as="pipeline" from="@hypit/media-pipeline@1"/>
- <import as="estimated" from="@hypit/semantic-take-estimate@1"/>
<import as="whisperx" from="@hypit/whisperx@1"/>
<import as="speech" from="@hypit/speech-track@1"/>
<import as="media-track" from="@hypit/media-track@1"/>
@@ -64,8 +63,7 @@
<text:Value id="benzema-icon-prompt">A photograph with the texture of real iPhone footage. Generate a close portrait, as one frame cut out of video actually shot on an iPhone: genuinely real rather than glossy, carrying the texture of video and not of a posed photograph. The background stays clearly visible, with no depth-of-field blur. Skin texture is fine and real, the light is natural, and no part of the picture is broken. olive-skinned French-Algerian footballer in his mid-thirties with a broad square face, dark brown eyes, thick brows, a strong nose, heavy jaw, and a full dense beard. His head is shaved close; he has a thick neck, very broad muscular shoulders, and a calm serious expression. He wears a plain white shirt.. Keep the portrait centered, shoulders visible, and use a simple neutral background with no readable text or logos.</text:Value>
<gpt:Image id="benzema-icon" prompt={benzema-icon-prompt} aspect-ratio="1:1" resolution="1K"/>
- <!-- Real Seedance Takes use explicit fixed ten-second requests. These
- estimates belong only to the optional static preview candidates. -->
+ <!-- The performed media supplies actual word timing. -->
<text:Value id="ronaldo-action">
Keep the handheld microphone in the same hand throughout, and use only the free hand for gestures. At the opening, widen his eyes and nod emphatically as he begins speaking. On "hair gel", deliberately run the free hand over his hair. On "Greek god", react with exaggerated surprise. On "Greek tragedy", shake his head with a mocking laugh. On "But hey", lean his body forward and raise the free index finger as if he has just thought of something. On the final sentence, give a sarcastic shrug.
@@ -196,29 +194,14 @@
<whisperx:SemanticTake id="messi-semantic" narrative={story}
segment={story.segment.messi} media={messi-media.media} language="en"/>
- <!-- Preview candidate path: the authored presenter image is formally encoded
- as a silent MP4, normalized through the same waist, then given an honest
- syllable-weighted estimated alignment over its complete frame count. -->
- <pipeline:StillVideo id="ronaldo-still" source={presenter.image}
- duration="10" clock={clock}/>
- <pipeline:StillVideo id="messi-still" source={presenter.image}
- duration="9" clock={clock}/>
- <pipeline:Normalize id="ronaldo-preview-media" source={ronaldo-still.video}
- video="primary-moving" audio="none" span-authority="video" clock={clock}/>
- <pipeline:Normalize id="messi-preview-media" source={messi-still.video}
- video="primary-moving" audio="none" span-authority="video" clock={clock}/>
- <estimated:SemanticTake id="ronaldo-preview" narrative={story}
- segment={story.segment.ronaldo} media={ronaldo-preview-media.media}
- language="en" pace="normal" rounding="round"/>
- <estimated:SemanticTake id="messi-preview" narrative={story}
- segment={story.segment.messi} media={messi-preview-media.media}
- language="en" pace="normal" rounding="round"/>
-
- <speech:Track id="speech" visual-frame={speech-frame}
- visual-appearance={recipes.speech.visual} visual-z="0">
+ <speech:Track id="speech">
<speech:Take source={ronaldo-semantic.take}/>
<speech:Take source={messi-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={speech-frame}
+ appearance={recipes.media.performance}/>
+ </media-track:Track>
<audio-track:Track id="music-bed" semantic={speech.semantic}>
<audio-track:Clip source={soundtrack-media.media} during="program"
playback="once-start" gain="0.12" fade-in="300ms" fade-out="600ms"/>
@@ -294,7 +277,7 @@
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={football-tiers.visual}/>
<film:Track source={football-tiers.audio}/>
diff --git a/examples/ranking-football/reference-gpt.svml b/examples/ranking-football/reference-gpt.svml
index 2ed06ac6..efaa5664 100644
--- a/examples/ranking-football/reference-gpt.svml
+++ b/examples/ranking-football/reference-gpt.svml
@@ -7,7 +7,6 @@
<import as="gpt" from="@hypit/gpt-image@1"/>
<import as="seedance" from="@hypit/seedance@1"/>
<import as="pipeline" from="@hypit/media-pipeline@1"/>
- <import as="estimated" from="@hypit/semantic-take-estimate@1"/>
<import as="whisperx" from="@hypit/whisperx@1"/>
<import as="speech" from="@hypit/speech-track@1"/>
<import as="media-track" from="@hypit/media-track@1"/>
@@ -37,8 +36,6 @@
<text:Value id="presenter-prompt">A photograph with the texture of real iPhone footage. Generate a vertical medium close-up, as one frame cut out of video actually shot on an iPhone: genuinely real rather than glossy, carrying the texture of video and not of a posed photograph. The background stays clearly visible, with no depth-of-field blur. Skin texture is fine and real, the light is natural, and no part of the picture is broken. A pale young woman with a narrow oval face, large gray eyes, straight brows, long jet-black hair with blunt bangs, and a slim shoulder line wears a black spiked cap, black choker, layered silver necklaces, and a black graphic top while holding a furry microphone. Keep her face, hair, shoulders, and microphone visible.</text:Value>
<gpt:Image id="presenter" prompt={presenter-prompt} aspect-ratio="9:16" resolution="2K"/>
- <text:Value id="presenter-mock-prompt">A photograph with the texture of real iPhone footage. Generate a vertical image, as one frame cut out of video actually shot on an iPhone: genuinely real rather than glossy, carrying the texture of video and not of a posed photograph. The background stays clearly visible, with no depth-of-field blur. Skin texture is fine and real, the light is natural, and no part of the picture is broken. A realistic vertical portrait of a charismatic football commentator with medium-brown skin, dark wavy hair, expressive brown eyes, and a neatly trimmed beard, holding a microphone in a moody studio, natural skin texture, no text, no logos.</text:Value>
- <gpt:Image id="presenter-mock" prompt={presenter-mock-prompt} aspect-ratio="9:16" resolution="1K"/>
<asset:Audio id="presenter-voice" src="./assets/goth.wav"/>
<asset:Audio id="soundtrack" src="./assets/shared-soundtrack.m4a"/>
<asset:Audio id="ranking-appear-sfx" src="./assets/ranking-appear.wav"/>
@@ -66,8 +63,7 @@
<gpt:Image id="neymar-icon" prompt={neymar-icon-prompt} aspect-ratio="1:1" resolution="1K"/>
<gpt:Image id="benzema-icon" prompt={benzema-icon-prompt} aspect-ratio="1:1" resolution="1K"/>
- <!-- Real Seedance Takes use explicit fixed ten-second requests. These
- estimates belong only to the optional static preview candidates. -->
+ <!-- The performed media supplies actual word timing. -->
<text:Value id="ronaldo-action">
Keep the handheld microphone in the same hand throughout, and use only the free hand for gestures. At the opening, widen his eyes and nod emphatically as he begins speaking. On "hair gel", deliberately run the free hand over his hair. On "Greek god", react with exaggerated surprise. On "Greek tragedy", shake his head with a mocking laugh. On "But hey", lean his body forward and raise the free index finger as if he has just thought of something. On the final sentence, give a sarcastic shrug.
@@ -198,29 +194,14 @@
<whisperx:SemanticTake id="messi-semantic" narrative={story}
segment={story.segment.messi} media={messi-media.media} language="en"/>
- <!-- Preview candidate path: the authored presenter image is formally encoded
- as a silent MP4, normalized through the same waist, then given an honest
- syllable-weighted estimated alignment over its complete frame count. -->
- <pipeline:StillVideo id="ronaldo-still" source={presenter-mock.image}
- duration="10" clock={clock}/>
- <pipeline:StillVideo id="messi-still" source={presenter-mock.image}
- duration="9" clock={clock}/>
- <pipeline:Normalize id="ronaldo-preview-media" source={ronaldo-still.video}
- video="primary-moving" audio="none" span-authority="video" clock={clock}/>
- <pipeline:Normalize id="messi-preview-media" source={messi-still.video}
- video="primary-moving" audio="none" span-authority="video" clock={clock}/>
- <estimated:SemanticTake id="ronaldo-preview" narrative={story}
- segment={story.segment.ronaldo} media={ronaldo-preview-media.media}
- language="en" pace="normal" rounding="round"/>
- <estimated:SemanticTake id="messi-preview" narrative={story}
- segment={story.segment.messi} media={messi-preview-media.media}
- language="en" pace="normal" rounding="round"/>
-
- <speech:Track id="speech" visual-frame={speech-frame}
- visual-appearance={recipes.speech.visual} visual-z="0">
+ <speech:Track id="speech">
<speech:Take source={ronaldo-semantic.take}/>
<speech:Take source={messi-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={speech-frame}
+ appearance={recipes.media.performance}/>
+ </media-track:Track>
<audio-track:Track id="music-bed" semantic={speech.semantic}>
<audio-track:Clip source={soundtrack-media.media} during="program"
playback="once-start" gain="0.12" fade-in="300ms" fade-out="600ms"/>
@@ -296,7 +277,7 @@
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={football-tiers.visual}/>
<film:Track source={football-tiers.audio}/>
diff --git a/examples/ranking-football/reference.svml b/examples/ranking-football/reference.svml
index 3f9cdfb2..8f6cb129 100644
--- a/examples/ranking-football/reference.svml
+++ b/examples/ranking-football/reference.svml
@@ -221,11 +221,14 @@
<whisperx:SemanticTake id="messi-semantic" narrative={story}
segment={story.segment.messi} media={messi-media.media} language="en"/>
- <speech:Track id="speech" visual-frame={speech-frame}
- visual-appearance={recipes.speech.visual} visual-z="0">
+ <speech:Track id="speech">
<speech:Take source={ronaldo-semantic.take}/>
<speech:Take source={messi-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={speech-frame}
+ appearance={recipes.media.performance}/>
+ </media-track:Track>
<audio-track:Track id="music-bed" semantic={speech.semantic}>
<audio-track:Clip source={soundtrack-media.media} during="program"
playback="once-start" gain="0.12" fade-in="300ms" fade-out="600ms"/>
@@ -301,7 +304,7 @@
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={football-tiers.visual}/>
<film:Track source={football-tiers.audio}/>
diff --git a/examples/ranking-football/swap-effect-banana-reference-sync/column-recipes.svs b/examples/ranking-football/swap-effect-banana-reference-sync/column-recipes.svs
index 850c9c39..fb45e3d0 100644
--- a/examples/ranking-football/swap-effect-banana-reference-sync/column-recipes.svs
+++ b/examples/ranking-football/swap-effect-banana-reference-sync/column-recipes.svs
@@ -11,7 +11,7 @@
film.vertical { background: #090A0F; }
- speech.visual {
+ media.performance { stack-order: 0;
fit: cover;
frame-x: 0.5;
frame-y: 0.5;
diff --git a/examples/ranking-football/swap-effect-banana-reference-sync/hybrid-recipes.svs b/examples/ranking-football/swap-effect-banana-reference-sync/hybrid-recipes.svs
index b870b550..72106b70 100644
--- a/examples/ranking-football/swap-effect-banana-reference-sync/hybrid-recipes.svs
+++ b/examples/ranking-football/swap-effect-banana-reference-sync/hybrid-recipes.svs
@@ -11,7 +11,7 @@
film.vertical { background: #090A0F; }
- speech.visual {
+ media.performance { stack-order: 0;
fit: cover;
frame-x: 0.5;
frame-y: 0.5;
diff --git a/examples/ranking-football/swap-effect-banana-reference-sync/swap-effect-banana-reference-sync.svml b/examples/ranking-football/swap-effect-banana-reference-sync/swap-effect-banana-reference-sync.svml
index 09482d87..6a835470 100644
--- a/examples/ranking-football/swap-effect-banana-reference-sync/swap-effect-banana-reference-sync.svml
+++ b/examples/ranking-football/swap-effect-banana-reference-sync/swap-effect-banana-reference-sync.svml
@@ -7,7 +7,6 @@
<import as="gpt" from="@hypit/gpt-image@1"/>
<import as="seedance" from="@hypit/seedance@1"/>
<import as="pipeline" from="@hypit/media-pipeline@1"/>
- <import as="estimated" from="@hypit/semantic-take-estimate@1"/>
<import as="whisperx" from="@hypit/whisperx@1"/>
<import as="speech" from="@hypit/speech-track@1"/>
<import as="media-track" from="@hypit/media-track@1"/>
@@ -64,8 +63,7 @@
<text:Value id="benzema-icon-prompt">A photograph with the texture of real iPhone footage. Generate a close portrait, as one frame cut out of video actually shot on an iPhone: genuinely real rather than glossy, carrying the texture of video and not of a posed photograph. The background stays clearly visible, with no depth-of-field blur. Skin texture is fine and real, the light is natural, and no part of the picture is broken. olive-skinned French-Algerian footballer in his mid-thirties with a broad square face, dark brown eyes, thick brows, a strong nose, heavy jaw, and a full dense beard. His head is shaved close; he has a thick neck, very broad muscular shoulders, and a calm serious expression. He wears a plain white shirt.. Keep the portrait centered, shoulders visible, and use a simple neutral background with no readable text or logos.</text:Value>
<gpt:Image id="benzema-icon" prompt={benzema-icon-prompt} aspect-ratio="1:1" resolution="1K"/>
- <!-- Real Seedance Takes use explicit fixed ten-second requests. These
- estimates belong only to the optional static preview candidates. -->
+ <!-- The performed media supplies actual word timing. -->
<text:Value id="ronaldo-action">
Keep the handheld microphone in the same hand throughout, and use only the free hand for gestures. At the opening, widen his eyes and nod emphatically as he begins speaking. On "hair gel", deliberately run the free hand over his hair. On "Greek god", react with exaggerated surprise. On "Greek tragedy", shake his head with a mocking laugh. On "But hey", lean his body forward and raise the free index finger as if he has just thought of something. On the final sentence, give a sarcastic shrug.
@@ -196,29 +194,14 @@
<whisperx:SemanticTake id="messi-semantic" narrative={story}
segment={story.segment.messi} media={messi-media.media} language="en"/>
- <!-- Preview candidate path: the authored presenter image is formally encoded
- as a silent MP4, normalized through the same waist, then given an honest
- syllable-weighted estimated alignment over its complete frame count. -->
- <pipeline:StillVideo id="ronaldo-still" source={presenter.image}
- duration="10" clock={clock}/>
- <pipeline:StillVideo id="messi-still" source={presenter.image}
- duration="9" clock={clock}/>
- <pipeline:Normalize id="ronaldo-preview-media" source={ronaldo-still.video}
- video="primary-moving" audio="none" span-authority="video" clock={clock}/>
- <pipeline:Normalize id="messi-preview-media" source={messi-still.video}
- video="primary-moving" audio="none" span-authority="video" clock={clock}/>
- <estimated:SemanticTake id="ronaldo-preview" narrative={story}
- segment={story.segment.ronaldo} media={ronaldo-preview-media.media}
- language="en" pace="normal" rounding="round"/>
- <estimated:SemanticTake id="messi-preview" narrative={story}
- segment={story.segment.messi} media={messi-preview-media.media}
- language="en" pace="normal" rounding="round"/>
-
- <speech:Track id="speech" visual-frame={speech-frame}
- visual-appearance={recipes.speech.visual} visual-z="0">
+ <speech:Track id="speech">
<speech:Take source={ronaldo-semantic.take}/>
<speech:Take source={messi-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={speech-frame}
+ appearance={recipes.media.performance}/>
+ </media-track:Track>
<audio-track:Track id="music-bed" semantic={speech.semantic}>
<audio-track:Clip source={soundtrack-media.media} during="program"
playback="once-start" gain="0.12" fade-in="300ms" fade-out="600ms"/>
@@ -293,7 +276,7 @@
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={football-column.visual}/>
<film:Track source={football-column.audio}/>
diff --git a/examples/ranking-football/swap-effect-banana/column-recipes.svs b/examples/ranking-football/swap-effect-banana/column-recipes.svs
index 850c9c39..fb45e3d0 100644
--- a/examples/ranking-football/swap-effect-banana/column-recipes.svs
+++ b/examples/ranking-football/swap-effect-banana/column-recipes.svs
@@ -11,7 +11,7 @@
film.vertical { background: #090A0F; }
- speech.visual {
+ media.performance { stack-order: 0;
fit: cover;
frame-x: 0.5;
frame-y: 0.5;
diff --git a/examples/ranking-football/swap-effect-banana/swap-effect-banana.svml b/examples/ranking-football/swap-effect-banana/swap-effect-banana.svml
index c859597a..8d6ecb11 100644
--- a/examples/ranking-football/swap-effect-banana/swap-effect-banana.svml
+++ b/examples/ranking-football/swap-effect-banana/swap-effect-banana.svml
@@ -7,7 +7,6 @@
<import as="gpt" from="@hypit/gpt-image@1"/>
<import as="seedance" from="@hypit/seedance@1"/>
<import as="pipeline" from="@hypit/media-pipeline@1"/>
- <import as="estimated" from="@hypit/semantic-take-estimate@1"/>
<import as="whisperx" from="@hypit/whisperx@1"/>
<import as="speech" from="@hypit/speech-track@1"/>
<import as="media-track" from="@hypit/media-track@1"/>
@@ -61,7 +60,6 @@
<text:Value id="neymar-icon-prompt">A photograph with the texture of real iPhone footage. Generate a close portrait, as one frame cut out of video actually shot on an iPhone: genuinely real rather than glossy, carrying the texture of video and not of a posed photograph. The background stays clearly visible, with no depth-of-field blur. Skin texture is fine and real, the light is natural, and no part of the picture is broken. tan Brazilian footballer in his early thirties with an oval face, expressive brown eyes, thick brows, a straight nose, defined cheekbones, and a neatly trimmed beard and mustache. His short dark hair has faded sides and a textured top swept slightly back; he has an athletic neck and shoulders and a lively expression. He wears a plain yellow shirt.. Keep the portrait centered, shoulders visible, and use a simple neutral background with no readable text or logos.</text:Value>
<gpt:Image id="neymar-icon" prompt={neymar-icon-prompt} aspect-ratio="1:1" resolution="1K"/>
-
<text:Value id="messi-action">
Keep the handheld microphone in the same hand throughout and use only the free hand for gestures. On "Messi is the bottom", lower the free palm toward the floor and give one deadpan downward nod. On "Five foot seven", hold the free hand low as if marking a short height. Give three small counting beats through "no muscles, no speed, just vibes", ending with a loose shoulder shrug and an amused half-smile on "just vibes". On "Man walks around", slowly draw a lazy circle in the air. On "lost in IKEA", glance left and right with a puzzled squint, then point uncertainly off frame. On "retirement home", briefly hunch the shoulders and mime one slow old-man step with the free hand before finishing with a knowing smirk.
</text:Value>
@@ -178,26 +176,14 @@
<whisperx:SemanticTake id="ronaldo-semantic" narrative={story}
segment={story.segment.ronaldo} media={ronaldo-media.media} language="en"/>
- <pipeline:StillVideo id="messi-still" source={presenter.image}
- duration="10" clock={clock}/>
- <pipeline:StillVideo id="ronaldo-still" source={presenter.image}
- duration="10" clock={clock}/>
- <pipeline:Normalize id="messi-preview-media" source={messi-still.video}
- video="primary-moving" audio="none" span-authority="video" clock={clock}/>
- <pipeline:Normalize id="ronaldo-preview-media" source={ronaldo-still.video}
- video="primary-moving" audio="none" span-authority="video" clock={clock}/>
- <estimated:SemanticTake id="messi-preview" narrative={story}
- segment={story.segment.messi} media={messi-preview-media.media}
- language="en" pace="normal" rounding="round"/>
- <estimated:SemanticTake id="ronaldo-preview" narrative={story}
- segment={story.segment.ronaldo} media={ronaldo-preview-media.media}
- language="en" pace="normal" rounding="round"/>
-
- <speech:Track id="speech" visual-frame={speech-frame}
- visual-appearance={recipes.speech.visual} visual-z="0">
+ <speech:Track id="speech">
<speech:Take source={messi-semantic.take}/>
<speech:Take source={ronaldo-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={speech-frame}
+ appearance={recipes.media.performance}/>
+ </media-track:Track>
<audio-track:Track id="music-bed" semantic={speech.semantic}>
<audio-track:Clip source={soundtrack-media.media} during="program"
playback="once-start" gain="0.12" fade-in="300ms" fade-out="600ms"/>
@@ -273,7 +259,7 @@
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={football-column.visual}/>
<film:Track source={football-column.audio}/>
diff --git a/examples/ranking-football/swap-effect.svml b/examples/ranking-football/swap-effect.svml
index 7dd77426..1a38d239 100644
--- a/examples/ranking-football/swap-effect.svml
+++ b/examples/ranking-football/swap-effect.svml
@@ -7,7 +7,6 @@
<import as="gpt" from="@hypit/gpt-image@1"/>
<import as="seedance" from="@hypit/seedance@1"/>
<import as="pipeline" from="@hypit/media-pipeline@1"/>
- <import as="estimated" from="@hypit/semantic-take-estimate@1"/>
<import as="whisperx" from="@hypit/whisperx@1"/>
<import as="speech" from="@hypit/speech-track@1"/>
<import as="media-track" from="@hypit/media-track@1"/>
@@ -61,7 +60,6 @@
<text:Value id="neymar-icon-prompt">A photograph with the texture of real iPhone footage. Generate a close portrait, as one frame cut out of video actually shot on an iPhone: genuinely real rather than glossy, carrying the texture of video and not of a posed photograph. The background stays clearly visible, with no depth-of-field blur. Skin texture is fine and real, the light is natural, and no part of the picture is broken. tan Brazilian footballer in his early thirties with an oval face, expressive brown eyes, thick brows, a straight nose, defined cheekbones, and a neatly trimmed beard and mustache. His short dark hair has faded sides and a textured top swept slightly back; he has an athletic neck and shoulders and a lively expression. He wears a plain yellow shirt.. Keep the portrait centered, shoulders visible, and use a simple neutral background with no readable text or logos.</text:Value>
<gpt:Image id="neymar-icon" prompt={neymar-icon-prompt} aspect-ratio="1:1" resolution="1K"/>
-
<text:Value id="messi-action">
Keep the handheld microphone in the same hand throughout and use only the free hand for gestures. On "Messi is the bottom", lower the free palm toward the floor and give one deadpan downward nod. On "Five foot seven", hold the free hand low as if marking a short height. Give three small counting beats through "no muscles, no speed, just vibes", ending with a loose shoulder shrug and an amused half-smile on "just vibes". On "Man walks around", slowly draw a lazy circle in the air. On "lost in IKEA", glance left and right with a puzzled squint, then point uncertainly off frame. On "retirement home", briefly hunch the shoulders and mime one slow old-man step with the free hand before finishing with a knowing smirk.
</text:Value>
@@ -178,26 +176,14 @@
<whisperx:SemanticTake id="ronaldo-semantic" narrative={story}
segment={story.segment.ronaldo} media={ronaldo-media.media} language="en"/>
- <pipeline:StillVideo id="messi-still" source={presenter.image}
- duration="10" clock={clock}/>
- <pipeline:StillVideo id="ronaldo-still" source={presenter.image}
- duration="10" clock={clock}/>
- <pipeline:Normalize id="messi-preview-media" source={messi-still.video}
- video="primary-moving" audio="none" span-authority="video" clock={clock}/>
- <pipeline:Normalize id="ronaldo-preview-media" source={ronaldo-still.video}
- video="primary-moving" audio="none" span-authority="video" clock={clock}/>
- <estimated:SemanticTake id="messi-preview" narrative={story}
- segment={story.segment.messi} media={messi-preview-media.media}
- language="en" pace="normal" rounding="round"/>
- <estimated:SemanticTake id="ronaldo-preview" narrative={story}
- segment={story.segment.ronaldo} media={ronaldo-preview-media.media}
- language="en" pace="normal" rounding="round"/>
-
- <speech:Track id="speech" visual-frame={speech-frame}
- visual-appearance={recipes.speech.visual} visual-z="0">
+ <speech:Track id="speech">
<speech:Take source={messi-semantic.take}/>
<speech:Take source={ronaldo-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={speech-frame}
+ appearance={recipes.media.performance}/>
+ </media-track:Track>
<audio-track:Track id="music-bed" semantic={speech.semantic}>
<audio-track:Clip source={soundtrack-media.media} during="program"
playback="once-start" gain="0.12" fade-in="300ms" fade-out="600ms"/>
@@ -273,7 +259,7 @@
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={football-column.visual}/>
<film:Track source={football-column.audio}/>
diff --git a/examples/ranking-football/swap-host.svml b/examples/ranking-football/swap-host.svml
index 9d6938ff..4174148a 100644
--- a/examples/ranking-football/swap-host.svml
+++ b/examples/ranking-football/swap-host.svml
@@ -7,7 +7,6 @@
<import as="gpt" from="@hypit/gpt-image@1"/>
<import as="seedance" from="@hypit/seedance@1"/>
<import as="pipeline" from="@hypit/media-pipeline@1"/>
- <import as="estimated" from="@hypit/semantic-take-estimate@1"/>
<import as="whisperx" from="@hypit/whisperx@1"/>
<import as="speech" from="@hypit/speech-track@1"/>
<import as="media-track" from="@hypit/media-track@1"/>
@@ -64,8 +63,7 @@
<text:Value id="benzema-icon-prompt">A photograph with the texture of real iPhone footage. Generate a close portrait, as one frame cut out of video actually shot on an iPhone: genuinely real rather than glossy, carrying the texture of video and not of a posed photograph. The background stays clearly visible, with no depth-of-field blur. Skin texture is fine and real, the light is natural, and no part of the picture is broken. olive-skinned French-Algerian footballer in his mid-thirties with a broad square face, dark brown eyes, thick brows, a strong nose, heavy jaw, and a full dense beard. His head is shaved close; he has a thick neck, very broad muscular shoulders, and a calm serious expression. He wears a plain white shirt.. Keep the portrait centered, shoulders visible, and use a simple neutral background with no readable text or logos.</text:Value>
<gpt:Image id="benzema-icon" prompt={benzema-icon-prompt} aspect-ratio="1:1" resolution="1K"/>
- <!-- Real Seedance Takes use explicit fixed ten-second requests. These
- estimates belong only to the optional static preview candidates. -->
+ <!-- The performed media supplies actual word timing. -->
<text:Value id="ronaldo-action">
Keep the handheld microphone in the same hand throughout, and use only the free hand for gestures. At the opening, widen his eyes and nod emphatically as he begins speaking. On "hair gel", deliberately run the free hand over his hair. On "Greek god", react with exaggerated surprise. On "Greek tragedy", shake his head with a mocking laugh. On "But hey", lean his body forward and raise the free index finger as if he has just thought of something. On the final sentence, give a sarcastic shrug.
@@ -196,29 +194,14 @@
<whisperx:SemanticTake id="messi-semantic" narrative={story}
segment={story.segment.messi} media={messi-media.media} language="en"/>
- <!-- Preview candidate path: the authored presenter image is formally encoded
- as a silent MP4, normalized through the same waist, then given an honest
- syllable-weighted estimated alignment over its complete frame count. -->
- <pipeline:StillVideo id="ronaldo-still" source={presenter.image}
- duration="10" clock={clock}/>
- <pipeline:StillVideo id="messi-still" source={presenter.image}
- duration="9" clock={clock}/>
- <pipeline:Normalize id="ronaldo-preview-media" source={ronaldo-still.video}
- video="primary-moving" audio="none" span-authority="video" clock={clock}/>
- <pipeline:Normalize id="messi-preview-media" source={messi-still.video}
- video="primary-moving" audio="none" span-authority="video" clock={clock}/>
- <estimated:SemanticTake id="ronaldo-preview" narrative={story}
- segment={story.segment.ronaldo} media={ronaldo-preview-media.media}
- language="en" pace="normal" rounding="round"/>
- <estimated:SemanticTake id="messi-preview" narrative={story}
- segment={story.segment.messi} media={messi-preview-media.media}
- language="en" pace="normal" rounding="round"/>
-
- <speech:Track id="speech" visual-frame={speech-frame}
- visual-appearance={recipes.speech.visual} visual-z="0">
+ <speech:Track id="speech">
<speech:Take source={ronaldo-semantic.take}/>
<speech:Take source={messi-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={speech-frame}
+ appearance={recipes.media.performance}/>
+ </media-track:Track>
<audio-track:Track id="music-bed" semantic={speech.semantic}>
<audio-track:Clip source={soundtrack-media.media} during="program"
playback="once-start" gain="0.12" fade-in="300ms" fade-out="600ms"/>
@@ -294,7 +277,7 @@
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={football-tiers.visual}/>
<film:Track source={football-tiers.audio}/>
diff --git a/examples/ranking-football/swap-topic.svml b/examples/ranking-football/swap-topic.svml
index 7a2a8eb5..019d801e 100644
--- a/examples/ranking-football/swap-topic.svml
+++ b/examples/ranking-football/swap-topic.svml
@@ -7,7 +7,6 @@
<import as="gpt" from="@hypit/gpt-image@1"/>
<import as="seedance" from="@hypit/seedance@1"/>
<import as="pipeline" from="@hypit/media-pipeline@1"/>
- <import as="estimated" from="@hypit/semantic-take-estimate@1"/>
<import as="whisperx" from="@hypit/whisperx@1"/>
<import as="speech" from="@hypit/speech-track@1"/>
<import as="media-track" from="@hypit/media-track@1"/>
@@ -59,7 +58,6 @@
<text:Value id="jack-icon-prompt">A photograph with the texture of real iPhone footage. Generate a close portrait, as one frame cut out of video actually shot on an iPhone: genuinely real rather than glossy, carrying the texture of video and not of a posed photograph. The background stays clearly visible, with no depth-of-field blur. Skin texture is fine and real, the light is natural, and no part of the picture is broken. fair-skinned young technology executive with short brown hair, narrow face, and slim athletic shoulder line, wearing a plain dark shirt. Keep the portrait centered, shoulders visible, and use a simple neutral background with no readable text or logos.</text:Value>
<gpt:Image id="jack-icon" prompt={jack-icon-prompt} aspect-ratio="1:1" resolution="1K"/>
-
<text:Value id="elon-action">
Keep the handheld microphone in the same hand throughout and use only the free hand for gestures. Open "Elon is D tier" with a skeptical look, lower the free palm decisively, and finish the verdict with one dry downward nod. On "44 billion dollars", rub the free thumb against two fingers in a clear money gesture while widening the eyes at the number. On "change the name", turn the free palm over once as if replacing one label with another, then give a disbelieving side glance. On "Sends rockets to Mars", sweep the free hand upward in a smooth launch arc and follow it briefly with the eyes. Across "can't send a tweet without crashing the stock market", tap the air once like posting, then snap the gaze downward and grimace as the free hand drops sharply. On "Richest guy on Earth", open the free arm with exaggerated confidence and a smug half-smile. On "good haircut", lightly touch the top of the hair once, pull the hand away, and finish with a mocking wince.
</text:Value>
@@ -221,26 +219,14 @@
<whisperx:SemanticTake id="sam-semantic" narrative={story}
segment={story.segment.sam} media={sam-media.media} language="en"/>
- <pipeline:StillVideo id="elon-still" source={presenter.image}
- duration="11" clock={clock}/>
- <pipeline:StillVideo id="sam-still" source={presenter.image}
- duration="12" clock={clock}/>
- <pipeline:Normalize id="elon-preview-media" source={elon-still.video}
- video="primary-moving" audio="none" span-authority="video" clock={clock}/>
- <pipeline:Normalize id="sam-preview-media" source={sam-still.video}
- video="primary-moving" audio="none" span-authority="video" clock={clock}/>
- <estimated:SemanticTake id="elon-preview" narrative={story}
- segment={story.segment.elon} media={elon-preview-media.media}
- language="en" pace="normal" rounding="round"/>
- <estimated:SemanticTake id="sam-preview" narrative={story}
- segment={story.segment.sam} media={sam-preview-media.media}
- language="en" pace="normal" rounding="round"/>
-
- <speech:Track id="speech" visual-frame={speech-frame}
- visual-appearance={recipes.speech.visual} visual-z="0">
+ <speech:Track id="speech">
<speech:Take source={elon-semantic.take}/>
<speech:Take source={sam-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={speech-frame}
+ appearance={recipes.media.performance}/>
+ </media-track:Track>
<audio-track:Track id="music-bed" semantic={speech.semantic}>
<audio-track:Clip source={soundtrack-media.media} during="program"
playback="once-start" gain="0.12" fade-in="300ms" fade-out="600ms"/>
@@ -332,7 +318,7 @@
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={tech-tiers.visual}/>
<film:Track source={tech-tiers.audio}/>
diff --git a/examples/ranking-football/tech-tier-recipes.svs b/examples/ranking-football/tech-tier-recipes.svs
index 84512e45..a4930eba 100644
--- a/examples/ranking-football/tech-tier-recipes.svs
+++ b/examples/ranking-football/tech-tier-recipes.svs
@@ -11,7 +11,7 @@
film.vertical { background: #090A0F; }
- speech.visual {
+ media.performance { stack-order: 0;
fit: cover;
frame-x: 0.5;
frame-y: 0.5;
diff --git a/examples/ranking-football/tier-banana-recipes.svs b/examples/ranking-football/tier-banana-recipes.svs
index 9f70519f..84f798ff 100644
--- a/examples/ranking-football/tier-banana-recipes.svs
+++ b/examples/ranking-football/tier-banana-recipes.svs
@@ -11,7 +11,7 @@
film.vertical { background: #090A0F; }
- speech.visual {
+ media.performance { stack-order: 0;
fit: cover;
frame-x: 0.5;
frame-y: 0.5;
diff --git a/examples/semantic-composition/README.md b/examples/semantic-composition/README.md
new file mode 100644
index 00000000..1282b299
--- /dev/null
+++ b/examples/semantic-composition/README.md
@@ -0,0 +1,14 @@
+# Semantic composition
+
+`packages/responsive-explainer` is an ordinary project component. Its video viewport moves from
+full screen into a side portrait while a diagram appears in the space it releases. The same prepared
+video continues playing. A projected Moment triggers the layout change; an independently projected
+Window defines the scene's lifetime. Captions and other independent contributions can remain peers.
+
+The package demonstrates HTML, CSS, SVG and frame-driven JavaScript inside one VisualTrack Present,
+with typed child video sampling and exact-font text. It uses public `hypit/*` imports. No component
+name is registered in Core or in the renderer.
+
+Copy the package into a video's `packages/`, select the installed Hypit version for its development
+dependency, build it and declare it in the project's ordinary package configuration. The package
+README shows its Source use and explains the timing and material boundaries.
diff --git a/examples/semantic-composition/packages/responsive-explainer/README.md b/examples/semantic-composition/packages/responsive-explainer/README.md
new file mode 100644
index 00000000..d8dfffcd
--- /dev/null
+++ b/examples/semantic-composition/packages/responsive-explainer/README.md
@@ -0,0 +1,45 @@
+# Responsive explainer
+
+One scene coordinates a playing performance and the diagram it makes room for. This intentionally
+small example can be adapted to the video's own visual idea; its HTML and motion live in `src/render.ts`.
+
+With prepared Takes, a Canvas and an exact FontStack already available:
+
+```svml
+<import as="explainer" from="@example/responsive-explainer@1"/>
+
+<speech:Track id="speech">
+ <speech:Take source={opening.take}/>
+ <speech:Take source={explanation.take}/>
+</speech:Track>
+<explainer:Scene id="scene" semantic={speech.semantic} canvas={canvas} font={font}
+ during="program" reveal={story.moment.demonstrate} title="Make room for meaning"
+ transition-frames="24" stack-order="0"/>
+<film:Film id="main" canvas={canvas} semantic={speech.semantic} appearance={look.film}>
+ <film:Track source={scene.visual}/>
+ <film:Track source={speech.audio}/>
+ <film:Track source={captions.track}/>
+</film:Film>
+```
+
+`during` also accepts a Script Selection or Segment; the shared Window syntax supports other authored
+intervals. `reveal` selects a Script Moment, such as `@demonstrate!` before the relevant word. Rewriting
+the Script or using another delivery changes the projected frame while retaining the layout behavior.
+`transition-frames` is the duration of that change, separate from the scene's lifetime. `stack-order`
+places this scene among other contributions. The caller supplies its title and exact fonts.
+
+`projectSemanticMedia` selects all intersecting prepared Takes. Each video's target interval is
+Present-local and its source offset is preserved. The parent viewport changes size and position;
+playback is never restarted by the layout change. The component owns the diagram and the viewport,
+so its internal overlap, rounded clipping and backdrop blur are ordinary HTML/CSS relationships.
+The original audio stays independently selectable as `speech.audio`.
+
+`src/activation.ts` declares the Module, Surface, semantic projections and Producer Fragment.
+`src/render.ts` emits a browser program with HTML slots for typed video and text children. Its render
+function computes state directly from local frame time, supporting direct seeking, range renders
+and independent workers.
+
+The package builds against `hypit` and emits JavaScript. In a standalone project, replace the
+repository's `workspace:*` development dependency with the Hypit version you use. Run `npm run build`
+and connect this directory through an ordinary `file:` dependency during development. Cross-project
+sharing can use a tarball or a versioned package under the owner's scope.
diff --git a/examples/semantic-composition/packages/responsive-explainer/package.json b/examples/semantic-composition/packages/responsive-explainer/package.json
new file mode 100644
index 00000000..c84cfe94
--- /dev/null
+++ b/examples/semantic-composition/packages/responsive-explainer/package.json
@@ -0,0 +1,11 @@
+{
+ "name": "@example/responsive-explainer",
+ "version": "0.0.0-dev",
+ "private": true,
+ "type": "module",
+ "hypit": { "activation": "./dist/activation.js" },
+ "exports": { ".": "./dist/render.js" },
+ "files": ["dist", "README.md"],
+ "scripts": { "build": "tsc -p tsconfig.json", "prepack": "npm run build" },
+ "devDependencies": { "hypit": "workspace:*", "typescript": "5.9.3", "@types/node": "24.10.1" }
+}
diff --git a/examples/semantic-composition/packages/responsive-explainer/src/activation.ts b/examples/semantic-composition/packages/responsive-explainer/src/activation.ts
new file mode 100644
index 00000000..23a09086
--- /dev/null
+++ b/examples/semantic-composition/packages/responsive-explainer/src/activation.ts
@@ -0,0 +1,90 @@
+import { assertAttributes, assertEmptyElement, canonicalize, createMarkupSurfaceHostFacet, sameType,
+ sealGraphFragment, textAttribute } from "hypit/author-kit";
+import type { ComponentPackage, ModuleManifest, StructuredSurfaceHandler, SurfaceResolvedReference, TypeRef } from "hypit/author-kit";
+import { compositionTypes } from "hypit/composition";
+import { mediaTypes } from "hypit/media";
+import type { FontStackRef } from "hypit/media";
+import { narrativeTypes } from "hypit/narrative";
+import { semanticTrackTypes } from "hypit/semantic-track";
+import type { SemanticTrack } from "hypit/semantic-track";
+import { spatialTypes } from "hypit/spatial";
+import type { CanvasSpace } from "hypit/spatial";
+import { temporalTypes } from "hypit/temporal";
+import type { TemporalInstant, TemporalWindow } from "hypit/temporal";
+import { createTemporalInstantProjection, createTemporalWindowProjection, temporalWindowAttributeNames,
+ temporalWindowAttributeVocabulary } from "hypit/temporal-markup";
+import { renderExplainer } from "./render.js";
+import type { ExplainerOptions } from "./render.js";
+
+const module = { name: "@example/responsive-explainer", version: "1" } as const;
+const optionsType = { module, name: "ExplainerOptions" };
+const producer = { module, name: "compose" };
+const inputs = [
+ { name: "semantic", type: semanticTrackTypes.track }, { name: "canvas", type: spatialTypes.canvas },
+ { name: "window", type: temporalTypes.window }, { name: "reveal", type: temporalTypes.instant },
+ { name: "font", type: mediaTypes.fontStack }, { name: "options", type: optionsType },
+];
+export const manifest: ModuleManifest = { format: "hypit.module@1", ...module,
+ dependencies: [compositionTypes.visualTrack, mediaTypes.fontStack, semanticTrackTypes.track,
+ spatialTypes.canvas, temporalTypes.window].map(type => ({ module: type.module })),
+ types: [{ name: optionsType.name }], capabilities: [],
+ producers: [{ name: producer.name, inputs, outputs: [{ name: "visual", type: compositionTypes.visualTrack }], needs: [] }],
+};
+const fragment = sealGraphFragment({ inputs, operations: [{ id: "compose", producer,
+ inputs: Object.fromEntries(inputs.map(input => [input.name, { kind: "fragment-input" as const, name: input.name }])),
+ result: { kind: "output", name: "visual" } }],
+ exports: [{ name: "visual", type: compositionTypes.visualTrack, root: { kind: "fragment-operation", operation: "compose" } }],
+});
+const inline = <T>(record: { value: { kind: string; value?: unknown } } | undefined): T => {
+ if (record?.value.kind !== "inline") throw new Error("Explainer inputs must be inline values.");
+ return record.value.value as T;
+};
+const component: ComponentPackage = { producers: [{ producer, handler: ({ inputs }) => ({ needs: {}, outputs: {
+ visual: { kind: "inline", value: canonicalize(renderExplainer(inline<SemanticTrack>(inputs.semantic),
+ inline<CanvasSpace>(inputs.canvas), inline<TemporalWindow>(inputs.window), inline<TemporalInstant>(inputs.reveal),
+ inline<FontStackRef>(inputs.font).faces, inline<ExplainerOptions>(inputs.options))) },
+} }) }] };
+export const decodeSurface: StructuredSurfaceHandler = ({ element, resolveReference }) => {
+ assertAttributes(element, ["id", "semantic", "canvas", "font", "reveal", "title", "transition-frames", "stack-order", ...temporalWindowAttributeNames]);
+ assertEmptyElement(element);
+ const id = textAttribute(element, "id");
+ const reference = (name: string, type: TypeRef): SurfaceResolvedReference => {
+ const raw = element.attributes[name];
+ if (typeof raw !== "object" || raw.kind !== "reference") throw new Error(`${name} must be a reference.`);
+ const value = resolveReference(raw.path);
+ if (value === undefined || !sameType(type, value.type)) throw new Error(`${name} has the wrong type.`);
+ return value;
+ };
+ const semantic = reference("semantic", semanticTrackTypes.track);
+ const window = createTemporalWindowProjection({ id: `${id}.window`, element, semantic, resolveReference });
+ // Reveal has its own Moment; the outer Window independently controls this scene's lifetime.
+ reference("reveal", narrativeTypes.moment);
+ const reveal = createTemporalInstantProjection({ id: `${id}.reveal`,
+ element: { ...element, attributes: { at: element.attributes.reveal! } }, semantic, resolveReference });
+ const options: ExplainerOptions = { id, title: textAttribute(element, "title"),
+ transitionFrames: Number(textAttribute(element, "transition-frames")), stackingOrder: Number(textAttribute(element, "stack-order")) };
+ return { records: [...window.records, ...reveal.records, { id: `${id}.options`, type: optionsType,
+ value: { kind: "inline", value: canonicalize(options) }, range: element.range }],
+ fragments: [...window.fragments, ...reveal.fragments, fragment],
+ components: [...window.components, ...reveal.components, { id, fragment: fragment.id,
+ inputs: { semantic: semantic.ref, canvas: reference("canvas", spatialTypes.canvas).ref,
+ font: reference("font", mediaTypes.fontStack).ref, window: window.ref, reveal: reveal.ref,
+ options: { kind: "record", id: `${id}.options` } }, outputs: { visual: `${id}.visual` }, range: element.range }],
+ exports: [`${id}.visual`] };
+};
+const declaration = { name: "scene", tag: "Scene", mode: "structured" as const,
+ outputs: [compositionTypes.visualTrack, temporalTypes.window, temporalTypes.instant, temporalTypes.windowSpec, temporalTypes.instantSpec, optionsType],
+ vocabulary: { summary: "A continuously playing performance makes room for a diagram on a semantic Moment.",
+ attributes: [
+ ...["id", "title", "transition-frames", "stack-order"].map(name => ({ name, kind: "literal" as const, required: true, summary: name })),
+ ...[{ name: "semantic", type: semanticTrackTypes.track }, { name: "canvas", type: spatialTypes.canvas },
+ { name: "font", type: mediaTypes.fontStack }, { name: "reveal", type: narrativeTypes.moment }]
+ .map(({ name, type }) => ({ name, kind: "reference" as const, required: true, accepts: [type], summary: name })),
+ ...temporalWindowAttributeVocabulary,
+ ], ports: [{ name: "visual", type: compositionTypes.visualTrack, summary: "The coordinated scene." }],
+ example: '<explainer:Scene id="scene" semantic={speech.semantic} canvas={canvas} font={font} during="program" reveal={story.moment.reveal} title="How it works" transition-frames="18" stack-order="0"/>',
+ },
+};
+export const hypitPackage = { format: "hypit.node-package@1" as const, modules: [{ manifest }], components: [component],
+ hostFacets: [createMarkupSurfaceHostFacet({ module, declaration, handler: decodeSurface })] };
+export default hypitPackage;
diff --git a/examples/semantic-composition/packages/responsive-explainer/src/render.ts b/examples/semantic-composition/packages/responsive-explainer/src/render.ts
new file mode 100644
index 00000000..43a20b2b
--- /dev/null
+++ b/examples/semantic-composition/packages/responsive-explainer/src/render.ts
@@ -0,0 +1,68 @@
+import { sealVisualTrack } from "hypit/composition";
+import type { VisualElement } from "hypit/composition";
+import { browserProgram } from "hypit/hyperframes";
+import type { FontArtifactRef } from "hypit/media";
+import { projectSemanticMedia, projectSemanticProgramSpace } from "hypit/semantic-track";
+import type { SemanticTrack } from "hypit/semantic-track";
+import type { CanvasSpace } from "hypit/spatial";
+import type { TemporalInstant, TemporalWindow } from "hypit/temporal";
+
+export type ExplainerOptions = { id: string; title: string; transitionFrames: number; stackingOrder: number };
+
+/** One scene owns the moving performance viewport and the diagram it makes room for. */
+export function renderExplainer(semantic: SemanticTrack, canvas: CanvasSpace, window: TemporalWindow,
+ reveal: TemporalInstant, fonts: readonly FontArtifactRef[], options: ExplainerOptions) {
+ const space = projectSemanticProgramSpace(semantic);
+ if (window.start.source.spaceId !== space.id || reveal.source.spaceId !== space.id)
+ throw new Error("Explainer timing must belong to its semantic performance.");
+ if (!Number.isSafeInteger(options.transitionFrames) || options.transitionFrames < 1)
+ throw new Error("Explainer transitionFrames must be a positive integer.");
+ const clips = projectSemanticMedia(semantic, window.span).filter(clip => clip.media.visual !== undefined);
+ const videos: VisualElement[] = clips.map((clip, i) => ({
+ id: `take-${i}`, parent: "scene", kind: "video", order: i + 1,
+ artifact: clip.media.visual!.artifact, muted: true,
+ style: [{ name: "position", value: "absolute" }, { name: "inset", value: 0 },
+ { name: "width", value: "100%" }, { name: "height", value: "100%" }, { name: "object-fit", value: "cover" }],
+ sampling: { sourceFrameRate: clip.media.timeline.frameRate, sourceFrameCount: clip.media.timeline.frameCount,
+ segments: [{ target: { startFrame: clip.span.startFrame - window.span.startFrame,
+ endFrameExclusive: clip.span.endFrameExclusive - window.span.startFrame },
+ sourceFrame: { numerator: clip.source.startFrame, denominator: 1 }, rate: { numerator: 1, denominator: 1 } }] },
+ }));
+ const labels: VisualElement[] = [options.title, "Intent", "Performance", "Composition"].map((text, i) => ({
+ id: `label-${i}`, parent: "scene", kind: "text", order: videos.length + i + 1, text, fonts,
+ style: [{ name: "font-size", value: `${i === 0 ? Math.round(canvas.widthPx * .035) : 23}px` }, { name: "color", value: "#f5eddc" },
+ { name: "white-space", value: "nowrap" }],
+ }));
+ // Exact fonts belong to the typed text children; the program supplies layout and behavior.
+ const program = browserProgram({
+ html: `<div class="diagram"><div class="heading">{{label-0}}</div>
+ <svg viewBox="0 0 440 300"><path d="M60 60 H320 V150 H60 V240 H320"/></svg>
+ <div class="step first">{{label-1}}</div><div class="step second">{{label-2}}</div>
+ <div class="step third">{{label-3}}</div></div>
+ <div class="viewport">${videos.map(video => `{{${video.id}}}`).join("")}<div class="glass"></div></div>`,
+ css: `:scope { background:#193c3a; overflow:hidden; }
+ .viewport { position:absolute; overflow:hidden; isolation:isolate; }
+ .glass { position:absolute; inset:auto 0 0; height:12%; backdrop-filter:blur(9px); background:rgba(20,40,40,.15); }
+ .diagram { position:absolute; left:5%; top:17%; width:48%; height:70%; }
+ .heading { position:absolute; top:0; left:0; }
+ svg { position:absolute; inset:22% 0 0; width:100%; height:70%; overflow:visible; }
+ path { fill:none; stroke:#c5e98b; stroke-width:4; stroke-linecap:round; stroke-dasharray:900; }
+ .step { position:absolute; padding:14px 24px; border:1px solid #91c6a2; border-radius:16px; background:#285b51; }
+ .first { left:2%; top:30%; } .second { right:2%; top:53%; } .third { left:2%; top:76%; }`,
+ data: { width: canvas.widthPx, height: canvas.heightPx,
+ reveal: reveal.frame - window.span.startFrame, transition: options.transitionFrames },
+ setup: `const viewport=root.querySelector('.viewport'), diagram=root.querySelector('.diagram'), path=root.querySelector('path');
+ return frame => {
+ const t=Math.max(0, Math.min(1,(frame-data.reveal)/data.transition));
+ const p=t*t*(3-2*t);
+ Object.assign(viewport.style,{left:(p*.61*data.width)+'px',top:(p*.06*data.height)+'px',
+ width:((1-p*.65)*data.width)+'px',height:((1-p*.12)*data.height)+'px',borderRadius:(p*24)+'px'});
+ diagram.style.opacity=String(p); diagram.style.transform='translateX('+(-24*(1-p))+'px)';
+ path.style.strokeDashoffset=String(900*(1-p));
+ };`,
+ });
+ return sealVisualTrack({ id: options.id, programSpaceId: space.id, visualIr: "hypit.visual-ir@1",
+ presents: [{ id: options.id, span: window.span, stacking: { order: options.stackingOrder, tieBreak: options.id },
+ elements: [{ id: "scene", kind: "program", order: 0, program,
+ style: [{ name: "position", value: "absolute" }, { name: "inset", value: 0 }] }, ...videos, ...labels] }] });
+}
diff --git a/examples/semantic-composition/packages/responsive-explainer/tsconfig.json b/examples/semantic-composition/packages/responsive-explainer/tsconfig.json
new file mode 100644
index 00000000..6d5a18e7
--- /dev/null
+++ b/examples/semantic-composition/packages/responsive-explainer/tsconfig.json
@@ -0,0 +1,18 @@
+{
+ "compilerOptions": {
+ "target": "ES2023",
+ "module": "NodeNext",
+ "moduleResolution": "NodeNext",
+ "lib": ["ES2023"],
+ "strict": true,
+ "noUncheckedIndexedAccess": true,
+ "exactOptionalPropertyTypes": true,
+ "verbatimModuleSyntax": true,
+ "declaration": true,
+ "sourceMap": true,
+ "rootDir": "src",
+ "outDir": "dist",
+ "skipLibCheck": true
+ },
+ "include": ["src/**/*.ts"]
+}
diff --git a/package.json b/package.json
index 34cd12f2..26e7d564 100644
--- a/package.json
+++ b/package.json
@@ -88,6 +88,10 @@
"./visual-ir": {
"types": "./dist/public/visual-ir.d.ts",
"import": "./packages/visual-ir/src/index.ts"
+ },
+ "./hyperframes": {
+ "types": "./dist/public/hyperframes.d.ts",
+ "import": "./packages/hyperframes/src/index.ts"
}
},
"bin": {
@@ -126,7 +130,12 @@
"examples/minimal-author-package/packages/*/preview/**/*",
"README.md",
"README.zh-CN.md",
- "LICENSE"
+ "LICENSE",
+ "examples/semantic-composition/README.md",
+ "examples/semantic-composition/packages/*/src/**/*",
+ "examples/semantic-composition/packages/*/package.json",
+ "examples/semantic-composition/packages/*/tsconfig.json",
+ "examples/semantic-composition/packages/*/README.md"
],
"scripts": {
"build:public-types": "node scripts/build-public-types.mjs",
@@ -212,7 +221,6 @@
"@hypit/seedance": "workspace:*",
"@hypit/seedance-kits": "workspace:*",
"@hypit/seedream": "workspace:*",
- "@hypit/semantic-take-estimate": "workspace:*",
"@hypit/semantic-track": "workspace:*",
"@hypit/spatial": "workspace:*",
"@hypit/speech": "workspace:*",
@@ -220,7 +228,6 @@
"@hypit/speech-evidence": "workspace:*",
"@hypit/speech-track": "workspace:*",
"@hypit/speech-track-studio": "workspace:*",
- "@hypit/stand-in": "workspace:*",
"@hypit/store-sqlite": "workspace:*",
"@hypit/studio-adapter": "workspace:*",
"@hypit/svs": "workspace:*",
diff --git a/packages/composition/README.md b/packages/composition/README.md
index 85eb1246..eadb048f 100644
--- a/packages/composition/README.md
+++ b/packages/composition/README.md
@@ -24,11 +24,16 @@ Animation keyframes use `atFrame` offsets from the Present's start. Media sampli
same local frame origin and map to exact source frames.
The exported `VisualElement` union covers `box`, `mask`, `text`, `text-flow`, `path-text`, `image`,
-`video` and `surface`. Text carries exact FontArtifactRef values; images and videos carry BlobRefs;
+`video`, `surface` and `program`. Text carries exact FontArtifactRef values; images and videos carry BlobRefs;
`surface` carries a CompositableSurfaceRef. The schema and exported TypeScript types in `src/track.ts`
give each shape. `hypit vocabulary --visual visual-track` and focused element queries expose those
schemas through the installed Distribution.
+A `program` carries `{ format, payload, artifacts }`. The rendering package owns the object payload
+and supports named formats. It may place typed children in its own local structure, so video, text
+and graphics can share behavior while retaining explicit material dependencies. The parent
+relationship remains local to the Present; internal layout belongs to that program.
+
## AudioTrack
An AudioTrack contributes explicit clips with source audio artifacts, source sample ranges, target
diff --git a/packages/composition/src/index.ts b/packages/composition/src/index.ts
index 187002f9..83341bbf 100644
--- a/packages/composition/src/index.ts
+++ b/packages/composition/src/index.ts
@@ -1,7 +1,7 @@
export { compositionComponent } from "./component.js";
export { compositionDependency, compositionManifest, compositionModuleRef, compositionTypes } from "./manifest.js";
export {
- audioTrackSchema,
+ audioTrackSchema, visualTimedSamplingSchema,
compositionSchema,
visualColorPaintSchema,
visualPathCommandSchema,
@@ -11,7 +11,7 @@ export {
visualTextSequenceSchema,
visualTextTypographySchema,
visualTrackSchema,
- visualBoxSchema, visualMaskSchema, visualTextSchema, visualImageSchema, visualVideoSchema, visualSurfaceSchema, visualElementSchema,
+ visualBoxSchema, visualMaskSchema, visualTextSchema, visualImageSchema, visualVideoSchema, visualSurfaceSchema, visualProgramSchema, visualElementSchema,
} from "./schema.js";
export { assertAudioTrackIdentity, assertCompositionIdentity, assertVisualTrackIdentity, sealAudioTrack, sealComposition, sealVisualTrack } from "./track.js";
export { animatableLocalStyles } from "./track.js";
diff --git a/packages/composition/src/schema.ts b/packages/composition/src/schema.ts
index 1bd95c95..a09c246e 100644
--- a/packages/composition/src/schema.ts
+++ b/packages/composition/src/schema.ts
@@ -28,7 +28,7 @@ const samplingSegment = object({
sourceFrame: { schema: rational }, rate: { schema: rational },
loop: { schema: object({ startFrame: { schema: integer }, endFrameExclusive: { schema: positiveInteger } }), optional: true },
});
-const sampling = object({
+export const visualTimedSamplingSchema = object({
sourceFrameRate: { schema: rational }, sourceFrameCount: { schema: positiveInteger },
segments: { schema: { kind: "array", minItems: 1, items: samplingSegment } },
});
@@ -164,10 +164,11 @@ export const visualPathCommandSchema: ValueSchema = { kind: "oneOf", variants: [
object({ kind: { schema: { kind: "literal", value: "close" } } }),
] };
const pathTextElement = object({ ...base, kind: { schema: { kind: "literal", value: "path-text" } }, document: { schema: visualTextDocumentSchema }, typography: { schema: visualTextTypographySchema }, paints: { schema: { kind: "array", items: visualTextPaintSchema } }, path: { schema: { kind: "array", minItems: 2, items: visualPathCommandSchema } }, side: { schema: enumString(["left", "right"]) }, orientation: { schema: enumString(["follow", "upright"]) }, startMarginPx: { schema: number }, endMarginPx: { schema: number }, align: { schema: enumString(["start", "center", "end"]) }, reverse: { schema: boolean }, overflow: { schema: enumString(["visible", "clip"]) }, sequences: { schema: { kind: "array", items: visualTextSequenceSchema } }, marginAnimation: { schema: object({ keyframes: { schema: { kind: "array", minItems: 2, items: object({ atFrame: { schema: integer }, startMarginPx: { schema: number }, easing: { schema: enumString(["linear", "ease-in", "ease-out", "ease-in-out"]), optional: true } }) } } }), optional: true } });
-export const visualImageSchema: ValueSchema = object({ ...base, kind: { schema: { kind: "literal", value: "image" } }, artifact: { schema: mediaBlobRef }, sampling: { schema: sampling, optional: true }, muted: { schema: { kind: "boolean" }, optional: true } });
-export const visualVideoSchema: ValueSchema = object({ ...base, kind: { schema: { kind: "literal", value: "video" } }, artifact: { schema: mediaBlobRef }, sampling: { schema: sampling, optional: true }, muted: { schema: { kind: "boolean" }, optional: true } });
-export const visualSurfaceSchema: ValueSchema = object({ ...base, kind: { schema: { kind: "literal", value: "surface" } }, surface: { schema: compositableSurfaceSchema }, sampling: { schema: sampling, optional: true } });
-export const visualElementSchema: ValueSchema = { kind: "oneOf", variants: [visualBoxSchema, visualMaskSchema, visualTextSchema, textFlowElement, pathTextElement, visualImageSchema, visualVideoSchema, visualSurfaceSchema] };
+export const visualImageSchema: ValueSchema = object({ ...base, kind: { schema: { kind: "literal", value: "image" } }, artifact: { schema: mediaBlobRef }, sampling: { schema: visualTimedSamplingSchema, optional: true }, muted: { schema: { kind: "boolean" }, optional: true } });
+export const visualVideoSchema: ValueSchema = object({ ...base, kind: { schema: { kind: "literal", value: "video" } }, artifact: { schema: mediaBlobRef }, sampling: { schema: visualTimedSamplingSchema, optional: true }, muted: { schema: { kind: "boolean" }, optional: true } });
+export const visualSurfaceSchema: ValueSchema = object({ ...base, kind: { schema: { kind: "literal", value: "surface" } }, surface: { schema: compositableSurfaceSchema }, sampling: { schema: visualTimedSamplingSchema, optional: true } });
+export const visualProgramSchema: ValueSchema = object({ ...base, kind: { schema: { kind: "literal", value: "program" } }, program: { schema: object({ format: { schema: string }, payload: { schema: object({}, true) }, artifacts: { schema: { kind: "array", items: mediaBlobRef } } }) } });
+export const visualElementSchema: ValueSchema = { kind: "oneOf", variants: [visualBoxSchema, visualMaskSchema, visualTextSchema, textFlowElement, pathTextElement, visualImageSchema, visualVideoSchema, visualSurfaceSchema, visualProgramSchema] };
const span = object({ startFrame: { schema: integer }, endFrameExclusive: { schema: integer } });
const present = object({ id: { schema: string }, span: { schema: span }, stacking: { schema: object({ order: { schema: signedInteger }, tieBreak: { schema: string } }) }, elements: { schema: { kind: "array", minItems: 1, items: visualElementSchema } } });
export const visualTrackSchema: ValueSchema = object({ kind: { schema: { kind: "literal", value: "visual" } }, programSpaceId: { schema: string }, visualIr: { schema: { kind: "literal", value: VISUAL_IR_V1 } }, id: { schema: string }, presents: { schema: { kind: "array", items: present } } });
diff --git a/packages/composition/src/track.ts b/packages/composition/src/track.ts
index 11f139ad..f0aa1d4d 100644
--- a/packages/composition/src/track.ts
+++ b/packages/composition/src/track.ts
@@ -1,5 +1,5 @@
import { canonicalStringify, isResourceId } from "@hypit/protocol";
-import type { BlobRef } from "@hypit/protocol";
+import type { BlobRef, CanonicalValue } from "@hypit/protocol";
import {
assertVisualStyleV1,
@@ -60,6 +60,16 @@ export type VisualBoxElement = VisualElementBase & {
readonly kind: "box";
};
+/** A renderer-interpreted local program. Its format and payload belong to its rendering package. */
+export type VisualProgramElement = VisualElementBase & {
+ readonly kind: "program";
+ readonly program: {
+ readonly format: string;
+ readonly payload: { readonly [key: string]: CanonicalValue };
+ readonly artifacts: readonly BlobRef[];
+ };
+};
+
/** A strictly local two-input mask. Both roots are direct owned children in the same Present. */
export type VisualMaskElement = VisualElementBase & {
readonly kind: "mask";
@@ -336,18 +346,15 @@ export type VisualSurfaceElement = VisualElementBase & {
};
/**
- * Deliberately small, code-free renderer-neutral visual primitives.
+ * Structural elements and explicit renderer programs compose in one owned tree.
*
- * Elements may reference only parents in the same Present. They have no selector,
- * script, sibling Track id or accumulated-composite input.
- *
- * A Present holds exactly one root; everything else names a `parent`, which has to be a box or a
- * mask. **Position is measured from that parent, not from the Canvas.** A component that computes
+ * A Present holds exactly one root; everything else names a `parent`, which can be a box,
+ * mask or program. **Position is measured from that parent, not from the Canvas.** A component that computes
* its layout in Canvas pixels and then nests its elements has to subtract the parent's own origin,
* or every child lands offset by it — which draws without complaint and is wrong by exactly the
* distance the parent sits from the corner.
*/
-export type VisualElement = VisualBoxElement | VisualMaskElement | VisualTextElement | VisualTextFlowElement | VisualPathTextElement | VisualMediaElement | VisualSurfaceElement;
+export type VisualElement = VisualBoxElement | VisualProgramElement | VisualMaskElement | VisualTextElement | VisualTextFlowElement | VisualPathTextElement | VisualMediaElement | VisualSurfaceElement;
export type VisualPresent = {
readonly id: string;
@@ -423,6 +430,7 @@ export type Composition = {
/** The only local style properties accepted in element keyframes. */
export const animatableLocalStyles = [
+ "backdrop-filter",
"clip-path",
"filter",
"opacity",
@@ -951,6 +959,12 @@ function assertPresent(present: VisualPresent, programSpace: ProgramSpace | unde
present.span.endFrameExclusive - present.span.startFrame,
`${trackId}.${present.id}.${element.id}`,
);
+ if (element.kind === "program") {
+ assertNonEmpty(element.program.format, `${element.id}.program.format`);
+ if (element.program.payload === null || typeof element.program.payload !== "object" || Array.isArray(element.program.payload)) throw new Error("Visual program payload must be an object.");
+ canonicalStringify(element.program.payload);
+ for (const artifact of element.program.artifacts) assertMediaArtifact(artifact, `${element.id}.program.artifacts`);
+ }
if (element.kind === "image" || element.kind === "video") {
assertMediaArtifact(element.artifact, `${trackId}.${present.id}.${element.id}.artifact`);
if (!element.artifact.mediaType.startsWith(`${element.kind}/`)) {
@@ -1066,8 +1080,8 @@ function assertPresent(present: VisualPresent, programSpace: ProgramSpace | unde
if (element.parent !== undefined && !elements.has(element.parent)) {
throw new Error(`${trackId}.${present.id}.${element.id} references a foreign parent.`);
}
- if (element.parent !== undefined && !["box", "mask"].includes(elements.get(element.parent)?.kind ?? "")) {
- throw new Error(`${trackId}.${present.id}.${element.id} must have a box or mask parent.`);
+ if (element.parent !== undefined && !["box", "mask", "program"].includes(elements.get(element.parent)?.kind ?? "")) {
+ throw new Error(`${trackId}.${present.id}.${element.id} must have a box, mask or program parent.`);
}
const visited = new Set<string>();
let cursor: VisualElement | undefined = element;
@@ -1128,6 +1142,7 @@ function normalizeElement(element: VisualElement): VisualElement {
...(element.animation === undefined ? {} : { animation: normalizeAnimation(element.animation) }),
};
if (element.kind === "box") return { ...common, kind: "box" };
+ if (element.kind === "program") return { ...common, kind: "program", program: structuredClone(element.program) };
if (element.kind === "mask") return {
...common,
kind: "mask",
diff --git a/packages/composition/test/render.test.ts b/packages/composition/test/render.test.ts
index 39b90647..ce2f758e 100644
--- a/packages/composition/test/render.test.ts
+++ b/packages/composition/test/render.test.ts
@@ -204,5 +204,5 @@ test("a local mask owns exactly one mask root and one content root inside its Pr
assert.throws(() => assertCompositionIdentity(sealComposition({
id: "nested-mask-source",
canvas: { width: 1080, height: 1920, clearColor: "#000000" }, tracks: [nested],
- }), space), /must have a box or mask parent/u);
+ }), space), /must have a box, mask or program parent/u);
});
diff --git a/packages/composition/test/track.test.ts b/packages/composition/test/track.test.ts
index e9ae21e4..136cb43e 100644
--- a/packages/composition/test/track.test.ts
+++ b/packages/composition/test/track.test.ts
@@ -102,7 +102,7 @@ test("Composition accepts case-insensitive hexadecimal canvas colors", () => {
assert.doesNotThrow(() => assertCompositionIdentity(composition, programSpace));
});
-test("VisualTrack rejects cross-Track pixel sampling styles", () => {
+test("VisualTrack accepts authored backdrop compositing", () => {
const { programSpace, visual, sound } = fixture();
const content = structuredClone(visual) as VisualTrack;
const first = content.presents[0]!.elements[0]!;
@@ -117,7 +117,7 @@ test("VisualTrack rejects cross-Track pixel sampling styles", () => {
canvas: { width: 1080, height: 1920, clearColor: "#000000" },
tracks: [sound, invasive],
});
- assert.throws(() => assertCompositionIdentity(composition, programSpace), /cross-Track style backdrop-filter/);
+ assert.doesNotThrow(() => assertCompositionIdentity(composition, programSpace));
});
test("VisualTrack style values cannot smuggle a second declaration", () => {
@@ -312,9 +312,9 @@ test("Visual Present animations may finish before or after their visibility wind
}],
}],
});
- assert.throws(() => assertCompositionIdentity(sealComposition({
+ assert.doesNotThrow(() => assertCompositionIdentity(sealComposition({
id: "animated-invasive",
canvas: { width: 1080, height: 1920, clearColor: "#000000" },
tracks: [invasive],
- }), programSpace), /cross-Track style backdrop-filter/);
+ }), programSpace));
});
diff --git a/packages/estimate/README.md b/packages/estimate/README.md
index 13b4d840..61abb23d 100644
--- a/packages/estimate/README.md
+++ b/packages/estimate/README.md
@@ -22,10 +22,10 @@ The estimate reports the time the wording needs at that delivery. Use it to deci
needs merging, fuller wording, tightening, or splitting, then choose the request duration with the
selected model's supported values in mind.
-The one graph value this package declares is `SpeechEstimatePolicy`: the same language, pace or rate,
-rounding and optional padding, written as attributes or an SVS Recipe on `<estimated:SemanticTake>`, which
-weights a Segment's Tokens across preview media by pronunciation units. Nothing here runs inside a
-Build; a Build plan is complete before it starts because every duration is already a literal.
+`SpeechEstimatePolicy` holds the language, pace or rate, rounding and optional padding used by the
+measurement API. `speechEstimatePolicyFromRecipe` reads those values from a Recipe for package authors.
+The measurement produces a duration estimate for authoring; actual word positions come from the
+performed media's semantic preparation.
```ts
import { estimateSpeechDuration, sealSpeechEstimatePolicy, speechEstimatePolicyFromRecipe } from "@hypit/estimate";
diff --git a/packages/estimate/test/estimate.test.ts b/packages/estimate/test/estimate.test.ts
index 8a8f887b..6dfaccd6 100644
--- a/packages/estimate/test/estimate.test.ts
+++ b/packages/estimate/test/estimate.test.ts
@@ -81,7 +81,7 @@ test("optional padding extends speech before rounding", () => {
test("a policy written as attributes reads the same values a Recipe would", () => {
const policy = speechEstimatePolicyFromAttributes(
{ language: "en", rate: "4.75", rounding: "round" },
- "estimated:SemanticTake",
+ "example:MeasuredDuration",
);
assert.equal(policy.rate, 4.75);
assert.throws(
diff --git a/packages/film/README.md b/packages/film/README.md
index 59b30924..5fdf2d3d 100644
--- a/packages/film/README.md
+++ b/packages/film/README.md
@@ -29,7 +29,7 @@ For example, after the named inputs are declared:
```svml
<film:Film id="main" canvas={vertical} semantic={speech.semantic}
appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
+ <film:Track source={performance.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={coverage.visual}/>
<film:Track source={captions.track}/>
diff --git a/packages/film/src/manifest.ts b/packages/film/src/manifest.ts
index c0304c96..d37b0578 100644
--- a/packages/film/src/manifest.ts
+++ b/packages/film/src/manifest.ts
@@ -81,7 +81,7 @@ export const filmMarkupSurfaces = [{
],
example: [
'<film:Film id="main" canvas={vertical} semantic={speech.semantic} appearance={recipes.film.vertical}>',
- " <film:Track source={speech.visual}/>",
+ " <film:Track source={performance.visual}/>",
" <film:Track source={speech.audio}/>",
" <film:Track source={captions.track}/>",
"</film:Film>",
diff --git a/packages/gpt-image/test/broll-graph.test.ts b/packages/gpt-image/test/broll-graph.test.ts
index ef15695c..faa08280 100644
--- a/packages/gpt-image/test/broll-graph.test.ts
+++ b/packages/gpt-image/test/broll-graph.test.ts
@@ -41,7 +41,6 @@ import {
} from "@hypit/seedance";
import { speechManifest } from "@hypit/speech";
import { spatialManifest } from "@hypit/spatial";
-import { standInManifest } from "@hypit/stand-in";
import { svsManifest } from "@hypit/svs";
import { textManifest } from "@hypit/text";
@@ -68,7 +67,6 @@ function fixture() {
svsManifest,
speechManifest,
seedanceManifest,
- standInManifest,
];
const closure = createResolvedClosure(manifests);
const gpt = gptImageEndpoints.image!;
diff --git a/packages/hyperframes/README.md b/packages/hyperframes/README.md
index 5b965586..d6ec44f2 100644
--- a/packages/hyperframes/README.md
+++ b/packages/hyperframes/README.md
@@ -3,11 +3,10 @@
Deterministic reference lowering from the generic `Composition` contract to a portable
`HyperframesDocument`.
-This package implements the one closed `hypit.visual-ir@1` target declared by every
-VisualTrack. The vocabulary is owned by `@hypit/visual-ir`; Track and Composition values are
-owned by `@hypit/composition`. Neither is an author component
-and not arbitrary CSS. Unknown properties and alternate browser semantics fail before document
-compilation; visuals outside the structural vocabulary enter as typed `CompositableSurface` values.
+This package renders `hypit.visual-ir@1` structural elements and `hypit.browser-program@1`
+local programs. Structural elements cover ordinary boxes, exact-font text and frame-sampled media.
+A browser program carries HTML, CSS and frame-driven JavaScript for a component's own composition.
+Track and Composition remain owned by `@hypit/composition`; the browser format is owned here.
This package understands only `VisualTrack`, `ProgramSpace` and canvas geometry. It
does not know Caption, Speech, B-roll, Seedance or any other author-domain component. It flattens
@@ -45,3 +44,26 @@ The ordinary test suite validates deterministic HTML, frame sampling markers and
The local Provider owns the Chrome integration tests. Run its tests with `HYPIT_BROWSER_TESTS=1`
to exercise real multi-worker rendering, compare selected video frames with a full render, and check
straight-alpha composition. These tests use the engine capture API and require Chrome and FFmpeg.
+
+## Local browser programs
+
+`browserProgram({ html, css, setup, data }, artifacts)` builds a program payload. Place it on a
+`kind: "program"` VisualElement inside a normal Present. `html` is a local fragment; `{{child-id}}`
+places a direct typed child. Every child is placed once, including sampled video and exact-font text.
+This keeps actual video available to the renderer's exact source-frame preparation.
+
+CSS is scoped to the generated program root with `@scope`; `:scope` styles that root. The HTML can
+contain arbitrary local structure, SVG, internal stacking, masks and backdrop filters. The optional
+`setup` string is a JavaScript function body with `root` and `data` arguments. It returns a synchronous
+`render(localFrame)` function, evaluated on initial load and every `hf-seek`. Express animation state
+as a function of this frame and inputs so any worker can begin at any frame. Async work belongs to
+material preparation before rendering; browser resources belong in the program's declared artifacts.
+Use `hyperframesResourceUri(artifact.resource)` in resource-bearing markup or CSS.
+
+Ordinary child sampling follows the Present clock. Reframing the parent leaves source playback
+unchanged. `projectSemanticMedia` from `hypit/semantic-track` gives a component selected prepared
+clips with their exact program and source spans. Speech audio is an independently selected Track.
+
+`program.format` is explicit: this backend reports an unsupported format rather than interpreting
+another renderer's program. Core and the build graph do not contain browser-specific cases.
+The `examples/semantic-composition` project demonstrates a complete package using this interface.
diff --git a/packages/hyperframes/src/browser-program.ts b/packages/hyperframes/src/browser-program.ts
new file mode 100644
index 00000000..afd95600
--- /dev/null
+++ b/packages/hyperframes/src/browser-program.ts
@@ -0,0 +1,79 @@
+import { canonicalize } from "@hypit/protocol";
+import type { BlobRef, CanonicalValue } from "@hypit/protocol";
+import type { VisualProgramElement } from "@hypit/composition";
+
+export const BROWSER_PROGRAM_FORMAT = "hypit.browser-program@1" as const;
+
+export type BrowserProgram = {
+ /** HTML fragment. {{child-id}} inserts an owned VisualElement, including frame-sampled video. */
+ readonly html: string;
+ /** CSS in an @scope rooted at this program's element. */
+ readonly css?: string;
+ /** Function body with (root, data) arguments; returns a synchronous render(localFrame) function. */
+ readonly setup?: string;
+ readonly data?: CanonicalValue;
+};
+
+export function browserProgram(value: BrowserProgram, artifacts: readonly BlobRef[] = []): VisualProgramElement["program"] {
+ return { format: BROWSER_PROGRAM_FORMAT, payload: canonicalize(value) as VisualProgramElement["program"]["payload"], artifacts: [...artifacts] };
+}
+
+export function readBrowserProgram(program: VisualProgramElement["program"]): BrowserProgram {
+ if (program.format !== BROWSER_PROGRAM_FORMAT) {
+ throw new Error(`HyperFrames does not support visual program format ${program.format}.`);
+ }
+ const value = program.payload as unknown as BrowserProgram;
+ if (value === null || typeof value !== "object" || typeof value.html !== "string"
+ || (value.css !== undefined && typeof value.css !== "string")
+ || (value.setup !== undefined && typeof value.setup !== "string")) {
+ throw new Error("Browser program requires HTML and optional CSS and setup source.");
+ }
+ return value;
+}
+
+export function browserProgramHtml(program: BrowserProgram, children: ReadonlyMap<string, string>): string {
+ const used = new Set<string>();
+ const result = program.html.replace(/\{\{([^{}]+)\}\}/gu, (_match, name: string) => {
+ const child = children.get(name);
+ if (child === undefined || used.has(name)) throw new Error(`Browser program slot ${name} is missing or repeated.`);
+ used.add(name);
+ return child;
+ });
+ for (const name of children.keys()) {
+ if (!used.has(name)) throw new Error(`Browser program does not place owned child ${name}.`);
+ }
+ return result;
+}
+
+/** JSON is embedded as data, so author text cannot close the surrounding script element. */
+const scriptJson = (value: unknown): string => JSON.stringify(value).replaceAll("<", "\\u003c");
+
+export function browserProgramScript(entries: readonly {
+ readonly id: string;
+ readonly startFrame: number;
+ readonly durationFrames: number;
+ readonly program: BrowserProgram;
+}[], numerator: number, denominator: number): string {
+ return `(() => {
+ const fail = error => { window.__hypitBrowserProgramError = String(error?.stack || error); };
+ const entries = ${scriptJson(entries)};
+ const renders = entries.map(entry => {
+ const root = document.getElementById(entry.id);
+ try {
+ const render = entry.program.setup === undefined ? () => {} :
+ new Function('root', 'data', entry.program.setup)(root, entry.program.data);
+ if (typeof render !== 'function') throw new Error('Browser program setup must return render(localFrame).');
+ return { ...entry, render };
+ } catch (error) { fail(error); return { ...entry, render: () => {} }; }
+ });
+ const apply = time => {
+ const frame = Math.round(Number(time || 0) * ${numerator} / ${denominator});
+ for (const entry of renders) {
+ try { entry.render(Math.max(0, Math.min(entry.durationFrames, frame - entry.startFrame))); }
+ catch (error) { fail(error); }
+ }
+ };
+ apply(0);
+ window.addEventListener('hf-seek', event => apply(event.detail?.time));
+ })();`;
+}
diff --git a/packages/hyperframes/src/document.ts b/packages/hyperframes/src/document.ts
index 7b19da63..a11b786c 100644
--- a/packages/hyperframes/src/document.ts
+++ b/packages/hyperframes/src/document.ts
@@ -18,6 +18,7 @@ import type {
import { canonicalStringify, isResourceId } from "@hypit/protocol";
import type { BlobRef, ResourceId } from "@hypit/protocol";
import { VISUAL_IR_V1 } from "@hypit/visual-ir";
+import { readBrowserProgram, browserProgramHtml, browserProgramScript } from "./browser-program.js";
import type {
ResourceUrlResolver,
@@ -325,6 +326,11 @@ function renderElement(
})();
return `<svg ${common}${viewport} width="100%" height="100%" overflow="visible"><defs><mask id="${maskId}" x="0" y="0" width="100%" height="100%" maskUnits="userSpaceOnUse" maskContentUnits="userSpaceOnUse" style="mask-type:${element.mode}">${maskSource}</mask></defs><foreignObject x="0" y="0" width="100%" height="100%" mask="url(#${maskId})"><div xmlns="http://www.w3.org/1999/xhtml" style="position:relative;width:100%;height:100%">${renderOwned(contentRoot)}</div></foreignObject></svg>`;
}
+ if (element.kind === "program") {
+ const program = readBrowserProgram(element.program);
+ const slots = new Map((children.get(element.id) ?? []).map(child => [child.id, renderElement(child, children, context)]));
+ return `<div ${common}>${browserProgramHtml(program, slots)}</div>`;
+ }
const descendants = (children.get(element.id) ?? [])
.map((child) => renderElement(child, children, context))
.join("");
@@ -510,6 +516,7 @@ function collectArtifacts(composition: Composition): BlobRef[] {
for (const element of present.elements) {
if (element.kind === "image" || element.kind === "video") add(element.artifact);
if (element.kind === "surface") add(element.surface.artifact);
+ if (element.kind === "program") for (const artifact of element.program.artifacts) add(artifact);
if (element.kind === "text") {
for (const font of element.fonts ?? []) {
for (const source of font.sources) add(source.artifact);
@@ -652,6 +659,14 @@ function emitHtml(composition: Composition, programSpace: ProgramSpace): string
const visualHtml = visuals.map(({ track, present }, index) => renderVisualPresent(track, present, index, numerator, denominator, emittedFilterIds, stableId)).join("\n ");
const animationCss = visuals.flatMap(({ track, present }) => renderAnimationRules(track, present, stableId)).join("\n ");
const fontCss = renderFontFaces(composition, stableId);
+ const programs = visuals.flatMap(({ track, present }) => present.elements.flatMap(element => element.kind !== "program" ? [] : [{
+ id: stableId([track.id, present.id, element.id]),
+ startFrame: present.span.startFrame,
+ durationFrames: present.span.endFrameExclusive - present.span.startFrame,
+ program: readBrowserProgram(element.program),
+ }]));
+ const programCss = programs.map(entry => `@scope (#${entry.id}) { ${entry.program.css ?? ""} }`).join("\n");
+ const programRuntime = programs.length === 0 ? "" : `<script>${browserProgramScript(programs, numerator, denominator)}</script>`;
const duration = frameSeconds(programSpaceFrameCount(programSpace), numerator, denominator);
const fps = fpsRational(numerator, denominator);
const frameCount = programSpaceFrameCount(programSpace);
@@ -672,12 +687,13 @@ function emitHtml(composition: Composition, programSpace: ProgramSpace): string
*,*::before,*::after{box-sizing:border-box}
${fontCss}
${animationCss}
+ ${programCss}
</style>
</head>
<body>
<div data-composition-id="${escapeHtml(composition.id)}" data-start="0" data-no-timeline data-width="${composition.canvas.width}" data-height="${composition.canvas.height}" data-duration="${duration}" data-fps="${fps}" data-hypit-frame-count="${frameCount}">
${visualHtml}
- </div>${animationRuntime}${textRuntime}
+ </div>${programRuntime}${animationRuntime}${textRuntime}
</body>
</html>
`;
diff --git a/packages/hyperframes/src/index.ts b/packages/hyperframes/src/index.ts
index 7ef5beec..fac627b7 100644
--- a/packages/hyperframes/src/index.ts
+++ b/packages/hyperframes/src/index.ts
@@ -9,3 +9,5 @@ export {
hyperframesTypes,
} from "./manifest.js";
export type * from "./types.js";
+export { browserProgram, BROWSER_PROGRAM_FORMAT } from "./browser-program.js";
+export type { BrowserProgram } from "./browser-program.js";
diff --git a/packages/hyperframes/test/document.test.ts b/packages/hyperframes/test/document.test.ts
index 02b826c0..f3216209 100644
--- a/packages/hyperframes/test/document.test.ts
+++ b/packages/hyperframes/test/document.test.ts
@@ -523,3 +523,45 @@ test("a Track naming five takes still lowers to DOM identities a Windows path ca
assert.ok(document.html.includes(`data-hypit-track-id="${trackId}"`));
assert.ok(document.html.includes(`data-hypit-element-id="${presentId}:foreground"`));
});
+
+test("browser programs own local HTML while retaining typed child resources and format boundaries", async () => {
+ const { browserProgram } = await import("../src/browser-program.js");
+ const { programSpace, picture } = fixture();
+ const visual = sealVisualTrack({ id: "scene", programSpaceId: programSpace.id, visualIr: VISUAL_IR_V1,
+ presents: [{ id: "scene", span: { startFrame: 0, endFrameExclusive: 30 }, stacking: { order: 0, tieBreak: "scene" },
+ elements: [{ id: "root", kind: "program", order: 0, style: [], program: browserProgram({
+ html: '<section class="viewport">{{photo}}<svg><path d="M0 0H20"/></svg></section>',
+ css: '.viewport { backdrop-filter:blur(4px); display:grid; }',
+ setup: 'return frame => { root.dataset.frame = String(frame); };',
+ }) }, { id: "photo", parent: "root", kind: "image", order: 1, artifact: picture, style: [] }] }] });
+ const composition = sealComposition({ id: "scene", canvas: { width: 200, height: 200, clearColor: "#000000" }, tracks: [visual] });
+ const document = compileHyperframesDocument(composition, programSpace);
+ assert.equal(document.artifacts.length, 1);
+ assert.ok(document.html.includes('<section class="viewport">'));
+ assert.ok(document.html.includes('@scope'));
+ const missing = structuredClone(composition);
+ const root = missing.tracks[0]!;
+ if (root.kind !== "visual" || root.presents[0]!.elements[0]!.kind !== "program") throw new Error("fixture");
+ const program = root.presents[0]!.elements[0]!.program;
+ (program as { format: string }).format = "another.renderer@1";
+ assert.throws(() => compileHyperframesDocument(missing, programSpace), /does not support visual program format/);
+});
+
+test("browser program state follows direct seeks and reports authored evaluation failures", async () => {
+ const { runInNewContext } = await import("node:vm");
+ const { browserProgramScript } = await import("../src/browser-program.js");
+ const root = { frame: -1 };
+ let seek: (event: { detail: { time: number } }) => void = () => {};
+ const window: { addEventListener: (name: string, callback: typeof seek) => void; __hypitBrowserProgramError?: string } = {
+ addEventListener: (_name, callback) => { seek = callback; },
+ };
+ runInNewContext(browserProgramScript([{ id: "scene", startFrame: 30, durationFrames: 90,
+ program: { html: "", setup: 'return frame => { if(frame===60) throw new Error("bad pose"); root.frame=frame; };' },
+ }], 30, 1), { window, document: { getElementById: () => root } });
+ seek({ detail: { time: 2.5 } });
+ assert.equal(root.frame, 45);
+ seek({ detail: { time: 1.2 } });
+ assert.equal(root.frame, 6);
+ seek({ detail: { time: 3 } });
+ assert.match(window.__hypitBrowserProgramError!, /bad pose/);
+});
diff --git a/packages/media-execution/package.json b/packages/media-execution/package.json
index 3b4f15ca..b55fe2c3 100644
--- a/packages/media-execution/package.json
+++ b/packages/media-execution/package.json
@@ -12,7 +12,6 @@
"@hypit/media-pipeline": "workspace:*",
"@hypit/program-space": "workspace:*",
"@hypit/protocol": "workspace:*",
- "@hypit/speech": "workspace:*",
- "@hypit/stand-in": "workspace:*"
+ "@hypit/speech": "workspace:*"
}
}
diff --git a/packages/media-execution/src/card.ts b/packages/media-execution/src/card.ts
deleted file mode 100644
index a9eb8ab3..00000000
--- a/packages/media-execution/src/card.ts
+++ /dev/null
@@ -1,307 +0,0 @@
-import { deflateSync } from "node:zlib";
-
-import type { CanonicalValue } from "@hypit/protocol";
-import { verifyStandInCardRequest } from "@hypit/stand-in";
-import type { StandInCardRequest } from "@hypit/stand-in";
-
-/**
- * A generic stand-in card, drawn from only the media shape a Run supplies.
- *
- * The card is pixels, not a model call. Everything is drawn here with a built-in 5x7 bitmap font,
- * so the same card comes out of every machine. The PNG is deterministic for a given request.
- */
-
-type Rgb = readonly [number, number, number];
-
-const GROUND: Rgb = [0x17, 0x23, 0x32];
-const ACCENT: Rgb = [0xF5, 0xC5, 0x42];
-const TEXT: Rgb = [0xFF, 0xFF, 0xFF];
-const MUTED: Rgb = [0xC9, 0xD1, 0xD9];
-const INK: Rgb = [0x0B, 0x12, 0x1A];
-
-// A classic 5x7 bitmap face: enough for Latin letters, digits and the punctuation a label carries.
-const GLYPHS: Record<string, readonly string[]> = {
- A: [".###.", "#...#", "#...#", "#####", "#...#", "#...#", "#...#"],
- B: ["####.", "#...#", "#...#", "####.", "#...#", "#...#", "####."],
- C: [".###.", "#...#", "#....", "#....", "#....", "#...#", ".###."],
- D: ["####.", "#...#", "#...#", "#...#", "#...#", "#...#", "####."],
- E: ["#####", "#....", "#....", "####.", "#....", "#....", "#####"],
- F: ["#####", "#....", "#....", "####.", "#....", "#....", "#...."],
- G: [".###.", "#...#", "#....", "#.###", "#...#", "#...#", ".####"],
- H: ["#...#", "#...#", "#...#", "#####", "#...#", "#...#", "#...#"],
- I: [".###.", "..#..", "..#..", "..#..", "..#..", "..#..", ".###."],
- J: ["..###", "...#.", "...#.", "...#.", "...#.", "#..#.", ".##.."],
- K: ["#...#", "#..#.", "#.#..", "##...", "#.#..", "#..#.", "#...#"],
- L: ["#....", "#....", "#....", "#....", "#....", "#....", "#####"],
- M: ["#...#", "##.##", "#.#.#", "#.#.#", "#...#", "#...#", "#...#"],
- N: ["#...#", "#...#", "##..#", "#.#.#", "#..##", "#...#", "#...#"],
- O: [".###.", "#...#", "#...#", "#...#", "#...#", "#...#", ".###."],
- P: ["####.", "#...#", "#...#", "####.", "#....", "#....", "#...."],
- Q: [".###.", "#...#", "#...#", "#...#", "#.#.#", "#..#.", ".##.#"],
- R: ["####.", "#...#", "#...#", "####.", "#.#..", "#..#.", "#...#"],
- S: [".####", "#....", "#....", ".###.", "....#", "....#", "####."],
- T: ["#####", "..#..", "..#..", "..#..", "..#..", "..#..", "..#.."],
- U: ["#...#", "#...#", "#...#", "#...#", "#...#", "#...#", ".###."],
- V: ["#...#", "#...#", "#...#", "#...#", "#...#", ".#.#.", "..#.."],
- W: ["#...#", "#...#", "#...#", "#.#.#", "#.#.#", "##.##", "#...#"],
- X: ["#...#", "#...#", ".#.#.", "..#..", ".#.#.", "#...#", "#...#"],
- Y: ["#...#", "#...#", ".#.#.", "..#..", "..#..", "..#..", "..#.."],
- Z: ["#####", "....#", "...#.", "..#..", ".#...", "#....", "#####"],
- "0": [".###.", "#...#", "#..##", "#.#.#", "##..#", "#...#", ".###."],
- "1": ["..#..", ".##..", "..#..", "..#..", "..#..", "..#..", ".###."],
- "2": [".###.", "#...#", "....#", "...#.", "..#..", ".#...", "#####"],
- "3": ["#####", "...#.", "..#..", "...#.", "....#", "#...#", ".###."],
- "4": ["...#.", "..##.", ".#.#.", "#..#.", "#####", "...#.", "...#."],
- "5": ["#####", "#....", "####.", "....#", "....#", "#...#", ".###."],
- "6": ["..##.", ".#...", "#....", "####.", "#...#", "#...#", ".###."],
- "7": ["#####", "....#", "...#.", "..#..", ".#...", ".#...", ".#..."],
- "8": [".###.", "#...#", "#...#", ".###.", "#...#", "#...#", ".###."],
- "9": [".###.", "#...#", "#...#", ".####", "....#", "...#.", ".##.."],
- " ": [".....", ".....", ".....", ".....", ".....", ".....", "....."],
- "-": [".....", ".....", ".....", "#####", ".....", ".....", "....."],
- ":": [".....", "..##.", "..##.", ".....", "..##.", "..##.", "....."],
- ".": [".....", ".....", ".....", ".....", ".....", "..##.", "..##."],
- ",": [".....", ".....", ".....", ".....", "..##.", "..##.", ".#..."],
- "/": ["....#", "....#", "...#.", "..#..", ".#...", "#....", "#...."],
- "(": ["..#..", ".#...", "#....", "#....", "#....", ".#...", "..#.."],
- ")": ["..#..", "...#.", "....#", "....#", "....#", "...#.", "..#.."],
- "'": [".##..", ".##..", ".#...", ".....", ".....", ".....", "....."],
- "?": [".###.", "#...#", "....#", "...#.", "..#..", ".....", "..#.."],
- "!": ["..#..", "..#..", "..#..", "..#..", "..#..", ".....", "..#.."],
- "+": [".....", "..#..", "..#..", "#####", "..#..", "..#..", "....."],
- "_": [".....", ".....", ".....", ".....", ".....", ".....", "#####"],
- "#": [".#.#.", ".#.#.", "#####", ".#.#.", "#####", ".#.#.", ".#.#."],
- "@": [".###.", "#...#", "#.###", "#.#.#", "#.###", "#....", ".###."],
- "&": [".##..", "#..#.", "#..#.", ".##..", "#.#.#", "#..#.", ".##.#"],
- "%": ["##..#", "##..#", "...#.", "..#..", ".#...", "#..##", "#..##"],
- "\"": [".#.#.", ".#.#.", ".#.#.", ".....", ".....", ".....", "....."],
- "⎕": [".###.", ".#.#.", ".#.#.", ".#.#.", ".#.#.", ".#.#.", ".###."],
-};
-const GLYPH_WIDTH = 5;
-const GLYPH_HEIGHT = 7;
-const ADVANCE = 6;
-
-function glyph(character: string): readonly string[] {
- const upper = character.toUpperCase();
- return GLYPHS[upper] ?? (upper === "×" ? GLYPHS.X! : GLYPHS["⎕"]!);
-}
-
-class Raster {
- readonly width: number;
- readonly height: number;
- readonly pixels: Buffer;
-
- constructor(width: number, height: number, ground: Rgb) {
- this.width = width;
- this.height = height;
- this.pixels = Buffer.alloc(width * height * 3);
- for (let index = 0; index < width * height; index += 1) {
- this.pixels[index * 3] = ground[0];
- this.pixels[index * 3 + 1] = ground[1];
- this.pixels[index * 3 + 2] = ground[2];
- }
- }
-
- blend(x: number, y: number, color: Rgb, alpha: number): void {
- if (x < 0 || y < 0 || x >= this.width || y >= this.height) return;
- const offset = (y * this.width + x) * 3;
- for (let channel = 0; channel < 3; channel += 1) {
- const current = this.pixels[offset + channel]!;
- this.pixels[offset + channel] = Math.round(current + (color[channel]! - current) * alpha);
- }
- }
-
- fill(x: number, y: number, width: number, height: number, color: Rgb, alpha = 1): void {
- const left = Math.max(0, x);
- const top = Math.max(0, y);
- const right = Math.min(this.width, x + width);
- const bottom = Math.min(this.height, y + height);
- for (let row = top; row < bottom; row += 1) {
- for (let column = left; column < right; column += 1) {
- if (alpha >= 1) {
- const offset = (row * this.width + column) * 3;
- this.pixels[offset] = color[0]; this.pixels[offset + 1] = color[1]; this.pixels[offset + 2] = color[2];
- } else {
- this.blend(column, row, color, alpha);
- }
- }
- }
- }
-
- /** Draw text whose glyph origin is the top-left corner; returns the advance in pixels. */
- text(value: string, x: number, y: number, scale: number, color: Rgb, alpha = 1): number {
- let cursor = x;
- for (const character of value) {
- const rows = glyph(character);
- for (let row = 0; row < GLYPH_HEIGHT; row += 1) {
- for (let column = 0; column < GLYPH_WIDTH; column += 1) {
- if (rows[row]![column] === "#") this.fill(cursor + column * scale, y + row * scale, scale, scale, color, alpha);
- }
- }
- cursor += ADVANCE * scale;
- }
- return cursor - x;
- }
-
- png(): Uint8Array {
- const stride = this.width * 3;
- const scanlines = Buffer.alloc(this.height * (1 + stride));
- for (let row = 0; row < this.height; row += 1) {
- scanlines[row * (1 + stride)] = 0;
- this.pixels.copy(scanlines, row * (1 + stride) + 1, row * stride, (row + 1) * stride);
- }
- const header = Buffer.alloc(13);
- header.writeUInt32BE(this.width, 0);
- header.writeUInt32BE(this.height, 4);
- header[8] = 8; header[9] = 2; header[10] = 0; header[11] = 0; header[12] = 0;
- return Uint8Array.from(Buffer.concat([
- Buffer.from("\x89PNG\r\n\x1a\n", "binary"),
- Buffer.from(pngChunk("IHDR", header)),
- Buffer.from(pngChunk("IDAT", deflateSync(scanlines))),
- Buffer.from(pngChunk("IEND", new Uint8Array())),
- ]));
- }
-}
-
-function crc32(bytes: Uint8Array): number {
- let crc = 0xFFFFFFFF;
- for (const byte of bytes) {
- crc ^= byte;
- for (let bit = 0; bit < 8; bit += 1) crc = (crc >>> 1) ^ (crc & 1 ? 0xEDB88320 : 0);
- }
- return (crc ^ 0xFFFFFFFF) >>> 0;
-}
-
-function pngChunk(type: string, data: Uint8Array): Uint8Array {
- const body = new Uint8Array(type.length + data.length);
- for (let index = 0; index < type.length; index += 1) body[index] = type.charCodeAt(index);
- body.set(data, type.length);
- const result = new Uint8Array(12 + data.length);
- const view = new DataView(result.buffer);
- view.setUint32(0, data.length);
- result.set(body, 4);
- view.setUint32(8 + data.length, crc32(body));
- return result;
-}
-
-function textWidth(value: string, scale: number): number {
- return Math.max(0, [...value].length * ADVANCE * scale - scale);
-}
-
-export type ClipTimeGuideRequest = {
- readonly width: number;
- readonly height: number;
- readonly frameRate: { readonly numerator: number; readonly denominator: number };
- readonly frameCount: number;
-};
-
-function timecode(
- frame: number,
- video: Pick<ClipTimeGuideRequest, "frameRate" | "frameCount">,
-): string {
- const fps = video.frameRate.numerator / video.frameRate.denominator;
- const total = frame / fps;
- const minutes = Math.floor(total / 60);
- const wholeSeconds = Math.floor(total - minutes * 60);
- const frames = frame - Math.round((minutes * 60 + wholeSeconds) * fps);
- const two = (value: number): string => String(value).padStart(2, "0");
- return `${two(minutes)}:${two(wholeSeconds)}.${two(Math.max(0, frames))}`;
-}
-
-type Layout = {
- readonly border: number;
- readonly margin: number;
-};
-
-function layout(request: StandInCardRequest): Layout {
- const m = Math.min(request.width, request.height);
- const border = Math.max(6, Math.round(m * 0.03));
- return { border, margin: border * 2 };
-}
-
-/** Draw one neutral Card. Timing, if needed, belongs to the StillVideo that displays it. */
-export function drawStandInCard(request: StandInCardRequest): Uint8Array {
- verifyStandInCardRequest(request);
- const { width, height } = request;
- const m = Math.min(width, height);
- const { border, margin } = layout(request);
- const raster = new Raster(width, height, GROUND);
-
- // A quiet visual field gives components something visible to sit over without pretending to be
- // a generated subject. The blocks scale with the requested canvas and carry no media semantics.
- const cell = Math.max(16, Math.round(m * 0.08));
- for (let y = border; y < height - border; y += cell) {
- for (let x = border; x < width - border; x += cell) {
- if (((x / cell) + (y / cell)) % 3 < 1) raster.fill(x, y, cell, cell, TEXT, 0.018);
- }
- }
-
- // Border.
- raster.fill(0, 0, width, border, ACCENT);
- raster.fill(0, height - border, width, border, ACCENT);
- raster.fill(0, 0, border, height, ACCENT);
- raster.fill(width - border, 0, border, height, ACCENT);
-
- // One label is enough; the rest of the card communicates by shape and colour.
- const tagScale = Math.max(2, Math.floor(m / 260));
- raster.text("STAND-IN", margin, margin, tagScale, ACCENT);
-
- const frameWidth = Math.max(Math.round(width * 0.42), margin * 5);
- const frameHeight = Math.max(Math.round(height * 0.28), margin * 4);
- const frameX = Math.round((width - frameWidth) / 2);
- const frameY = Math.round((height - frameHeight) / 2);
- const stroke = Math.max(3, Math.round(border / 2));
- raster.fill(frameX, frameY, frameWidth, stroke, MUTED, 0.75);
- raster.fill(frameX, frameY + frameHeight - stroke, frameWidth, stroke, MUTED, 0.75);
- raster.fill(frameX, frameY, stroke, frameHeight, MUTED, 0.75);
- raster.fill(frameX + frameWidth - stroke, frameY, stroke, frameHeight, MUTED, 0.75);
- raster.fill(frameX + stroke * 4, frameY + frameHeight - stroke * 6,
- Math.round(frameWidth * 0.34), stroke * 2, ACCENT, 0.9);
- raster.fill(frameX + Math.round(frameWidth * 0.58), frameY + stroke * 4,
- stroke * 4, stroke * 4, TEXT, 0.55);
-
- const lineScale = Math.max(2, Math.floor(m / 200));
- const frameLine = `${width} X ${height}`;
- raster.text(frameLine, Math.round((width - textWidth(frameLine, lineScale)) / 2),
- frameY + frameHeight + margin, lineScale, MUTED);
- return raster.png();
-}
-
-/** The band a video card carries under its picture: timecode, frame counter and progress bar. */
-export function drawClipTimeGuide(request: ClipTimeGuideRequest, frame: number): Uint8Array {
- const { width, height, frameRate, frameCount } = request;
- if (!Number.isSafeInteger(frame) || frame < 0 || frame >= frameCount) {
- throw new Error("Clip time guide frame lies outside its clip");
- }
- const border = Math.max(6, Math.round(Math.min(width, height) * 0.03));
- const band = Math.max(36, Math.round(height * 0.06));
- const margin = border * 2;
- const raster = new Raster(width, band, INK);
- raster.fill(0, 0, border, band, ACCENT);
- raster.fill(width - border, 0, border, band, ACCENT);
- const scale = Math.max(2, Math.floor((band - border) / (GLYPH_HEIGHT + 4)));
- const textY = Math.round((band - border - GLYPH_HEIGHT * scale) / 2);
- raster.text(timecode(frame, { frameRate, frameCount }), margin, textY, scale, TEXT);
- const counter = `F ${frame + 1}/${frameCount}`;
- raster.text(counter, width - margin - textWidth(counter, scale), textY, scale, MUTED);
- raster.fill(0, band - border, width, border, INK);
- raster.fill(0, band - border, Math.round(width * (frame + 1) / frameCount), border, ACCENT);
- return raster.png();
-}
-
-export type StandInDrawingEnvironment = {
- readonly putBytes: (bytes: Uint8Array, mediaType: string) => Promise<CanonicalValue>;
-};
-
-export function standInCardNeed(value: CanonicalValue): StandInCardRequest {
- verifyStandInCardRequest(value);
- return value;
-}
-
-/** Draw the Card image. */
-export async function renderStandInCard(
- env: StandInDrawingEnvironment,
- request: StandInCardRequest,
-): Promise<CanonicalValue> {
- return await env.putBytes(drawStandInCard(request), "image/png");
-}
diff --git a/packages/media-execution/src/execute.ts b/packages/media-execution/src/execute.ts
index b4aa8865..613a3a14 100644
--- a/packages/media-execution/src/execute.ts
+++ b/packages/media-execution/src/execute.ts
@@ -32,7 +32,6 @@ import {
} from "@hypit/protocol";
import type { BlobRef, CanonicalValue, StoredValue } from "@hypit/protocol";
-import { drawClipTimeGuide, renderStandInCard, standInCardNeed } from "./card.js";
import { parseMediaInspection } from "./probe.js";
import {
compositeAnimatedWebpFrame,
@@ -783,7 +782,6 @@ export async function executeRenderStillVideo(
const work = await mkdtemp(join(tmpdir(), "hypit-media-still-"));
try {
const output = join(work, "still.mp4");
- const baseOutput = need.request.guide === undefined ? output : join(work, "still-base.mp4");
const staged = new Map<string, string>();
const inputs: string[] = [];
for (const segment of need.request.segments) {
@@ -833,47 +831,12 @@ export async function executeRenderStillVideo(
...argv,
"-frames:v", String(need.request.frameCount), "-r", fps, "-fps_mode", "cfr",
"-c:v", "libx264", "-preset", "veryfast", "-pix_fmt", "yuv420p",
- "-movflags", "+faststart", baseOutput,
+ "-movflags", "+faststart", output,
],
timeoutMs: env.processTimeoutMs,
maxStdoutBytes: 64 * 1024,
...(env.sharedLibraryPath === undefined ? {} : { sharedLibraryPath: env.sharedLibraryPath }),
});
- if (need.request.guide === "clip-time") {
- const baseInspection = await outputInspection({
- path: baseOutput,
- mediaType: "video/mp4",
- ffprobePath: env.ffprobePath,
- timeoutMs: env.processTimeoutMs,
- maxProbeOutputBytes: env.maxProbeOutputBytes,
- ...(env.sharedLibraryPath === undefined ? {} : { sharedLibraryPath: env.sharedLibraryPath }),
- });
- const baseVisual = baseInspection.streams.find((item): item is MediaVideoStream => item.kind === "video");
- assert(baseVisual !== undefined, "Still media guide has no visual stream");
- for (let frame = 0; frame < need.request.frameCount; frame += 1) {
- await writeFile(join(work, `guide-${String(frame).padStart(6, "0")}.png`), drawClipTimeGuide({
- width: baseVisual.width,
- height: baseVisual.height,
- frameRate: need.request.frameRate,
- frameCount: need.request.frameCount,
- }, frame));
- }
- await runProcess({
- executable: env.ffmpegPath,
- argv: [
- "-y", "-i", baseOutput,
- "-framerate", fps, "-i", join(work, "guide-%06d.png"),
- "-filter_complex", "[0:v][1:v]overlay=0:main_h-overlay_h:shortest=1,format=yuv420p[v]",
- "-map", "[v]", "-an",
- "-frames:v", String(need.request.frameCount), "-r", fps, "-fps_mode", "cfr",
- "-c:v", "libx264", "-preset", "veryfast", "-pix_fmt", "yuv420p",
- "-movflags", "+faststart", output,
- ],
- timeoutMs: env.processTimeoutMs,
- maxStdoutBytes: 64 * 1024,
- ...(env.sharedLibraryPath === undefined ? {} : { sharedLibraryPath: env.sharedLibraryPath }),
- });
- }
const inspected = await outputInspection({
path: output,
mediaType: "video/mp4",
@@ -900,18 +863,6 @@ export async function executeRenderStillVideo(
}
}
-/** Draw a stand-in card for a generated output that has not been generated; a Provider draws, it never generates. */
-export async function executeDrawStandInCard(
- env: MediaExecutionEnvironment,
- constraints: CanonicalValue,
-): Promise<MediaOperationResult> {
- const request = standInCardNeed(constraints);
- const value = await renderStandInCard({
- putBytes: async (bytes, mediaType) => await env.artifacts.put(bytes, mediaType) as unknown as CanonicalValue,
- }, request);
- return artifactResult(value as unknown as BlobRef);
-}
-
type TransformPlan = {
readonly videoFilters: readonly string[];
readonly audioFilters: readonly string[];
diff --git a/packages/media-execution/src/index.ts b/packages/media-execution/src/index.ts
index ac3fa63b..fcc10457 100644
--- a/packages/media-execution/src/index.ts
+++ b/packages/media-execution/src/index.ts
@@ -7,11 +7,8 @@ export {
executeProjectSpeechEvidenceAudio,
executeRenderTimelineAudio,
executeRenderStillVideo,
- executeDrawStandInCard,
executeTransformMedia,
} from "./execute.js";
-export { drawClipTimeGuide, drawStandInCard } from "./card.js";
-export type { ClipTimeGuideRequest } from "./card.js";
export { parseMediaInspection } from "./probe.js";
export { verifyCompositableSurfaceBytes } from "./surface.js";
export { probeMediaToolchain } from "./toolchain.js";
diff --git a/packages/media-pipeline/README.md b/packages/media-pipeline/README.md
index 4c1a20bc..4c3856c4 100644
--- a/packages/media-pipeline/README.md
+++ b/packages/media-pipeline/README.md
@@ -67,10 +67,6 @@ Several images spread over one literal duration the same way, each held for its
</media:StillVideo>
```
-For a short-lived diagnostic clip, `guide="clip-time"` burns one coherent band containing the
-clip-local timecode, current frame and progress ruler. Omit it for clean production pixels. The
-guide says nothing about the clip's eventual position in a Film.
-
`StillVideo` returns a video-only MP4 `BlobArtifact`, not `SynchronizedMedia`. The Surface publishes the
duration and the weights as Records; `plan-still-video` divides the whole frame count among the
pictures (every picture holds at least one frame, the rest go by weight with leftovers to the largest
@@ -79,12 +75,10 @@ encoding is one `render-still-video` Need. Pictures of different sizes are fitte
frame and letterboxed. Inspection and normalization remain the same explicit steps used by imported
or generated moving video. The resulting Blob is ordinary time-bearing visual media. Its later role
comes entirely from the downstream Source relationships; StillVideo itself owns only the authored
-images, duration, frame clock and optional guide.
+images, duration and frame clock.
-The package also exposes one-picture Run Fragments. `still-video` takes `duration`, `clock`,
-`layout` and `source-0`; `clip-time-still-video` takes `duration`, `clock` and `source`, supplying
-the diagnostic layout itself. A Run can select either ordinary branch as a Candidate through an
-explicit `candidate` / `satisfy` decision.
+The package also exposes the one-picture Run Fragment `still-video`. It takes `duration`, `clock`,
+`layout` and `source-0`. A Run can select its `video` export as a Candidate through `satisfy`.
Four ordinary author operations reuse that same inspection/execution boundary:
diff --git a/packages/media-pipeline/src/activation.ts b/packages/media-pipeline/src/activation.ts
index 15c9d7e4..c1de4191 100644
--- a/packages/media-pipeline/src/activation.ts
+++ b/packages/media-pipeline/src/activation.ts
@@ -11,7 +11,6 @@ import {
mediaPipelineModuleRef,
mediaPipelineMarkupSurfaces,
stillVideoFragment,
- clipTimeStillVideoFragment,
} from "./index.js";
export const hypitPackage = {
@@ -22,7 +21,6 @@ export const hypitPackage = {
name: "@hypit/media-pipeline@1",
fragments: {
"still-video": stillVideoFragment,
- "clip-time-still-video": clipTimeStillVideoFragment,
},
}), createMarkupSurfaceHostFacet({
module: mediaPipelineModuleRef,
diff --git a/packages/media-pipeline/src/component.ts b/packages/media-pipeline/src/component.ts
index 3f5afa76..47febd12 100644
--- a/packages/media-pipeline/src/component.ts
+++ b/packages/media-pipeline/src/component.ts
@@ -229,15 +229,6 @@ export const mediaPipelineComponent = {
return { outputs: {}, needs: { image: canonicalize(need) } };
},
},
- {
- producer: mediaPipelineProducers.clipTimeLayout,
- handler: () => ({
- outputs: {
- layout: { kind: "inline", value: canonicalize({ weights: [1], guide: "clip-time" }) },
- },
- needs: {},
- }),
- },
{
producer: mediaPipelineProducers.planStill,
handler: ({ inputs }) => {
@@ -254,7 +245,6 @@ export const mediaPipelineComponent = {
const request = sealStillVideoRequest({
frameRate: clock.frameRate,
frameCount: frames,
- ...(layout.guide === undefined ? {} : { guide: layout.guide }),
output: { container: "mp4", codec: "h264", pixelFormat: "yuv420p" },
segments: planStillVideoSegments(frames, layout.weights),
});
diff --git a/packages/media-pipeline/src/fragment.ts b/packages/media-pipeline/src/fragment.ts
index 064303b7..18651440 100644
--- a/packages/media-pipeline/src/fragment.ts
+++ b/packages/media-pipeline/src/fragment.ts
@@ -165,39 +165,3 @@ export function createStillVideoFragment(count: number) {
}
export const stillVideoFragment = createStillVideoFragment(1);
-
-/** One picture held with a clip-local timecode, frame count and progress ruler for diagnosis. */
-export const clipTimeStillVideoFragment = sealGraphFragment({
- inputs: [
- { name: "duration", type: speechTypes.duration },
- { name: "clock", type: programSpaceTypes.clock },
- { name: "source", type: artifactTypes.blob },
- ],
- operations: [
- {
- id: "layout",
- producer: mediaPipelineProducers.clipTimeLayout,
- inputs: {},
- result: { kind: "output", name: "layout" },
- },
- {
- id: "plan",
- producer: mediaPipelineProducers.planStill,
- inputs: { duration: input("duration"), clock: input("clock"), layout: operation("layout") },
- result: { kind: "output", name: "request" },
- },
- {
- id: "bind",
- producer: mediaPipelineProducers.bindStill,
- inputs: { request: operation("plan"), source: input("source") },
- result: { kind: "output", name: "request" },
- },
- {
- id: "render",
- producer: mediaPipelineProducers.renderStill,
- inputs: { request: operation("bind") },
- result: { kind: "need", name: "video" },
- },
- ],
- exports: [{ name: "video", type: artifactTypes.blob, root: operation("render") }],
-});
diff --git a/packages/media-pipeline/src/index.ts b/packages/media-pipeline/src/index.ts
index f64d7a1c..d172dd42 100644
--- a/packages/media-pipeline/src/index.ts
+++ b/packages/media-pipeline/src/index.ts
@@ -7,7 +7,6 @@ export {
extractFrameFragment,
synchronizedMediaFragment,
stillVideoFragment,
- clipTimeStillVideoFragment,
createStillVideoFragment,
transformMediaFragment,
} from "./fragment.js";
diff --git a/packages/media-pipeline/src/manifest.ts b/packages/media-pipeline/src/manifest.ts
index c8ee5717..d14e9c7c 100644
--- a/packages/media-pipeline/src/manifest.ts
+++ b/packages/media-pipeline/src/manifest.ts
@@ -41,7 +41,6 @@ export const mediaPipelineProducers = {
transform: { module: mediaPipelineModuleRef, name: "request-media-transform" },
extractAudio: { module: mediaPipelineModuleRef, name: "request-audio-extraction" },
extractFrame: { module: mediaPipelineModuleRef, name: "request-frame-extraction" },
- clipTimeLayout: { module: mediaPipelineModuleRef, name: "clip-time-still-layout" },
planStill: { module: mediaPipelineModuleRef, name: "plan-still-video" },
renderStill: { module: mediaPipelineModuleRef, name: "request-still-video" },
bindStill: { module: mediaPipelineModuleRef, name: "bind-still-video-source" },
@@ -164,7 +163,6 @@ export const stillVideoRequestSchema: ValueSchema = {
},
} },
frameCount: { schema: { kind: "number", integer: true, minimum: 1 } },
- guide: { optional: true, schema: { kind: "literal", value: "clip-time" } },
output: { schema: {
kind: "object",
fields: {
@@ -196,7 +194,6 @@ export const stillVideoLayoutSchema: ValueSchema = {
kind: "object",
fields: {
weights: { schema: { kind: "array", items: { kind: "number", minimum: 0 } } },
- guide: { optional: true, schema: { kind: "literal", value: "clip-time" } },
},
};
@@ -306,8 +303,6 @@ export const mediaPipelineMarkupSurfaces = [
summary: "Sets the video's length in seconds, such as 6 or 2.5s; choose it from the visual passage this held image is meant to carry." },
{ name: "clock", kind: "reference", required: true, accepts: [programSpaceTypes.clock],
summary: "Selects the frame clock used by the generated MP4." },
- { name: "guide", kind: "literal", required: false, values: ["clip-time"],
- summary: "Burns one clip-local diagnostic band with timecode, frame count and a progress ruler into the held video." },
],
children: [
{ tag: "Still", cardinality: "many",
@@ -330,7 +325,6 @@ export const mediaPipelineMarkupSurfaces = [
"Write exactly one of source or Still children. Frames are whole: each image gets the floor of its share and the leftover frames go to the largest remainders, so the split is deterministic and every image holds at least one frame.",
"Images of different sizes are fitted into the first image's frame, letterboxed on black.",
"The result is a normal video Blob, not SynchronizedMedia and not a SemanticTake.",
- "The optional clip-time guide describes this clip's local frame domain, not its later position in a Film.",
"Use Normalize afterward exactly as for generated or imported moving video.",
"Encoding is a render-still-video Need fulfilled by the selected media Provider; this Surface never invokes FFmpeg itself.",
],
@@ -566,12 +560,6 @@ export const mediaPipelineManifest: ModuleManifest = {
returns: artifactTypes.blob,
}],
},
- {
- name: mediaPipelineProducers.clipTimeLayout.name,
- inputs: [],
- outputs: [{ name: "layout", type: mediaPipelineTypes.stillVideoLayout }],
- needs: [],
- },
{
name: mediaPipelineProducers.planStill.name,
inputs: [
diff --git a/packages/media-pipeline/src/operations.ts b/packages/media-pipeline/src/operations.ts
index 7d48fcf4..ad14e19c 100644
--- a/packages/media-pipeline/src/operations.ts
+++ b/packages/media-pipeline/src/operations.ts
@@ -123,7 +123,6 @@ export function verifyStillVideoLayout(value: unknown): asserts value is StillVi
for (const weight of layout.weights) {
assert(typeof weight === "number" && Number.isFinite(weight) && weight > 0, "StillVideoLayout weights must be positive");
}
- assert(layout.guide === undefined || layout.guide === "clip-time", "StillVideoLayout guide is unsupported");
}
export function sealStillVideoLayout(value: StillVideoLayout): StillVideoLayout {
@@ -171,7 +170,6 @@ export function verifyStillVideoRequest(value: unknown): asserts value is StillV
"StillVideoRequest.frameRate must be a positive rational");
assert(Number.isSafeInteger(request.frameCount) && (request.frameCount as number) > 0,
"StillVideoRequest.frameCount must be positive");
- assert(request.guide === undefined || request.guide === "clip-time", "StillVideoRequest guide is unsupported");
const output = object(request.output, "StillVideoRequest.output");
assert(output.container === "mp4" && output.codec === "h264" && output.pixelFormat === "yuv420p",
"StillVideoRequest output profile is unsupported");
diff --git a/packages/media-pipeline/src/surface.ts b/packages/media-pipeline/src/surface.ts
index 5310e804..2c99b38c 100644
--- a/packages/media-pipeline/src/surface.ts
+++ b/packages/media-pipeline/src/surface.ts
@@ -258,7 +258,7 @@ function stillPictures(
}
export const decodeStillVideoSurface: StructuredSurfaceHandler = ({ element, resolveReference }) => {
- exactAttributes(element, ["id", "duration", "clock"], ["source", "guide"]);
+ exactAttributes(element, ["id", "duration", "clock"], ["source"]);
const id = text(element, "id");
const pictures = stillPictures(element, resolveReference);
// The duration is the author's decision, written here; it is published as an ordinary
@@ -266,10 +266,6 @@ export const decodeStillVideoSurface: StructuredSurfaceHandler = ({ element, res
const durationSec = seconds(text(element, "duration"), `${element.name}.duration`, false);
const durationId = `${id}.duration`;
const layoutId = `${id}.layout`;
- const guide = element.attributes.guide;
- if (guide !== undefined && guide !== "clip-time") {
- throw new Error(`${element.name}.guide must be clip-time when written.`);
- }
const clock = typedReference(
element.attributes.clock,
`${element.name}.clock`,
@@ -288,7 +284,6 @@ export const decodeStillVideoSurface: StructuredSurfaceHandler = ({ element, res
type: mediaPipelineTypes.stillVideoLayout,
value: { kind: "inline", value: {
weights: pictures.map((picture) => picture.weight),
- ...(guide === undefined ? {} : { guide }),
} },
range: element.range,
}],
diff --git a/packages/media-pipeline/src/types.ts b/packages/media-pipeline/src/types.ts
index f9374fd0..ded0c04b 100644
--- a/packages/media-pipeline/src/types.ts
+++ b/packages/media-pipeline/src/types.ts
@@ -70,8 +70,6 @@ export type FrameExtractionRequest = {
/** How the still video divides its literal duration among its pictures: one weight per picture, in order. */
export type StillVideoLayout = {
readonly weights: readonly number[];
- /** Optional diagnostic guide burned into the held clip; omitted keeps production pixels clean. */
- readonly guide?: "clip-time";
};
/** One picture's span of the still video, in frames; `source` is bound one picture at a time. */
@@ -85,7 +83,6 @@ export type StillVideoSegment = {
export type StillVideoRequest = {
readonly frameRate: MediaRational;
readonly frameCount: number;
- readonly guide?: "clip-time";
readonly output: {
readonly container: "mp4";
readonly codec: "h264";
diff --git a/packages/media-track/README.md b/packages/media-track/README.md
index 36014b0d..0eeb92e6 100644
--- a/packages/media-track/README.md
+++ b/packages/media-track/README.md
@@ -1,9 +1,8 @@
# `@hypit/media-track`
Place images, prepared video or compositable surfaces over the semantic timeline. B-roll is a common
-use: the picture can illustrate a phrase while the A-roll's speech continues. A prepared speaking
-A-roll is normally presented directly by Speech Track, including an inset or transparent cutout, so
-its semantic, visual and audio outputs keep one owner. Media Items own independently timed pictures;
+use: the picture can illustrate a phrase while the A-roll's speech continues. Performance presents the semantic material as a full picture, inset or cutout.
+Media Items own independently timed pictures;
a Sequence owns one visual slot whose Members replace each other through Handoffs.
The Markup Track takes `semantic` and `canvas`. Its Surface projects authored Selections, Moments,
@@ -14,6 +13,45 @@ Moving media enters after [normalization](../media-pipeline/README.md), with the
frame clock already selected. Still images use their actual intrinsic Extent. Placement, fitting,
sampling and motion remain separate authored choices.
+## Display a semantic performance
+
+```svml
+<media:Track id="performance" semantic={speech.semantic} canvas={canvas}>
+ <media:Performance during="program" frame={layout.full}
+ appearance={look.performance}/>
+</media:Track>
+```
+
+`Performance` displays the prepared material in its enclosing Track's `semantic` input. `during`
+selects the whole program, a Segment or a Selection; the other Window forms work as usual. One
+Performance can span any number of Takes. Each plays at its original program position: if a Take
+begins at program second 5, a Window from seconds 7 to 10 shows source seconds 2 to 5. An audio-only
+interval contributes no picture. The presentation shares one frame, appearance and lifecycle across
+Take boundaries.
+
+Its appearance Recipe needs `stack-order` and can set fit, crop anchors, opacity, filters, clipping,
+padding, border, shadow and frame paint. `motion` moves the framed presentation, and `Sampling`
+children transform the fitted picture over the complete selected Window, without restarting at
+Take boundaries. `Sound` children attach prepared effects to its entrance or exit. Its original
+sound is independently available as `speech.audio` for Film. Use an Item with direct `media` for
+independent playback or source trim; Performance preserves the semantic assembly's source timing.
+
+```svml
+<media:Performance during={story.segment.explanation} frame={layout.full}
+ appearance={look.performance}>
+ <media:Sampling at="start" zoom="1"/>
+ <media:Sampling at="end" zoom="1.08"/>
+</media:Performance>
+```
+
+This excerpt belongs inside the same Media Track. Its selected passage determines the appearance
+interval, while the two Sampling keys direct a gradual push-in inside the unchanged Frame.
+
+For a fixed card, full picture, circle or cutout this is ordinary Media presentation. If video and
+graphics must resize, mask or move together, write a project component that owns that relationship.
+`projectSemanticMedia` supplies the same material spans to its drawing function. The component can
+use a browser program from `hypit/hyperframes` while Caption and independent overlays remain peers.
+
## Place the frame, then fit its contents
An Item or Sequence owns an outer destination `frame`. Each sampled source has a fitted content
diff --git a/packages/media-track/preview/Track.png b/packages/media-track/preview/Track.png
new file mode 100644
index 00000000..c9640348
Binary files /dev/null and b/packages/media-track/preview/Track.png differ
diff --git a/packages/media-track/preview/build.svrun b/packages/media-track/preview/build.svrun
index c1b5bdfc..f412b2c0 100644
--- a/packages/media-track/preview/build.svrun
+++ b/packages/media-track/preview/build.svrun
@@ -1,33 +1,5 @@
<?svml using="@hypit/run-markup@1"?>
-
<svrun version="1">
<author source="./preview.svml"/>
- <import from="@hypit/stand-in@1" as="stand-in"/>
- <import from="@hypit/semantic-take-estimate@1" as="estimate"/>
<target output="final.video"/>
- <fragment id="take-card" using="stand-in:timed-card">
- <input name="canvas" from="vertical"/>
- <input name="duration" value="8"/>
- <input name="clock" from="clock"/>
- </fragment>
- <fragment id="motion-a-card" using="stand-in:timed-card">
- <input name="canvas" from="vertical"/>
- <input name="duration" value="5"/>
- <input name="clock" from="clock"/>
- </fragment>
- <fragment id="motion-b-card" using="stand-in:timed-card">
- <input name="canvas" from="vertical"/>
- <input name="duration" value="5"/>
- <input name="clock" from="clock"/>
- </fragment>
- <satisfy output="take.video" candidate="take-card.video"/>
- <satisfy output="motion-a.video" candidate="motion-a-card.video"/>
- <satisfy output="motion-b.video" candidate="motion-b-card.video"/>
- <fragment id="take-timing" using="estimate:semantic-take">
- <input name="narrative" from="story"/>
- <input name="segment" from="story.segment.showcase"/>
- <input name="media" from="take-preview-media.media"/>
- <input name="policy" from="showcase-estimated.policy"/>
- </fragment>
- <satisfy output="showcase-semantic.take" candidate="take-timing.take"/>
</svrun>
diff --git a/packages/media-track/preview/flush.png b/packages/media-track/preview/flush.png
new file mode 100644
index 00000000..afc1787d
Binary files /dev/null and b/packages/media-track/preview/flush.png differ
diff --git a/packages/media-track/preview/preview.svml b/packages/media-track/preview/preview.svml
index c6ba09c8..d2608ffe 100644
--- a/packages/media-track/preview/preview.svml
+++ b/packages/media-track/preview/preview.svml
@@ -1,35 +1,13 @@
<?svml using="@hypit/markup@1"?>
-
-<!-- The catalogue picture for this package's Surfaces, and the Source it is drawn from.
-
- Everything here is the package's own sample: its copy, its Recipe values, its Canvas. Nothing
- about a project reaches this file, and nothing in it reaches a project. It exists so a reader
- can see the Surface's range in one picture, and so that picture can be made again.
-
- The checked-in Track.png is the package catalogue asset. This Source and its ordinary Run
- preserve how it was authored; regenerating the encoded frame is a normal Build.
-
- A placeholder shows the Frame treatment and nothing inside it. To look at the component before
- buying its pictures, select a generic stand-in Candidate in the Run. The Run supplies only the
- media shape its composition needs; the Profile's local media Endpoint draws and normalizes it,
- in Studio as in a Build:
-
- <import from="@hypit/stand-in@1" as="stand-in"/>
- <fragment id="a-card" using="stand-in:timed-card">
- <input name="canvas" from="vertical"/><input name="duration" value="5"/><input name="clock" from="clock"/>
- </fragment>
- <satisfy output="motion-a.video" candidate="a-card.video"/>
-
- A committed sample works the same way as a `file` Candidate on `motion-a.video`. Candidate
- selection is explicit in the Run; Studio never replaces missing media itself. -->
+<!-- A wordless catalogue composition using this package's two sample graphics.
+ The samples are the displayed content. Their frame treatments demonstrate fit,
+ padding, clipping and motion; build.svrun renders the same composition. -->
<svml>
<import from="@hypit/script@1"/>
- <import as="wording" from="@hypit/text@1"/>
- <import as="seedance" from="@hypit/seedance@1"/>
+ <import as="media" from="@hypit/media@1"/>
<import as="pipeline" from="@hypit/media-pipeline@1"/>
<import as="speech" from="@hypit/speech-track@1"/>
<import as="whisperx" from="@hypit/whisperx@1"/>
- <import as="estimate" from="@hypit/semantic-take-estimate@1"/>
<import as="media-track" from="@hypit/media-track@1"/>
<import as="space" from="@hypit/spatial@1"/>
<import as="program" from="@hypit/program-space@1"/>
@@ -37,58 +15,32 @@
<import as="render" from="@hypit/render-hyperframes@1"/>
<import as="recipes" source="./recipes.svs"/>
- <!-- The copy is written so the two inserts are up at the same time in the middle of it: a
- catalogue picture that shows one unit at a time says nothing about how two of them stack. -->
- <script id="story">
- <showcase><HOST>A Media Track lays @rounded pictures into Frames you place, @wide each one clipped
- and painted the way its Recipe says@/wide@/rounded, and hands the rest of the Canvas back.</showcase>
- </script>
-
+ <script id="story"><empty></empty></script>
<space:Canvas id="vertical" width="720" height="1280"/>
<program:Clock id="clock" frame-rate="30"/>
- <space:Frame id="speech-frame" within={vertical}
- left="0%" top="0%" right="100%" bottom="100%"/>
+ <space:Frame id="full" within={vertical} left="0%" top="0%" right="100%" bottom="100%"/>
<space:Frame id="card-a" within={vertical}
left="8%" top="16%" right="92%" bottom="46%"/>
<space:Frame id="card-b" within={vertical}
left="12%" top="52%" right="88%" bottom="78%"/>
+ <space:Extent id="picture-size" width="640" height="360"/>
+ <media:Image id="picture-a" src="./rounded.png"/>
+ <media:Image id="picture-b" src="./flush.png"/>
- <wording:Value id="direction">Locked medium close-up in a quiet daylight studio. Spoken dialogue.</wording:Value>
- <seedance:TextVideo id="take" model="mini" prompt={direction} duration="8" generate-audio="true"/>
- <seedance:TextVideo id="motion-a" model="mini" prompt={direction} duration="5"/>
- <seedance:TextVideo id="motion-b" model="mini" prompt={direction} duration="5"/>
-
- <pipeline:Normalize id="take-media" source={take.video}
- recipe={recipes.media.aroll} clock={clock}/>
- <pipeline:Normalize id="take-preview-media" source={take.video} clock={clock}
+ <pipeline:StillVideo id="duration" source={picture-a} duration="5" clock={clock}/>
+ <pipeline:Normalize id="duration-media" source={duration.video} clock={clock}
video="primary-moving" audio="none" span-authority="video"/>
- <pipeline:Normalize id="motion-a-media" source={motion-a.video}
- recipe={recipes.media.broll} clock={clock}/>
- <pipeline:Normalize id="motion-b-media" source={motion-b.video}
- recipe={recipes.media.broll} clock={clock}/>
- <whisperx:SemanticTake id="showcase-semantic" narrative={story}
- segment={story.segment.showcase} media={take-media.media} language="en"/>
- <estimate:SemanticTake id="showcase-estimated" narrative={story}
- segment={story.segment.showcase} media={take-preview-media.media}
- language="en" pace="normal" rounding="round"/>
+ <whisperx:SemanticTake id="showcase-time" narrative={story}
+ segment={story.segment.empty} media={duration-media.media}/>
+ <speech:Track id="speech"><speech:Take source={showcase-time.take}/></speech:Track>
- <speech:Track id="speech"
- visual-frame={speech-frame} visual-appearance={recipes.speech.visual} visual-z="0">
- <speech:Take source={showcase-semantic.take}/>
- </speech:Track>
-
- <!-- Rounded against square, padded against flush, sliding in against cutting: one Track showing
- what the Recipe decides rather than what the component always does. -->
<media-track:Track id="showcase" semantic={speech.semantic} canvas={vertical}>
- <media-track:Item id="rounded-card" media={motion-a-media.media} during={story.selection.rounded}
+ <media-track:Item id="rounded-card" image={picture-a} extent={picture-size} during="program"
frame={card-a} appearance={recipes.media.card} motion={recipes.motion.card}/>
- <media-track:Item id="flush-card" media={motion-b-media.media} during={story.selection.wide}
+ <media-track:Item id="flush-card" image={picture-b} extent={picture-size} during="program"
frame={card-b} appearance={recipes.media.wide} motion={recipes.motion.card}/>
</media-track:Track>
-
<film:Film id="main" canvas={vertical} semantic={speech.semantic} appearance={recipes.film.vertical}>
- <film:Track source={speech.visual}/>
- <film:Track source={speech.audio}/>
<film:Track source={showcase.visual}/>
</film:Film>
<render:Video id="final" composition={main.composition} semantic={speech.semantic}/>
diff --git a/packages/media-track/preview/recipes.svs b/packages/media-track/preview/recipes.svs
index 9459196d..4a4e90eb 100644
--- a/packages/media-track/preview/recipes.svs
+++ b/packages/media-track/preview/recipes.svs
@@ -1,22 +1,18 @@
<?svml using="@hypit/svs@1"?>
<sheet version="1">
+ media.performance { stack-order: 0; fit: cover; }
film.vertical { background: #09090B; }
- speech.visual { fit: cover; }
- speech.normal { language: en; pace: normal; rounding: round; }
-
- media.aroll { video: primary-moving; audio: default; span-authority: video; }
- media.broll { video: primary-moving; audio: none; span-authority: video; }
/* Rounded and padded, so the painted content box is visibly inset from the
Placement Frame Studio draws as a guide. */
media.card {
- stack-order: 40; fit: cover; playback: hold-start;
+ stack-order: 40; fit: cover;
frame-paint: #16161d; clip: rounded; radius: 24; padding: 12 12;
}
/* Square and flush, for contrast with media.card. */
media.wide {
- stack-order: 41; fit: cover; playback: hold-start;
+ stack-order: 41; fit: cover;
frame-paint: #1d1620; clip: frame;
border-width: 2; border-color: #ee7b6255;
}
diff --git a/packages/media-track/preview/rounded.png b/packages/media-track/preview/rounded.png
new file mode 100644
index 00000000..62e5fe35
Binary files /dev/null and b/packages/media-track/preview/rounded.png differ
diff --git a/packages/media-track/src/component.ts b/packages/media-track/src/component.ts
index 1bfbd01a..3fbe8b5b 100644
--- a/packages/media-track/src/component.ts
+++ b/packages/media-track/src/component.ts
@@ -1,3 +1,5 @@
+import { appendMediaPerformance } from "./performance.js";
+import type { SemanticTrack } from "@hypit/semantic-track";
import type { ComponentPackage, ProducerHandlerContext } from "@hypit/component-kit";
import type { CompositableSurfaceRef, SynchronizedMedia } from "@hypit/media";
import { canonicalize } from "@hypit/protocol";
@@ -88,6 +90,10 @@ function sequenceInputs(inputs: ProducerHandlerContext["inputs"]) {
export const mediaTrackComponent = {
producers: [
+ { producer: mediaTrackProducers.appendPerformance, handler: ({ inputs }) => ({ outputs: { set: output(appendMediaPerformance(
+ itemInputs(inputs), inline<SemanticTrack>(inputs.semantic?.value, "SemanticTrack"),
+ inline<ContentFit>(inputs.fit?.value, "ContentFit"), inline<MediaSampleLayerSpec>(inputs.sampleSpec?.value, "MediaSampleLayerSpec"),
+ )) }, needs: {} }) },
{ producer: mediaTrackProducers.createLayers, handler: () => ({ outputs: { layers: output(createMediaLayerSet()) }, needs: {} }) },
{ producer: mediaTrackProducers.appendPaintLayer, handler: ({ inputs }) => ({ outputs: { layers: output(appendMediaPaintLayer(
inline<MediaLayerSet>(inputs.layers?.value, "MediaLayerSet"),
diff --git a/packages/media-track/src/index.ts b/packages/media-track/src/index.ts
index 9bc00617..ebe07acb 100644
--- a/packages/media-track/src/index.ts
+++ b/packages/media-track/src/index.ts
@@ -46,8 +46,7 @@ export {
} from "./sounds.js";
export { appendMediaItem, appendMediaSequence, bindMediaItemClipPath, bindMediaSequenceClipPath, assertMediaItemSpec, assertMediaTrackHeader, assertMediaTrackProgram, assertMediaTrackProgramIdentity, assertMediaTrackSet, createMediaTrackSet, finalizeMediaTrack, projectMediaAudioTrack, projectMediaVisualTrack, sealMediaItemSpec, sealMediaTrackHeader, sealMediaTrackProgram } from "./program.js";
export { resolveVisualSampling } from "./sampling.js";
-export { lowerRestrictedSpeechVisualPresents } from "./restricted-speech.js";
-export type { RestrictedSpeechVisualClip } from "./restricted-speech.js";
+export { appendMediaPerformance } from "./performance.js";
export { decodeMediaSamplingKeyframe, decodeMediaTrackSurface } from "./surface.js";
export {
appendMediaSequenceMember,
diff --git a/packages/media-track/src/lower.ts b/packages/media-track/src/lower.ts
index 8f58b619..8629a3e2 100644
--- a/packages/media-track/src/lower.ts
+++ b/packages/media-track/src/lower.ts
@@ -208,7 +208,7 @@ function sampleElements(
style: mediaStyle,
}];
}
- const sampling = samplingOverrides[layer.id] ?? resolveVisualSampling({
+ const sampling = samplingOverrides[layer.id] ?? layer.sampling ?? resolveVisualSampling({
space,
sourceFrameRate: sourceTiming.frameRate,
sourceFrameCount: sourceTiming.frameCount,
diff --git a/packages/media-track/src/manifest.ts b/packages/media-track/src/manifest.ts
index f40cca88..b7a597e9 100644
--- a/packages/media-track/src/manifest.ts
+++ b/packages/media-track/src/manifest.ts
@@ -1,3 +1,4 @@
+import { visualTimedSamplingSchema } from "@hypit/composition";
import { readFile } from "node:fs/promises";
import { artifactDependency, artifactTypes } from "@hypit/artifact";
@@ -46,6 +47,7 @@ export const mediaTrackTypes = {
} satisfies Record<string, TypeRef>;
export const mediaTrackProducers = {
+ appendPerformance: { module: mediaTrackModuleRef, name: "append-media-performance" },
createLayers: { module: mediaTrackModuleRef, name: "create-media-layer-set" },
appendPaintLayer: { module: mediaTrackModuleRef, name: "append-media-paint-layer" },
appendStillLayer: { module: mediaTrackModuleRef, name: "append-still-media-layer" },
@@ -129,6 +131,7 @@ const visualSource: ValueSchema = { kind: "oneOf", variants: [
const paintLayer = object({ id: { schema: string }, kind: { schema: { kind: "literal", value: "paint" } }, paint: { schema: paint }, opacity: { schema: unsigned } });
const sampleLayer = object({
id: { schema: string }, kind: { schema: { kind: "literal", value: "sample" } }, source: { schema: visualSource },
+ sampling: { schema: visualTimedSamplingSchema, optional: true },
fit: { schema: contentFitSchema }, trim: { schema: trim, optional: true }, occupancy: { schema: occupancy, optional: true },
appearance: { schema: mediaSampleAppearanceSchema }, samplingMotion: { schema: mediaSamplingMotionSchema, optional: true },
});
@@ -364,18 +367,35 @@ export const mediaTrackMarkupSurfaces = [{
temporalTypes.instantSpec, temporalTypes.windowSpec, temporalTypes.instant, temporalTypes.window, mediaTrackTypes.program,
compositionTypes.visualTrack, compositionTypes.audioTrack],
vocabulary: {
- summary: "One Media Track: independently timed Items and replacement Sequences placed on a shared SemanticTrack and Canvas, lowered to one peer VisualTrack and, when audio is authored, one peer AudioTrack.",
+ summary: "Show the semantic performance, place independent media Items, and compose replacement Sequences on a shared SemanticTrack and Canvas. Publishes a VisualTrack and, when audio is authored, an AudioTrack.",
appearance: "Pictures and layered compositions occupy authored Frames on the Canvas. Each source is scaled and aligned inside its Frame's border and padding; a contain fit can leave space, while cover can crop. Paint and sampled Layers draw in Source order under a shared rectangular, rounded or Path clip, with optional border and shadows. Lifecycle motion moves the framed unit; Sampling pans, zooms or rotates the picture inside it. Each Item has an independent window. A Sequence shares one outer Frame while Members replace its contents through cut, crossfade, push, wipe, cover or page-turn Handoffs. Source playback determines whether moving content covers the whole assigned span. Absolute stack order decides which overlapping unit draws in front.",
preview: previewImage("Track.png"),
attributes: [
{ name: "id", kind: "identifier", required: true,
summary: "Names this Track and prefixes the identity of every Item, Sequence, layer and sound that does not name itself." },
{ name: "semantic", kind: "reference", required: true, accepts: [semanticTrackTypes.track],
- summary: "Selects the continuous SemanticTrack that fixes the frame domain and every semantic anchor." },
+ summary: "Supplies semantic time for every child and the prepared material shown by Performance." },
{ name: "canvas", kind: "reference", required: true, accepts: [spatialTypes.canvas],
summary: "Chooses the Canvas every Frame on this Track is measured inside." },
],
children: [
+ { tag: "Performance", cardinality: "many",
+ summary: "Shows the enclosing Track's semantic performance during a chosen interval, preserving each Take's original source position under one frame and continuous motion. Accepts Sampling and Sound children.",
+ attributes: [
+ { name: "id", kind: "identifier", required: false,
+ summary: "Names this presentation; otherwise its identity follows the shared Item/Performance order." },
+ { name: "frame", kind: "reference", required: true, accepts: [spatialTypes.frame],
+ summary: "Places the performance picture on the Canvas." },
+ { name: "appearance", kind: "reference", required: true, accepts: [svsRecipeType],
+ summary: "Uses the Media fitting, picture styling, frame paint, clipping, border and shadow properties. Source time follows the semantic performance.",
+ recipe: appearanceRecipeProperties.filter(property => !["playback", "trim-start", "trim-end"].includes(property.name)) },
+ { name: "motion", kind: "reference", required: false, accepts: [svsRecipeType],
+ summary: "Moves the whole framed presentation over its Window, across Take boundaries.",
+ recipe: motionRecipeProperties },
+ { name: "clip", kind: "reference", required: false, accepts: [spatialTypes.path],
+ summary: "Clips the presentation to an authored Path." },
+ ...temporalWindowAttributeVocabulary,
+ ] },
{ tag: "Item", cardinality: "many",
summary: "One independently timed picture on its own Frame, from a direct source or ordered Paint and Layer children, carrying its own Sampling and Sound children.",
attributes: [
@@ -439,16 +459,18 @@ export const mediaTrackMarkupSurfaces = [{
video="primary-moving" audio="none" span-authority="video" clock={clock}/>
<media-track:Track id="cutaways" semantic={speech.semantic} canvas={vertical}>
+ <media-track:Performance during="program" frame={full} appearance={recipes.media.presenter}/>
<media-track:Item id="bags" media={cutaway-bags.media} during={story.selection.bags}
frame={full} appearance={recipes.media.cutaway} motion={recipes.motion.cut}/>
</media-track:Track>`,
notes: [
- "A Track requires at least one Item or Sequence and accepts no text content.",
- "An Item states exactly one window form: `during`, `at` with `for`, `until` with `for`, or `start` with `end`. Bind `selection`, `segment` and/or `moment` only when the start/end expressions use them; different endpoints can use different bindings.",
+ "A Track requires at least one Performance, Item or Sequence and accepts no text content.",
+ "Performance and Item use one window form: `during`, `at` with `for`, `until` with `for`, or `start` with `end`. Bind `selection`, `segment` and/or `moment` only when the start/end expressions use them; different endpoints can use different bindings.",
+ "Performance uses the Track's existing semantic input. `during=\"program\"` shows all its prepared Takes in order; a Segment or Selection shows that interval at the corresponding source positions. Speech Track.audio independently supplies the original sound. Sampling pans, zooms or rotates the fitted picture across the whole selected Window.",
"A point expression is `program.start`, `program.end`, `selection.start`, `selection.end`, `segment.start`, `segment.end` or `moment.cue`, each optionally offset by `+` or `-` and a duration, or a bare duration read as an absolute position.",
"A unit that names a direct source names exactly one of `image`, `media` or `surface`; `extent` is required with `image` and refused otherwise.",
"`audio-gain` is refused without selected source audio.",
- "`clip` is refused on an Item or Sequence whose Recipe already states a clip.",
+ "`clip` is refused on a Performance, Item or Sequence whose Recipe already states a clip.",
"An `appearance` or `motion` Recipe is refused when it carries a property outside its own set.",
"`playback`, `trim-start` and `trim-end` are refused on durationless still material, and `trim-start` and `trim-end` are written together or not at all.",
"An `enter` or an `exit` operator requires its own `enter-frames` or `exit-frames`.",
@@ -584,6 +606,9 @@ export const mediaTrackManifest: ModuleManifest = {
{ name: mediaTrackProducers.createSounds.name, inputs: [], outputs: [{ name: "sounds", type: mediaTrackTypes.soundSet }], needs: [] },
{ name: mediaTrackProducers.appendSound.name, inputs: [{ name: "sounds", type: mediaTrackTypes.soundSet }, { name: "source", type: mediaTypes.synchronized }, { name: "spec", type: mediaTrackTypes.soundSpec }], outputs: [{ name: "sounds", type: mediaTrackTypes.soundSet }], needs: [] },
{ name: mediaTrackProducers.createSet.name, inputs: [], outputs: [{ name: "set", type: mediaTrackTypes.set }], needs: [] },
+ { name: mediaTrackProducers.appendPerformance.name, inputs: [...itemInputs,
+ { name: "semantic", type: semanticTrackTypes.track }, { name: "fit", type: spatialTypes.fit },
+ { name: "sampleSpec", type: mediaTrackTypes.sampleLayerSpec }], outputs: [{ name: "set", type: mediaTrackTypes.set }], needs: [] },
{ name: mediaTrackProducers.appendItem.name, inputs: itemInputs, outputs: [{ name: "set", type: mediaTrackTypes.set }], needs: [] },
{ name: mediaTrackProducers.bindItemClipPath.name, inputs: [{ name: "spec", type: mediaTrackTypes.itemSpec }, { name: "path", type: spatialTypes.path }], outputs: [{ name: "spec", type: mediaTrackTypes.itemSpec }], needs: [] },
{ name: mediaTrackProducers.bindSequenceClipPath.name, inputs: [{ name: "spec", type: mediaTrackTypes.sequenceSpec }, { name: "path", type: spatialTypes.path }], outputs: [{ name: "spec", type: mediaTrackTypes.sequenceSpec }], needs: [] },
diff --git a/packages/media-track/src/performance.ts b/packages/media-track/src/performance.ts
new file mode 100644
index 00000000..e934ecd5
--- /dev/null
+++ b/packages/media-track/src/performance.ts
@@ -0,0 +1,37 @@
+import { projectSemanticMedia } from "@hypit/semantic-track";
+import type { SemanticTrack } from "@hypit/semantic-track";
+import type { ContentFit } from "@hypit/spatial";
+import { appendTimedMediaLayer, createMediaLayerSet } from "./layers.js";
+import { appendMediaItem } from "./program.js";
+import type { MediaSampleLayerSpec } from "./types.js";
+
+type ItemArguments = Parameters<typeof appendMediaItem>;
+type PerformanceInput = {
+ set: ItemArguments[0]; header: ItemArguments[1]; space: ItemArguments[2]; canvas: ItemArguments[3];
+ layers: ItemArguments[4]; frame: ItemArguments[5]; spec: ItemArguments[6];
+ sounds: ItemArguments[7]; window: ItemArguments[8];
+};
+
+/** One framed unit and lifecycle containing all selected performance spans. */
+export function appendMediaPerformance(input: PerformanceInput, semantic: SemanticTrack, fit: ContentFit, sample: MediaSampleLayerSpec) {
+ if (semantic.id !== input.space.id) throw new Error("Media performance must belong to the composition's ProgramSpace.");
+ const layers = [...input.layers.layers];
+ for (const clip of projectSemanticMedia(semantic, input.window.span)) {
+ if (clip.media.visual === undefined) continue;
+ const [layer] = appendTimedMediaLayer(createMediaLayerSet(), clip.media, fit, {
+ ...sample, id: `${input.spec.id}:${clip.segmentId}`, trim: clip.source, occupancy: { mode: "once", align: "start" },
+ }).layers;
+ if (layer?.kind !== "sample") throw new Error("Performance media did not produce a sample.");
+ layers.push({ ...layer, sampling: {
+ sourceFrameRate: clip.media.timeline.frameRate,
+ sourceFrameCount: clip.media.timeline.frameCount,
+ segments: [{ target: {
+ startFrame: clip.span.startFrame - input.window.span.startFrame,
+ endFrameExclusive: clip.span.endFrameExclusive - input.window.span.startFrame,
+ }, sourceFrame: { numerator: clip.source.startFrame, denominator: 1 }, rate: { numerator: 1, denominator: 1 } }],
+ } });
+ }
+ if (layers.length === 0) return input.set;
+ return appendMediaItem(input.set, input.header, input.space, input.canvas, { layers }, input.frame,
+ input.spec, input.sounds, input.window);
+}
diff --git a/packages/media-track/src/program.ts b/packages/media-track/src/program.ts
index 5ea4cbae..9a533137 100644
--- a/packages/media-track/src/program.ts
+++ b/packages/media-track/src/program.ts
@@ -402,6 +402,7 @@ function sourceAudioClip(
candidate.kind === "sample" && candidate.id === value.sourceAudio!.fromLayer)!;
assert(layer.source.kind === "timed" && layer.source.audio !== undefined && layer.occupancy !== undefined,
`Media projection ${value.id} selected audio from an invalid layer.`);
+ assert(layer.sampling === undefined, "Explicit visual sampling has no source-audio projection; connect the Semantic AudioTrack for performance sound.");
const source = layer.source;
const audio = source.audio;
assert(audio !== undefined, `Media projection ${value.id} selected audio from an invalid layer.`);
diff --git a/packages/media-track/src/restricted-speech.ts b/packages/media-track/src/restricted-speech.ts
deleted file mode 100644
index f64cc7aa..00000000
--- a/packages/media-track/src/restricted-speech.ts
+++ /dev/null
@@ -1,113 +0,0 @@
-import type { VisualPresent } from "@hypit/composition";
-import { assertProgramSpaceIdentity, programSpaceFrameCount } from "@hypit/program-space";
-import type { ProgramSpace } from "@hypit/program-space";
-import type { BlobRef } from "@hypit/protocol";
-import { assertContentFit, assertIntrinsicExtent, assertSpatialFrame } from "@hypit/spatial";
-import type { ContentFit, IntrinsicExtent, SpatialFrame } from "@hypit/spatial";
-
-import { lowerMediaItemElements } from "./lower.js";
-import type {
- MediaFramePresentation,
- MediaItemProgram,
- MediaLifecycleMotion,
- MediaPaintLayerSpec,
- MediaSampleAppearance,
- MediaSamplingMotion,
-} from "./types.js";
-
-export type RestrictedSpeechVisualClip = {
- readonly id: string;
- readonly subjectId?: string;
- readonly span: { readonly startFrame: number; readonly endFrameExclusive: number };
- readonly artifact: BlobRef;
- readonly extent: IntrinsicExtent;
- readonly frameRate: { readonly numerator: number; readonly denominator: number };
- readonly frameCount: number;
- readonly frame: SpatialFrame;
- readonly fit: ContentFit;
- readonly stackingOrder: number;
- readonly presentation: MediaFramePresentation;
- readonly sampleAppearance: MediaSampleAppearance;
- readonly motion: MediaLifecycleMotion;
- readonly framePaint?: MediaPaintLayerSpec;
- readonly samplingMotion?: MediaSamplingMotion;
-};
-
-/**
- * Focused reuse point for Speech Track: one normalized muted Take and its
- * visual presentation inside a fixed Segment envelope, without Media Track
- * Window, playback/trim, source-audio or Sequence ownership.
- */
-export function lowerRestrictedSpeechVisualPresents(
- trackId: string,
- space: ProgramSpace,
- clips: readonly RestrictedSpeechVisualClip[],
-): readonly VisualPresent[] {
- assertProgramSpaceIdentity(space);
- if (!trackId) throw new Error("Restricted Speech visual requires an id.");
- const totalFrames = programSpaceFrameCount(space);
- return clips.map((clip, index) => {
- if (clip.artifact.kind !== "blob" || !clip.artifact.mediaType.startsWith("video/")) {
- throw new Error(`Speech visual ${clip.id} is not a normalized moving-video Blob.`);
- }
- assertIntrinsicExtent(clip.extent);
- assertSpatialFrame(clip.frame);
- assertContentFit(clip.fit);
- if (!Number.isSafeInteger(clip.stackingOrder)) throw new Error(`Speech visual ${clip.id} has an invalid stacking order.`);
- if (clip.frameRate.numerator !== space.frameRate.numerator
- || clip.frameRate.denominator !== space.frameRate.denominator) {
- throw new Error(`Speech visual ${clip.id} is not normalized to ProgramSpace frame rate.`);
- }
- const duration = clip.span.endFrameExclusive - clip.span.startFrame;
- if (!Number.isSafeInteger(clip.span.startFrame) || !Number.isSafeInteger(clip.span.endFrameExclusive)
- || clip.span.startFrame < 0 || clip.span.endFrameExclusive > totalFrames || duration <= 0
- || clip.frameCount !== duration) {
- throw new Error(`Speech visual ${clip.id} does not exactly cover its Segment frame span.`);
- }
- const item: MediaItemProgram = {
- id: `${trackId}:${clip.id}`,
- subjectId: clip.subjectId ?? clip.id,
- span: { ...clip.span },
- frame: structuredClone(clip.frame),
- presentation: structuredClone(clip.presentation),
- layers: [
- ...(clip.framePaint === undefined ? [] : [{
- id: clip.framePaint.id,
- kind: "paint" as const,
- paint: structuredClone(clip.framePaint.paint),
- opacity: clip.framePaint.opacity,
- }]),
- {
- id: `${trackId}:${clip.id}:foreground`,
- kind: "sample",
- source: {
- kind: "timed",
- artifact: structuredClone(clip.artifact),
- extent: structuredClone(clip.extent),
- frameRate: { ...clip.frameRate },
- frameCount: clip.frameCount,
- },
- fit: structuredClone(clip.fit),
- occupancy: { mode: "once", align: "start" },
- appearance: structuredClone(clip.sampleAppearance),
- ...(clip.samplingMotion === undefined ? {} : {
- samplingMotion: structuredClone(clip.samplingMotion),
- }),
- },
- ],
- motion: structuredClone(clip.motion),
- stacking: {
- order: clip.stackingOrder,
- tieBreak: `${trackId}:${String(index + 1).padStart(4, "0")}:${clip.id}`,
- },
- sounds: [],
- };
- return {
- id: item.id,
- subjectId: clip.subjectId ?? clip.id,
- span: { ...item.span },
- stacking: { ...item.stacking },
- elements: lowerMediaItemElements(item, space),
- };
- });
-}
diff --git a/packages/media-track/src/surface.ts b/packages/media-track/src/surface.ts
index c8053241..8db36ba8 100644
--- a/packages/media-track/src/surface.ts
+++ b/packages/media-track/src/surface.ts
@@ -85,6 +85,7 @@ type FragmentLayer =
type FragmentSound = { readonly sourceName: string; readonly specName: string };
type FragmentItem = {
+ readonly performance?: { readonly fitName: string; readonly sampleName: string };
readonly suffix: string;
readonly windowName: string;
readonly frameName: string;
@@ -170,7 +171,8 @@ function createMediaTrackSurfaceFragment(inputTypes: readonly { readonly name: s
set: operation(set), header: input("header"), space: operation("track:space"), canvas: input("canvas"),
layers: operation(layers), frame: input(item.frameName), spec, sounds: operation(sounds), window: input(item.windowName),
};
- operations.push({ id: appendId, producer: mediaTrackProducers.appendItem, inputs: common, result: { kind: "output", name: "set" } });
+ operations.push({ id: appendId, producer: item.performance === undefined ? mediaTrackProducers.appendItem : mediaTrackProducers.appendPerformance,
+ inputs: { ...common, ...(item.performance === undefined ? {} : { semantic: input("semantic"), fit: input(item.performance.fitName), sampleSpec: input(item.performance.sampleName) }) }, result: { kind: "output", name: "set" } });
set = appendId;
}
for (const sequence of sequences) {
@@ -328,6 +330,21 @@ export function decodeMediaSamplingKeyframe(element: StructuredElement): MediaSa
};
}
+function decodeSamplingMotion(element: StructuredElement, ignoreSiblingChildren = false): MediaSamplingMotion | undefined {
+ const keyframes = element.children.flatMap((child) => {
+ if (child.kind === "text") {
+ if (child.value.trim().length > 0) throw new Error(`${element.name} accepts only Sampling children.`);
+ return [];
+ }
+ if (!child.name.endsWith(":Sampling") && child.name !== "Sampling") {
+ if (ignoreSiblingChildren) return [];
+ throw new Error(`${element.name} accepts only Sampling children.`);
+ }
+ return [decodeMediaSamplingKeyframe(child)];
+ });
+ return keyframes.length === 0 ? undefined : { keyframes };
+}
+
function sourceLayer(
state: SurfaceBuilder,
context: SourceLayerContext,
@@ -339,18 +356,7 @@ function sourceLayer(
const appearance = element.attributes.appearance === undefined
? context.defaultRecipe
: recipe(reference(element.attributes.appearance, `${element.name}.appearance`, svsRecipeType, resolve), `${element.name}.appearance`);
- const keyframes = element.children.flatMap((child) => {
- if (child.kind === "text") {
- if (child.value.trim().length > 0) throw new Error(`${element.name} accepts only Sampling children.`);
- return [];
- }
- if (!child.name.endsWith(":Sampling") && child.name !== "Sampling") {
- if (context.ignoreSiblingChildren === true) return [];
- throw new Error(`${element.name} accepts only Sampling children.`);
- }
- return [decodeMediaSamplingKeyframe(child)];
- });
- const motion = keyframes.length === 0 ? undefined : { keyframes };
+ const motion = decodeSamplingMotion(element, context.ignoreSiblingChildren);
const layerSuffix = `${context.unitSuffix}-layer-${suffix(layerIndex)}`;
const layerId = context.defaultLayerId ?? optionalText(element, "id") ?? `${context.trackId}.${layerSuffix}`;
const fitName = `${layerSuffix}-fit`;
@@ -379,6 +385,7 @@ function unitLayers(
readonly appearance: SvsRecipe;
readonly directSource?: DeclaredVisualSource;
readonly allowFramePaint: boolean;
+ readonly allowEmpty?: boolean;
},
resolve: (path: string) => SurfaceResolvedReference | undefined,
): readonly FragmentLayer[] {
@@ -424,7 +431,7 @@ function unitLayers(
trackId: input.trackId, unitSuffix: input.unitSuffix, defaultRecipe: input.appearance, sourceElement: child,
}, layerIndex, resolve));
}
- if (layers.length === 0) throw new Error(`${input.element.name} requires a direct source or at least one Paint/Layer child.`);
+ if (layers.length === 0 && !input.allowEmpty) throw new Error(`${input.element.name} requires a direct source or at least one Paint/Layer child.`);
return layers;
}
@@ -507,14 +514,16 @@ export const decodeMediaTrackSurface: StructuredSurfaceHandler = ({ element, res
let hasAudio = false;
for (const child of element.children) {
if (child.kind === "text") {
- if (child.value.trim().length > 0) throw new Error(`${element.name} accepts only Item and Sequence children.`);
+ if (child.value.trim().length > 0) throw new Error(`${element.name} accepts only Performance, Item and Sequence children.`);
continue;
}
- if (child.name.endsWith(":Item") || child.name === "Item") {
+ const isPerformance = child.name.endsWith(":Performance") || child.name === "Performance";
+ if (isPerformance || child.name.endsWith(":Item") || child.name === "Item") {
itemIndex += 1;
const itemSuffix = suffix(itemIndex);
allowed(child, [
- "id", "image", "media", "surface", "extent", "frame", "appearance", "motion", "source-audio", "audio-gain",
+ "id", "frame", "appearance", "motion",
+ ...(isPerformance ? [] : ["image", "media", "surface", "extent", "source-audio", "audio-gain"]),
"clip", ...temporalWindowAttributeNames,
]);
const id = optionalText(child, "id") ?? `${trackId}.item.${itemSuffix}`;
@@ -528,10 +537,21 @@ export const decodeMediaTrackSurface: StructuredSurfaceHandler = ({ element, res
: recipe(reference(child.attributes.motion, `${child.name}.motion`, svsRecipeType, resolveReference), `${child.name}.motion`);
const temporal = createTemporalWindowProjection({ id, element: child, semantic, resolveReference });
state.records.push(...temporal.records); temporalComponents.push(...temporal.components); temporalFragments.push(...temporal.fragments);
- const directSource = declaredVisualSource(child, resolveReference);
- validateUnitChildren(child, directSource !== undefined, true);
+ const performance = isPerformance ? {
+ fitName: `item-${itemSuffix}-fit`, sampleName: `item-${itemSuffix}-sample`,
+ } : undefined;
+ const directSource = isPerformance ? undefined : declaredVisualSource(child, resolveReference);
+ validateUnitChildren(child, isPerformance || directSource !== undefined, true);
+ if (performance !== undefined) {
+ state.addRecord(performance.fitName, `${id}.fit`, spatialTypes.fit, decodeMediaFit(appearance), child.range);
+ if (appearance.properties.playback !== undefined || appearance.properties["trim-start"] !== undefined || appearance.properties["trim-end"] !== undefined) {
+ throw new Error(`${child.name} follows the performance's source time. Select its interval with during or start/end.`);
+ }
+ state.addRecord(performance.sampleName, `${id}.sample`, mediaTrackTypes.sampleLayerSpec,
+ decodeMediaSampleSpec(appearance, "content", "timed", decodeSamplingMotion(child, true), true), child.range);
+ }
const layers = unitLayers(state, { trackId, unitSuffix: `item-${itemSuffix}`, element: child, appearance,
- ...(directSource === undefined ? {} : { directSource }), allowFramePaint: true }, resolveReference);
+ ...(directSource === undefined ? {} : { directSource }), allowFramePaint: true, allowEmpty: isPerformance }, resolveReference);
const selectedAudio = sourceAudio(child);
const specName = `item-${itemSuffix}-spec`;
const windowName = `item-${itemSuffix}-window`;
@@ -548,12 +568,12 @@ export const decodeMediaTrackSurface: StructuredSurfaceHandler = ({ element, res
}
}
if (selectedAudio !== undefined || fragmentSounds.length > 0) hasAudio = true;
- items.push({ suffix: itemSuffix, windowName, frameName, specName,
+ items.push({ suffix: itemSuffix, windowName, frameName, specName, ...(performance === undefined ? {} : { performance }),
...(clipPathName === undefined ? {} : { clipPathName }), layers, sounds: fragmentSounds });
continue;
}
if (!(child.name.endsWith(":Sequence") || child.name === "Sequence")) {
- throw new Error(`${element.name} accepts only Item and Sequence children.`);
+ throw new Error(`${element.name} accepts only Performance, Item and Sequence children.`);
}
sequenceIndex += 1;
const sequenceSuffix = suffix(sequenceIndex);
@@ -632,7 +652,7 @@ export const decodeMediaTrackSurface: StructuredSurfaceHandler = ({ element, res
sequences.push({ suffix: sequenceSuffix, terminalName, frameName, specName,
...(clipPathName === undefined ? {} : { clipPathName }), members, sounds: sequenceSounds });
}
- if (items.length === 0 && sequences.length === 0) throw new Error(`${element.name} requires at least one Item or Sequence.`);
+ if (items.length === 0 && sequences.length === 0) throw new Error(`${element.name} requires at least one Performance, Item or Sequence.`);
const fragment = createMediaTrackSurfaceFragment(state.inputTypes, items, sequences, hasAudio);
return {
records: state.records,
diff --git a/packages/media-track/src/types.ts b/packages/media-track/src/types.ts
index b1f0d3ed..8536f6a1 100644
--- a/packages/media-track/src/types.ts
+++ b/packages/media-track/src/types.ts
@@ -1,4 +1,4 @@
-import type { FrameSpan } from "@hypit/composition";
+import type { FrameSpan, VisualTimedSampling } from "@hypit/composition";
import type { CompositableSurfaceRef, MediaRational } from "@hypit/media";
import type { BlobRef } from "@hypit/protocol";
import type {
@@ -95,6 +95,7 @@ export type MediaPaintLayerProgram = {
export type MediaSampleLayerProgram = {
readonly id: string;
readonly kind: "sample";
+ readonly sampling?: VisualTimedSampling;
readonly source: MediaVisualSource;
readonly fit: ContentFit;
readonly trim?: MediaVisualTrim;
diff --git a/packages/media-track/test/media-track.test.ts b/packages/media-track/test/media-track.test.ts
index 04578df0..6be77299 100644
--- a/packages/media-track/test/media-track.test.ts
+++ b/packages/media-track/test/media-track.test.ts
@@ -13,6 +13,7 @@ import type { CompositableSurfaceRef, SynchronizedMedia } from "@hypit/media";
import { artifactTypes } from "@hypit/artifact";
import { narrativeTypes } from "@hypit/narrative";
import {
+ appendMediaPerformance,
appendMediaPaintLayer,
appendMediaSound,
appendMediaItem,
@@ -759,6 +760,11 @@ test("the Media author Surface emits explicit graph edges for layers, semantic t
]),
node("media:Sound", { id: "proof-enter", source: ref("sfx"), at: "enter", gain: "0.5" }),
]),
+ node("media:Performance", { id: "presenter", frame: ref("frame"), clip: ref("clip-path"), appearance: ref("still-style"), motion: ref("motion"), during: ref("answer-segment") }, [
+ node("media:Sampling", { at: "start", zoom: "1" }),
+ node("media:Sampling", { at: "end", zoom: "1.08", x: "6" }),
+ node("media:Sound", { id: "presenter-enter", source: ref("sfx"), at: "enter" }),
+ ]),
node("media:Sequence", { id: "steps", frame: ref("frame"), appearance: ref("sequence-style"), until: ref("terminal"), "until-boundary": "end" }, [
node("media:Member", { id: "one", image: ref("still"), extent: ref("extent"), at: ref("cue1") }),
node("media:Member", { id: "two", surface: ref("surface"), appearance: ref("surface-style"), at: ref("cue2") }),
@@ -779,6 +785,9 @@ test("the Media author Surface emits explicit graph edges for layers, semantic t
const producers = fragment.operations.map((entry) => entry.producer.name);
assert.ok(producers.includes("append-still-media-layer"));
assert.ok(producers.includes("append-media-item"));
+ const performanceOperation = fragment.operations.find(entry => entry.producer.name === "append-media-performance");
+ assert.deepEqual(performanceOperation?.inputs.semantic, { kind: "fragment-input", name: "semantic" });
+ assert.equal(fragment.inputs.filter(entry => entry.type.name === semanticTrackTypes.track.name).length, 1);
assert.ok(producers.includes("append-timed-media-layer"));
assert.ok(producers.includes("append-surface-media-layer"));
assert.ok(producers.includes("append-media-paint-layer"));
@@ -794,13 +803,21 @@ test("the Media author Surface emits explicit graph edges for layers, semantic t
&& "subjectId" in record.value.value
? [String((record.value.value as { readonly subjectId: unknown }).subjectId)]
: []));
- assert.deepEqual([...temporalSubjects].sort(), ["one", "proof", "segment-card", "steps", "still-card", "two"]);
+ assert.deepEqual([...temporalSubjects].sort(), ["one", "presenter", "proof", "segment-card", "steps", "still-card", "two"]);
assert.ok(producers.includes("append-media-sound"));
assert.ok(fragment.inputs.some((entry) => entry.type.name === artifactTypes.blob.name));
assert.ok(fragment.inputs.some((entry) => entry.type.name === mediaTypes.synchronized.name));
assert.ok(fragment.inputs.some((entry) => entry.type.name === spatialTypes.path.name));
const itemSpecs = result.records.filter((entry) => entry.type.name === "MediaItemSpec");
- assert.equal(itemSpecs.length, 3);
+ assert.equal(itemSpecs.length, 4);
+ const performanceSample = result.records.find(entry => entry.id === "presenter.sample");
+ assert.ok(performanceSample?.value.kind === "inline");
+ assert.deepEqual((performanceSample.value.value as unknown as { samplingMotion: unknown }).samplingMotion, {
+ keyframes: [
+ { atProgress: 0, zoom: 1, offsetX: 0, offsetY: 0, rotationDeg: 0 },
+ { atProgress: 1, zoom: 1.08, offsetX: 6, offsetY: 0, rotationDeg: 0 },
+ ],
+ });
const selected = itemSpecs[2]!.value.kind === "inline"
? itemSpecs[2]!.value.value as unknown as MediaItemSpec
: undefined;
@@ -976,3 +993,37 @@ test("Sequence fails atomically on malformed order, topology, envelope and three
] }), createMediaSoundSet(), 120,
), /envelope/u);
});
+
+
+test("Performance keeps source positions and continuous picture motion across Takes", () => {
+ const performance = { ...semantic, items: semantic.items.map(item => ({ take: { ...item.take,
+ media: { ...item.take.media, visual: { artifact: { ...source, mediaType: "video/mp4" }, width: 720, height: 1280 } },
+ } })) };
+ const window = projectProgramWindow({ itemId: "performance", semantic: performance,
+ projection: { start: { ref: "absolute", at: { unit: "frames", value: 20 } },
+ end: { ref: "absolute", at: { unit: "frames", value: 100 } } } });
+ const set = appendMediaPerformance({ set: createMediaTrackSet(), header, space, canvas, frame,
+ layers: createMediaLayerSet(), spec: itemSpec({ id: "performance" }), sounds: createMediaSoundSet(), window },
+ performance, fit, sealMediaSampleLayerSpec({ id: "content", appearance, occupancy: { mode: "once", align: "start" },
+ samplingMotion: { keyframes: [
+ { atProgress: 0, zoom: 1, offsetX: 0, offsetY: 0, rotationDeg: 0 },
+ { atProgress: 1, zoom: 1.08, offsetX: 0, offsetY: -18, rotationDeg: 0 },
+ ] } }));
+ const visual = projectMediaVisualTrack(space, finalizeMediaTrack(set, header, space));
+ assert.equal(visual.presents.length, 1);
+ assert.deepEqual(visual.presents[0]!.span, { startFrame: 20, endFrameExclusive: 100 });
+ const videos = visual.presents[0]!.elements.filter(element => element.kind === "video");
+ assert.deepEqual(videos.map(video => video.kind === "video" ? video.sampling?.segments : undefined), [
+ [{ target: { startFrame: 0, endFrameExclusive: 10 }, sourceFrame: { numerator: 20, denominator: 1 }, rate: { numerator: 1, denominator: 1 } }],
+ [{ target: { startFrame: 10, endFrameExclusive: 70 }, sourceFrame: { numerator: 0, denominator: 1 }, rate: { numerator: 1, denominator: 1 } }],
+ [{ target: { startFrame: 70, endFrameExclusive: 80 }, sourceFrame: { numerator: 0, denominator: 1 }, rate: { numerator: 1, denominator: 1 } }],
+ ]);
+ const contentTransforms = visual.presents[0]!.elements.filter(element => element.id.endsWith(":sampling"));
+ assert.equal(contentTransforms.length, 3);
+ for (const element of contentTransforms) {
+ assert.deepEqual(element.animation?.keyframes.map(key => [key.atFrame, key.style]), [
+ [0, [{ name: "transform", value: "translate(0px,0px) rotate(0deg) scale(1)" }]],
+ [80, [{ name: "transform", value: "translate(0px,-18px) rotate(0deg) scale(1.08)" }]],
+ ]);
+ }
+});
diff --git a/packages/provider-hyperframes-local/README.md b/packages/provider-hyperframes-local/README.md
index 489925a3..487c18a8 100644
--- a/packages/provider-hyperframes-local/README.md
+++ b/packages/provider-hyperframes-local/README.md
@@ -7,7 +7,7 @@ Surface it decodes the exact bytes and checks declared dimensions, still/frame t
opaque/straight-alpha facts. These checks validate the typed rendering input; they do not create
content identity or hidden output metadata.
-Normalized transparent videos from Speech Track or Media Track use the ordinary video path.
+Normalized transparent videos displayed by Media or project components use the ordinary video path.
The engine decodes them to PNG frames with alpha, then Chrome blends them with lower layers and
the authored Canvas background. PNG is the intermediate capture format; it does not ask to erase
the Film's background. The returned MP4 contains the completed composition.
diff --git a/packages/provider-hyperframes-local/src/capture.ts b/packages/provider-hyperframes-local/src/capture.ts
index c7fba1fe..6b5ba25c 100644
--- a/packages/provider-hyperframes-local/src/capture.ts
+++ b/packages/provider-hyperframes-local/src/capture.ts
@@ -143,8 +143,13 @@ export async function captureStagedVisual(input: CaptureInput, controller: Abort
onProgress?.({ phase: "worker-start", worker, range: task, browserPid, elapsedMs: elapsedMs() });
for (let frame = task.startFrame; frame < task.endFrameExclusive; frame++) {
signal.throwIfAborted();
- const captured = await stage(`worker ${worker} frame ${frame}`, config.frameTimeoutMs,
- () => engine.captureFrameToBuffer(activeSession, frame, frame * fps.den / fps.num));
+ const captured = await stage(`worker ${worker} frame ${frame}`, config.frameTimeoutMs, async () => {
+ const capture = await engine.captureFrameToBuffer(activeSession, frame, frame * fps.den / fps.num);
+ const programError = await activeSession.page.evaluate(() =>
+ (window as unknown as { __hypitBrowserProgramError?: string }).__hypitBrowserProgramError);
+ if (programError !== undefined) throw new Error(`Browser program failed at frame ${frame}: ${programError}`);
+ return capture;
+ });
await writeFile(join(outputFrames, `${String(frame - range.startFrame).padStart(9, "0")}.png`), captured.buffer);
}
onProgress?.({ phase: "worker-complete", worker, range: task, browserPid, elapsedMs: elapsedMs() });
diff --git a/packages/provider-hyperframes-local/test/alpha.test.ts b/packages/provider-hyperframes-local/test/alpha.test.ts
index 5ddcc98a..627ad4cc 100644
--- a/packages/provider-hyperframes-local/test/alpha.test.ts
+++ b/packages/provider-hyperframes-local/test/alpha.test.ts
@@ -8,10 +8,10 @@ import { compileHyperframesDocument } from "@hypit/hyperframes";
import type { Narrative } from "@hypit/narrative";
import { parseScript, narrativeValue } from "@hypit/script";
import { materializeSemanticTake } from "@hypit/speech";
-import { appendSpeechTrackTake, assembleSpeechTrack, createSpeechTrackSet, projectSpeechTrackVisual,
- sealSpeechTrackHeader, sealSpeechTrackVisualSpec } from "@hypit/speech-track";
+import { appendSpeechTrackTake, assembleSpeechTrack, createSpeechTrackSet,
+ sealSpeechTrackHeader } from "@hypit/speech-track";
import { projectSemanticProgramSpace } from "@hypit/semantic-track";
-import { appendMediaItem, appendTimedMediaLayer, createMediaLayerSet, createMediaSoundSet, createMediaTrackSet,
+import { appendMediaPerformance, appendMediaItem, appendTimedMediaLayer, createMediaLayerSet, createMediaSoundSet, createMediaTrackSet,
finalizeMediaTrack, projectMediaVisualTrack, sealMediaItemSpec, sealMediaSampleLayerSpec, sealMediaTrackHeader } from "@hypit/media-track";
import { projectProgramWindow } from "../../../test/temporal-fixture.js";
import { MemoryResourceStore, ffmpegBytes, normalizeTestVideo, transparentVideoFixture, writeTestArtifact } from "../../../test/alpha-video-fixture.js";
@@ -44,14 +44,8 @@ test("transparent normalized media composites through both SemanticTake/Speech T
const fit = { sizing: "contain" as const, framePoint: { x: 0.5, y: 0.5 }, contentPoint: { x: 0.5, y: 0.5 },
offsetPx: { x: 0, y: 0 }, constraint: "bounded" as const };
const frame = { xPx: 0, yPx: 0, widthPx: 96, heightPx: 64 };
- const set = appendSpeechTrackTake(createSpeechTrackSet(), take, frame, fit, sealSpeechTrackVisualSpec({
- stackingOrder: 1,
- presentation: { clip: { kind: "frame" }, padding: { topPx: 0, rightPx: 0, bottomPx: 0, leftPx: 0 }, shadows: [] },
- sampleAppearance: { opacity: 1, filter: { blurPx: 0, brightness: 1, contrast: 1, saturation: 1 } },
- motion: { sustain: [] },
- }));
+ const set = appendSpeechTrackTake(createSpeechTrackSet(), take);
const semantic = assembleSpeechTrack(sealSpeechTrackHeader({ id: "speech" }), set);
- const speechVisual = projectSpeechTrackVisual(semantic, set);
const space = projectSemanticProgramSpace(semantic);
const header = sealMediaTrackHeader({ id: "broll" });
const layers = appendTimedMediaLayer(createMediaLayerSet(), broll, fit, sealMediaSampleLayerSpec({ id: "cutout",
@@ -66,6 +60,15 @@ test("transparent normalized media composites through both SemanticTake/Speech T
layers, { ...frame, xPx: 96 }, spec, createMediaSoundSet(), projectProgramWindow({
itemId: spec.id, semantic, projection: { start: { ref: "program.start" }, end: { ref: "program.end" } },
}));
+ const performanceHeader = sealMediaTrackHeader({ id: "performance" });
+ const performanceSpec = { ...spec, id: "performance", stackingOrder: 1 };
+ const performance = appendMediaPerformance({ set: createMediaTrackSet(), header: performanceHeader, space,
+ canvas: { widthPx: 192, heightPx: 64, origin: "top-left", xDirection: "right", yDirection: "down", pixelAspect: "square" },
+ layers: createMediaLayerSet(), frame, spec: performanceSpec, sounds: createMediaSoundSet(),
+ window: projectProgramWindow({ itemId: performanceSpec.id, semantic, projection: { start: { ref: "program.start" }, end: { ref: "program.end" } } }),
+ }, semantic, fit, sealMediaSampleLayerSpec({ id: "content", occupancy: { mode: "once", align: "start" },
+ appearance: { opacity: 1, filter: { blurPx: 0, brightness: 1, contrast: 1, saturation: 1 } } }));
+ const speechVisual = projectMediaVisualTrack(space, finalizeMediaTrack(performance, performanceHeader, space));
const brollVisual = projectMediaVisualTrack(space, finalizeMediaTrack(items, header, space));
const document = compileHyperframesDocument(sealComposition({ id: "alpha-proof",
canvas: { width: 192, height: 64, clearColor: "#143cdc" }, tracks: [speechVisual, brollVisual] }), space);
diff --git a/packages/provider-media-local/README.md b/packages/provider-media-local/README.md
index a2736cae..11667791 100644
--- a/packages/provider-media-local/README.md
+++ b/packages/provider-media-local/README.md
@@ -48,7 +48,7 @@ remain valid; the package neither pins a semantic Capability to one FFmpeg versi
system package manager.
The reusable display-materialization capabilities—inspection, normalization, transform, extraction,
-StillVideo and stand-in drawing—also opt into transient authoring execution. Speech-evidence projection,
+StillVideo—also opt into transient authoring execution. Speech-evidence projection,
programme-audio rendering and final muxing remain Build-only. This is declared per capability; the
Runtime and Studio contain no media capability allowlist.
diff --git a/packages/provider-media-local/package.json b/packages/provider-media-local/package.json
index 755c9d2c..a7d6fe7f 100644
--- a/packages/provider-media-local/package.json
+++ b/packages/provider-media-local/package.json
@@ -20,8 +20,7 @@
"@hypit/runtime": "workspace:*",
"@hypit/runtime-kit": "workspace:*",
"@hypit/runtime-host-node": "workspace:*",
- "@hypit/speech": "workspace:*",
- "@hypit/stand-in": "workspace:*"
+ "@hypit/speech": "workspace:*"
},
"devDependencies": {
"@hypit/driver-node": "workspace:*"
diff --git a/packages/provider-media-local/src/provider.ts b/packages/provider-media-local/src/provider.ts
index 9fa69c09..61f0160d 100644
--- a/packages/provider-media-local/src/provider.ts
+++ b/packages/provider-media-local/src/provider.ts
@@ -9,12 +9,10 @@ import {
executeProjectSpeechEvidenceAudio,
executeRenderTimelineAudio,
executeRenderStillVideo,
- executeDrawStandInCard,
executeTransformMedia,
} from "@hypit/media-execution";
import type { MediaExecutionEnvironment, MediaOperationResult } from "@hypit/media-execution";
import { mediaPipelineCapabilities } from "@hypit/media-pipeline";
-import { standInCapabilities } from "@hypit/stand-in";
import { isStreamingResourceStore } from "@hypit/runtime";
import { speechTypes } from "@hypit/speech";
import { defineEndpointPackage } from "@hypit/endpoint-kit";
@@ -127,13 +125,6 @@ export function createLocalMediaProvider(config: CreateLocalMediaProviderOptions
returns: artifactTypes.blob,
handler: operation(executeRenderStillVideo),
},
- {
- lifecycle: "immediate" as const,
- transient: true,
- capability: standInCapabilities.drawCard,
- returns: artifactTypes.blob,
- handler: operation(executeDrawStandInCard),
- },
{
lifecycle: "immediate" as const,
capability: mediaPipelineCapabilities.projectSpeechEvidenceAudio,
diff --git a/packages/provider-media-local/test/provider.test.ts b/packages/provider-media-local/test/provider.test.ts
index 10ebdcd0..fd46e53c 100644
--- a/packages/provider-media-local/test/provider.test.ts
+++ b/packages/provider-media-local/test/provider.test.ts
@@ -22,7 +22,6 @@ import {
selectMediaStreams,
} from "@hypit/media-pipeline";
import { canonicalize } from "@hypit/protocol";
-import { standInCapabilities } from "@hypit/stand-in";
import type { CapabilityRef, CanonicalValue, Need, TypeRef } from "@hypit/protocol";
import { createLocalMediaProvider } from "../src/index.js";
@@ -197,7 +196,6 @@ test("local media opts only reusable display materialization into transient exec
"extract-media-audio",
"extract-media-frame",
"render-still-video",
- "draw-card",
]);
assert.deepEqual(provider.offers.filter((offer) => offer.transient !== true)
.map((offer) => offer.capability.name), [
@@ -643,7 +641,6 @@ test("local media Provider transforms A/V and extracts ordinary audio and frame
request: {
frameRate: { numerator: 30, denominator: 1 },
frameCount: 15,
- guide: "clip-time",
output: { container: "mp4", codec: "h264", pixelFormat: "yuv420p" },
segments: [{ startFrame: 0, endFrameExclusive: 15, source: extractedFrame }],
},
@@ -870,36 +867,6 @@ test("local media Provider executes an end-aligned loop from the exact authored
}
});
-function pngSize(bytes: Uint8Array): { readonly width: number; readonly height: number } {
- const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
- assert.equal(Buffer.from(bytes.subarray(1, 4)).toString("ascii"), "PNG");
- return { width: view.getUint32(16), height: view.getUint32(20) };
-}
-
-test("local media Provider draws a stand-in Card image", async () => {
- const resources = new MemoryResourceStore();
- const fulfillBlob = async (request: Need): Promise<Awaited<ReturnType<MemoryResourceStore["put"]>>> => {
- const provider = await handlerFor(request);
- const result = await provider.handler({
- command: { kind: "fulfill-need", id: `command:${request.id}`, need: request },
- need: request,
- resources,
- credentials: {},
- });
- assert.equal(result.value.kind, "blob");
- return result.value as Awaited<ReturnType<MemoryResourceStore["put"]>>;
- };
- const picture = await fulfillBlob(need("need:card-image", standInCapabilities.drawCard, artifactTypes.blob, canonicalize({
- width: 640, height: 400,
- })));
- assert.equal(picture.kind, "blob");
- assert.equal(picture.mediaType, "image/png");
- const bytes = await resources.get(picture.resource);
- assert.ok(bytes !== undefined);
- assert.deepEqual(pngSize(bytes), { width: 640, height: 400 });
-});
-
-
test("audio range preserves loop phase, tempo and intersected fades from the full programme", { skip: !hasMediaBinaries }, async () => {
const root = await mkdtemp(join(tmpdir(), "hypit-audio-range-"));
try {
diff --git a/packages/script/README.md b/packages/script/README.md
index 8b183e6d..762b833b 100644
--- a/packages/script/README.md
+++ b/packages/script/README.md
@@ -48,7 +48,7 @@ The Surface exports one full Narrative plus narrow, immutable views:
Role cues and right-side Dual Text pronunciation, for a speech-video model;
- `script.segment.<id>.speech` is ordinary pronunciation-only `Text` for duration estimation or TTS;
- `script.caption` is one complete `CaptionDocument`: ordered display Words, N:M Alignment Units,
- and authored Cue Breaks;
+ and authored Cue Breaks, empty when the Script has no visible Caption words;
- `script.selection.<id>` is a reusable explicit Selection;
- `script.moment.<id>` is a reusable explicit Moment.
diff --git a/packages/script/src/narrative.ts b/packages/script/src/narrative.ts
index a5ad449c..fbe8c311 100644
--- a/packages/script/src/narrative.ts
+++ b/packages/script/src/narrative.ts
@@ -69,7 +69,6 @@ function projectCaption(parsed: ParsedNarrative, id: string, narrativeId: string
throw new Error(`Caption identity region ${region.id} does not structurally partition its authored speech`);
}
}
- if (units.length === 0 || words.length === 0) throw new Error("Caption document contains no visible words");
const tokenIndex = new Map(parsed.tokens.map((token) => [token.id, token.index]));
const cueBreaks = parsed.captionProjection.breaks.map((breakPoint) => {
diff --git a/packages/script/test/markup-integration.test.ts b/packages/script/test/markup-integration.test.ts
index afae9d1f..c519840c 100644
--- a/packages/script/test/markup-integration.test.ts
+++ b/packages/script/test/markup-integration.test.ts
@@ -208,3 +208,20 @@ test("a module can use Markup's generic structured parser without adding another
(error: unknown) => error instanceof MarkupFrontendError && error.code === "MARKUP_SURFACE_OUTPUT",
);
});
+
+test("a wordless Script publishes its Segment and an empty CaptionDocument", async () => {
+ const result = await decodeMarkup({
+ name: "wordless.svml",
+ text: '<svml><import from="@hypit/script@1"/><script id="story"><empty></empty></script></svml>',
+ }, scriptContext());
+ const narrative = result.records.find((record) => record.id === "story")!;
+ assert.equal(narrative.value.kind, "inline");
+ const value = (narrative.value as { kind: "inline"; value: unknown }).value as Narrative;
+ assert.deepEqual(value.tokens, []);
+ assert.equal(value.segments[0]?.id, "empty");
+ assert.ok(result.records.some((record) => record.id === "story.segment.empty"));
+ assert.deepEqual(result.records.find((record) => record.id === "story.caption")?.value, {
+ kind: "inline",
+ value: { narrativeId: "story", id: "story.caption", units: [], words: [], cueBreaks: [] },
+ });
+});
diff --git a/packages/semantic-take-estimate/README.md b/packages/semantic-take-estimate/README.md
deleted file mode 100644
index f12a95a4..00000000
--- a/packages/semantic-take-estimate/README.md
+++ /dev/null
@@ -1,83 +0,0 @@
-# `@hypit/semantic-take-estimate`
-
-An explicit, provider-free semantic step for preview Builds.
-
-```text
-Narrative + spoken Segment + normalized SynchronizedMedia + SpeechEstimatePolicy
- -> syllable-weighted Token windows with real gaps
- -> SemanticTake
-```
-
-The package consumes existing normalized media. It knows nothing about how that media was made and
-does not run an acoustic model. For a spoken Segment it preserves the Script's exact Segment, Token
-and Anchor identities and predicts only their local frame positions. The media's complete frame
-count is the allocation budget: after short edge and word gaps, every remaining frame is
-distributed across Tokens by pronunciation-unit weight.
-
-```svml
-<estimated:SemanticTake id="opening-estimated" narrative={story}
- segment={story.segment.opening} media={opening-media.media}
- language="en" pace="normal" rounding="round"/>
-```
-
-For a spoken Segment, write the delivery policy inline as above or name an SVS Recipe with
-`policy={recipes.speech.normal}`. `hypit measure` helps the author choose the media duration and
-balance delivery across spoken Segments; the prediction then distributes that known frame domain
-across the authored words.
-
-An empty Segment already has all of the semantic timing it can carry: its start and end. Omit the
-policy and the Surface maps those two authored Anchors to the prepared media boundaries without a
-prediction step:
-
-```svml
-<estimated:SemanticTake id="pause-preview" narrative={story}
- segment={story.segment.pause} media={pause-media.media}/>
-```
-
-The result has the ordinary `@hypit/speech@1#SemanticTake` type. A Run can therefore choose this
-Build output while real A-roll is unavailable, then later choose the corresponding WhisperX output
-without changing Speech Track, Caption, Selection or Studio protocols.
-
-For example, a later Studio Run may satisfy its ordinary measured-take output with the earlier
-estimated Build product:
-
-```svrun
-<build-record id="opening-preview" build="bld_..." output="opening-estimated.take"/>
-<satisfy output="opening-semantic.take" candidate="opening-preview"/>
-```
-
-This is ordinary Run candidate selection. Studio can evaluate deterministic work and the immediate
-capabilities that the selected Provider permits for transient execution. Other required media work
-can be completed through a Build and selected from its Result.
-
-## Run Fragment
-
-The package also registers `@hypit/semantic-take-estimate@1#semantic-take` as a Run Fragment:
-
-| Input | Type |
-| --- | --- |
-| `narrative` | `@hypit/narrative@1#Narrative` |
-| `segment` | `@hypit/narrative@1#NarrativeExcerpt` |
-| `media` | `@hypit/media@1#SynchronizedMedia` |
-| `policy` | `@hypit/estimate@1#SpeechEstimatePolicy` |
-
-Its export is `take`, an ordinary SemanticTake. For a spoken Segment, the policy is a typed value
-with `language`, `pace` or `rate`, `rounding` and optional `paddingSec`; the Author Surface publishes
-it as `<id>.policy`. For an Author entry containing
-the `opening-estimated` declaration above, a Run can use:
-
-```svrun
-<import as="estimate" from="@hypit/semantic-take-estimate@1"/>
-<fragment id="timing" using="estimate:semantic-take">
- <input name="narrative" from="story"/>
- <input name="segment" from="story.segment.opening"/>
- <input name="media" from="opening-media.media"/>
- <input name="policy" from="opening-estimated.policy"/>
-</fragment>
-<satisfy output="opening-semantic.take" candidate="timing.take"/>
-```
-
-This selects predicted timing while retaining the required prepared-media dependency and any Run
-choice for its source bytes. The estimate allocates the media's complete frame count; it neither
-generates nor normalizes that media. An empty Segment instead uses the Surface's boundary branch
-shown above and has no policy Fragment to select.
diff --git a/packages/semantic-take-estimate/package.json b/packages/semantic-take-estimate/package.json
deleted file mode 100644
index d7d6b3ae..00000000
--- a/packages/semantic-take-estimate/package.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "name": "@hypit/semantic-take-estimate",
- "version": "0.0.0-dev",
- "license": "SEE LICENSE IN LICENSE",
- "private": true,
- "type": "module",
- "exports": {
- ".": "./src/index.ts"
- },
- "hypit": {
- "activation": "./src/activation.ts"
- },
- "dependencies": {
- "@hypit/component-kit": "workspace:*",
- "@hypit/elaborator": "workspace:*",
- "@hypit/estimate": "workspace:*",
- "@hypit/markup": "workspace:*",
- "@hypit/media": "workspace:*",
- "@hypit/narrative": "workspace:*",
- "@hypit/protocol": "workspace:*",
- "@hypit/run": "workspace:*",
- "@hypit/speech": "workspace:*",
- "@hypit/svs": "workspace:*"
- },
- "devDependencies": {
- "@hypit/script": "workspace:*"
- }
-}
diff --git a/packages/semantic-take-estimate/src/activation.ts b/packages/semantic-take-estimate/src/activation.ts
deleted file mode 100644
index 8a82c9a7..00000000
--- a/packages/semantic-take-estimate/src/activation.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { createMarkupSurfaceHostFacet } from "@hypit/markup";
-import { createRunFragmentHostFacet } from "@hypit/run";
-
-import {
- decodeSemanticTakeEstimateSurface,
- semanticTakeEstimateComponent,
- semanticTakeEstimateManifest,
- semanticTakeEstimateMarkupSurfaces,
- semanticTakeEstimateModuleRef,
-} from "./index.js";
-import { semanticTakeEstimateFragment } from "./fragment.js";
-
-export const hypitPackage = {
- format: "hypit.node-package@1" as const,
- modules: [{ manifest: semanticTakeEstimateManifest }],
- components: [semanticTakeEstimateComponent],
- hostFacets: [createRunFragmentHostFacet({
- name: "@hypit/semantic-take-estimate@1",
- fragments: { "semantic-take": semanticTakeEstimateFragment },
- }), createMarkupSurfaceHostFacet({
- module: semanticTakeEstimateModuleRef,
- declaration: semanticTakeEstimateMarkupSurfaces.find((item) => item.name === "semantic-take")!,
- handler: decodeSemanticTakeEstimateSurface,
- })],
-};
-
-export default hypitPackage;
diff --git a/packages/semantic-take-estimate/src/component.ts b/packages/semantic-take-estimate/src/component.ts
deleted file mode 100644
index 4770d434..00000000
--- a/packages/semantic-take-estimate/src/component.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import type { ComponentPackage } from "@hypit/component-kit";
-import type { SpeechEstimatePolicy } from "@hypit/estimate";
-import type { SynchronizedMedia } from "@hypit/media";
-import type { Narrative, NarrativeExcerpt } from "@hypit/narrative";
-import { canonicalize } from "@hypit/protocol";
-import type { StoredValue } from "@hypit/protocol";
-
-import { semanticTakeEstimateProducers } from "./manifest.js";
-import { materializeEstimatedSemanticTake } from "./program.js";
-
-function inline<T>(value: StoredValue | undefined, subject: string): T {
- if (value?.kind !== "inline") throw new Error(`${subject} must be inline`);
- return value.value as unknown as T;
-}
-
-export const semanticTakeEstimateComponent = {
- producers: [{
- producer: semanticTakeEstimateProducers.materialize,
- handler: ({ inputs }) => ({
- outputs: {
- take: {
- kind: "inline",
- value: canonicalize(materializeEstimatedSemanticTake(
- inline<Narrative>(inputs.narrative?.value, "Narrative"),
- inline<NarrativeExcerpt>(inputs.segment?.value, "NarrativeExcerpt"),
- inline<SynchronizedMedia>(inputs.media?.value, "SynchronizedMedia"),
- inline<SpeechEstimatePolicy>(inputs.policy?.value, "SpeechEstimatePolicy"),
- )),
- },
- },
- needs: {},
- }),
- }],
-} satisfies ComponentPackage;
diff --git a/packages/semantic-take-estimate/src/fragment.ts b/packages/semantic-take-estimate/src/fragment.ts
deleted file mode 100644
index dc1faea0..00000000
--- a/packages/semantic-take-estimate/src/fragment.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-import { estimateTypes } from "@hypit/estimate";
-import { sealGraphFragment } from "@hypit/elaborator";
-import { mediaTypes } from "@hypit/media";
-import { narrativeTypes } from "@hypit/narrative";
-import { speechProducers, speechTypes } from "@hypit/speech";
-
-import { semanticTakeEstimateProducers } from "./manifest.js";
-
-const input = (name: string) => ({ kind: "fragment-input" as const, name });
-const operation = (id: string) => ({ kind: "fragment-operation" as const, operation: id });
-
-export const semanticTakeEstimateFragment = sealGraphFragment({
- inputs: [
- { name: "narrative", type: narrativeTypes.narrative },
- { name: "segment", type: narrativeTypes.excerpt },
- { name: "media", type: mediaTypes.synchronized },
- { name: "policy", type: estimateTypes.speechPolicy },
- ],
- operations: [{
- id: "materialize",
- producer: semanticTakeEstimateProducers.materialize,
- inputs: {
- narrative: input("narrative"),
- segment: input("segment"),
- media: input("media"),
- policy: input("policy"),
- },
- result: { kind: "output", name: "take" },
- }],
- exports: [{ name: "take", type: speechTypes.semanticTake, root: operation("materialize") }],
-});
-
-/** The zero-Token branch of the same preview Surface; media boundaries need no prediction policy. */
-export const semanticTakeEstimateBoundaryFragment = sealGraphFragment({
- inputs: [
- { name: "narrative", type: narrativeTypes.narrative },
- { name: "segment", type: narrativeTypes.excerpt },
- { name: "media", type: mediaTypes.synchronized },
- ],
- operations: [{
- id: "materialize-boundaries",
- producer: speechProducers.materializeSegmentBoundaries,
- inputs: {
- narrative: input("narrative"),
- segment: input("segment"),
- media: input("media"),
- },
- result: { kind: "output", name: "take" },
- }],
- exports: [{ name: "take", type: speechTypes.semanticTake, root: operation("materialize-boundaries") }],
-});
diff --git a/packages/semantic-take-estimate/src/index.ts b/packages/semantic-take-estimate/src/index.ts
deleted file mode 100644
index b2dda6ce..00000000
--- a/packages/semantic-take-estimate/src/index.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-export { semanticTakeEstimateComponent } from "./component.js";
-export { semanticTakeEstimateBoundaryFragment, semanticTakeEstimateFragment } from "./fragment.js";
-export {
- semanticTakeEstimateManifest,
- semanticTakeEstimateMarkupSurfaces,
- semanticTakeEstimateModuleRef,
- semanticTakeEstimateProducers,
-} from "./manifest.js";
-export {
- estimateSemanticTakeTiming,
- materializeEstimatedSemanticTake,
-} from "./program.js";
-export { decodeSemanticTakeEstimateSurface } from "./surface.js";
diff --git a/packages/semantic-take-estimate/src/manifest.ts b/packages/semantic-take-estimate/src/manifest.ts
deleted file mode 100644
index 54a19812..00000000
--- a/packages/semantic-take-estimate/src/manifest.ts
+++ /dev/null
@@ -1,92 +0,0 @@
-import { estimateModuleRef, estimateTypes } from "@hypit/estimate";
-import { mediaDependency, mediaTypes } from "@hypit/media";
-import { narrativeDependency, narrativeTypes } from "@hypit/narrative";
-import type { ModuleManifest, ProducerRef } from "@hypit/protocol";
-import { speechDependency, speechTypes } from "@hypit/speech";
-import { svsRecipeType } from "@hypit/svs";
-
-export const semanticTakeEstimateModuleRef = { name: "@hypit/semantic-take-estimate", version: "1" } as const;
-
-export const semanticTakeEstimateProducers = {
- materialize: { module: semanticTakeEstimateModuleRef, name: "materialize-estimated-semantic-take" },
-} satisfies Record<string, ProducerRef>;
-
-export const semanticTakeEstimateMarkupSurfaces = [{
- name: "semantic-take",
- tag: "SemanticTake",
- mode: "structured",
- outputs: [estimateTypes.speechPolicy, speechTypes.semanticTake],
- vocabulary: {
- summary:
- "Publishes a preview SemanticTake: predicted word windows for speech, or exact prepared-media boundaries for an empty Segment.",
- attributes: [
- { name: "id", kind: "identifier", required: true,
- summary: "Names this estimated alignment and the SemanticTake it publishes." },
- { name: "narrative", kind: "reference", required: true, accepts: [narrativeTypes.narrative],
- summary: "Selects the authored Narrative that owns every Token and Anchor identity." },
- { name: "segment", kind: "reference", required: true, accepts: [narrativeTypes.excerpt],
- summary: "Selects the single authored Segment represented by the prepared media." },
- { name: "media", kind: "reference", required: true, accepts: [mediaTypes.synchronized],
- summary: "Selects the already normalized SynchronizedMedia whose exact frame domain receives the estimate." },
- { name: "policy", kind: "reference", required: false, accepts: [svsRecipeType],
- summary: "For a Segment with Tokens, selects an SVS Recipe carrying the delivery policy in place of inline attributes.",
- recipe: [
- { name: "language", required: true, summary: "Selects the counting rules the Segment is read with, or detects them.", values: ["auto", "en", "zh", "ja", "es"] },
- { name: "pace", required: false, summary: "Selects a named delivery density.", values: ["slow", "normal", "fast"] },
- { name: "rate", required: false, summary: "Sets the delivery density in pronunciation units per second, in place of pace." },
- { name: "rounding", required: true, summary: "Selects how an estimated duration is rounded.", values: ["none", "round", "ceil"] },
- ] },
- { name: "language", kind: "literal", required: false, values: ["auto", "en", "zh", "ja", "es"],
- summary: "For a Segment with Tokens, selects the counting rules or detects them from its Text." },
- { name: "pace", kind: "literal", required: false, values: ["slow", "normal", "fast"],
- summary: "Selects a named delivery density for the chosen language." },
- { name: "rate", kind: "literal", required: false,
- summary: "Sets the delivery density in pronunciation units per second, in place of pace." },
- { name: "rounding", kind: "literal", required: false, values: ["none", "round", "ceil"],
- summary: "Selects how an estimated duration is rounded." },
- ],
- ports: [
- { name: "take", type: speechTypes.semanticTake,
- summary: "The estimated SemanticTake, addressed as `<id>.take`." },
- { name: "policy", type: estimateTypes.speechPolicy,
- summary: "For a Segment with Tokens, the sealed delivery policy addressed as `<id>.policy`." },
- ],
- example: `<estimated:SemanticTake id="opening-estimated" narrative={story}
- segment={story.segment.opening} media={opening-media.media}
- language="en" pace="normal" rounding="round"/>`,
- notes: [
- "A Segment with Tokens states its policy inline or names one SVS Recipe with policy.",
- "An empty Segment uses only id, narrative, segment and media; its prepared-media boundaries already contain all required timing.",
- "This package does not measure audio and never claims WhisperX or other acoustic evidence.",
- "Every spoken Token uses its original Script identity. A wordless Segment keeps its two authored boundary Anchors.",
- "Pronunciation-unit weights determine relative word lengths; adjacent words and both media edges retain non-zero frame gaps.",
- "The result has the same SemanticTake Type as a measured alignment, so Run chooses between ordinary candidates without a preview-specific downstream protocol.",
- ],
- },
-}] as const;
-
-export const semanticTakeEstimateManifest: ModuleManifest = {
- format: "hypit.module@1",
- name: semanticTakeEstimateModuleRef.name,
- version: semanticTakeEstimateModuleRef.version,
- dependencies: [
- mediaDependency,
- narrativeDependency,
- speechDependency,
- { module: estimateModuleRef },
- { module: svsRecipeType.module },
- ],
- types: [],
- capabilities: [],
- producers: [{
- name: semanticTakeEstimateProducers.materialize.name,
- inputs: [
- { name: "narrative", type: narrativeTypes.narrative },
- { name: "segment", type: narrativeTypes.excerpt },
- { name: "media", type: mediaTypes.synchronized },
- { name: "policy", type: estimateTypes.speechPolicy },
- ],
- outputs: [{ name: "take", type: speechTypes.semanticTake }],
- needs: [],
- }],
-};
diff --git a/packages/semantic-take-estimate/src/program.ts b/packages/semantic-take-estimate/src/program.ts
deleted file mode 100644
index 7c5d0474..00000000
--- a/packages/semantic-take-estimate/src/program.ts
+++ /dev/null
@@ -1,117 +0,0 @@
-import {
- assertSpeechEstimatePolicy,
- countSpeechEstimateUnits,
- resolveSpeechEstimateLanguage,
-} from "@hypit/estimate";
-import type { SpeechEstimatePolicy } from "@hypit/estimate";
-import { verifySynchronizedMedia } from "@hypit/media";
-import type { SynchronizedMedia } from "@hypit/media";
-import type { Narrative, NarrativeExcerpt } from "@hypit/narrative";
-import { materializeSegmentBoundaryTake, materializeSemanticTake } from "@hypit/speech";
-import type { SemanticTake, SemanticTakeTimedToken, SemanticTakeTiming } from "@hypit/speech";
-
-const EDGE_GAP_SECONDS = 0.12;
-const WORD_GAP_SECONDS = 0.06;
-
-function segmentTokens(narrative: Narrative, excerpt: NarrativeExcerpt): readonly Narrative["tokens"][number][] {
- if (excerpt.kind !== "segment") throw new Error("Estimated SemanticTake requires a Segment excerpt.");
- const segment = narrative.segments.find((candidate) => candidate.id === excerpt.id);
- if (segment === undefined
- || segment.tokenStart !== excerpt.tokenStart
- || segment.tokenEndExclusive !== excerpt.tokenEndExclusive) {
- throw new Error(`NarrativeExcerpt ${excerpt.id} does not describe its authored Segment.`);
- }
- const tokens = narrative.tokens.slice(segment.tokenStart, segment.tokenEndExclusive);
- return tokens;
-}
-
-function weightedFrames(total: number, weights: readonly number[]): number[] {
- if (total < weights.length) throw new Error("Estimated SemanticTake has fewer articulation frames than Tokens.");
- const remaining = total - weights.length;
- const weightTotal = weights.reduce((sum, weight) => sum + weight, 0);
- const allocations = weights.map((weight) => 1 + Math.floor(remaining * weight / weightTotal));
- const left = total - allocations.reduce((sum, value) => sum + value, 0);
- const order = weights
- .map((weight, index) => ({ index, remainder: remaining * weight % weightTotal }))
- .sort((leftItem, rightItem) => rightItem.remainder - leftItem.remainder || leftItem.index - rightItem.index);
- for (let index = 0; index < left; index += 1) allocations[order[index]!.index]! += 1;
- return allocations;
-}
-
-/** Deterministic, explicitly estimated timing; it consumes no acoustic evidence. */
-export function estimateSemanticTakeTiming(
- narrative: Narrative,
- excerpt: NarrativeExcerpt,
- media: SynchronizedMedia,
- policy: SpeechEstimatePolicy,
-): SemanticTakeTiming {
- verifySynchronizedMedia(media);
- assertSpeechEstimatePolicy(policy);
- const tokens = segmentTokens(narrative, excerpt);
- if (tokens.length === 0) {
- const take = materializeSegmentBoundaryTake(narrative, excerpt, media);
- return { tokens: take.tokens, anchors: take.anchors };
- }
- const segment = narrative.segments.find((candidate) => candidate.id === excerpt.id)!;
- const rate = media.timeline.frameRate.numerator / media.timeline.frameRate.denominator;
- const edgeGap = Math.max(1, Math.round(EDGE_GAP_SECONDS * rate));
- const wordGap = Math.max(1, Math.round(WORD_GAP_SECONDS * rate));
- const reserved = edgeGap * 2 + wordGap * (tokens.length - 1);
- const articulationFrames = media.timeline.frameCount - reserved;
- if (articulationFrames < tokens.length) {
- throw new Error(
- `Estimated SemanticTake needs at least ${reserved + tokens.length} frames to keep every Token visible and separated; got ${media.timeline.frameCount}.`,
- );
- }
-
- const language = resolveSpeechEstimateLanguage(tokens.map((token) => token.text).join(" "), policy.language);
- const weights = tokens.map((token) => Math.max(1, countSpeechEstimateUnits(token.text, language)));
- const durations = weightedFrames(articulationFrames, weights);
- let cursor = edgeGap;
- const timed = tokens.map((token, index): SemanticTakeTimedToken => {
- const startFrame = cursor;
- const endFrameExclusive = startFrame + durations[index]!;
- cursor = endFrameExclusive + (index === tokens.length - 1 ? 0 : wordGap);
- return {
- tokenId: token.id,
- segmentId: excerpt.id,
- startFrame,
- endFrameExclusive,
- };
- });
- if (cursor !== media.timeline.frameCount - edgeGap) {
- throw new Error("Estimated SemanticTake timing allocation did not close over its frame domain.");
- }
-
- const frameByAnchor = new Map<string, number>([
- [segment.startAnchorId, 0],
- [segment.endAnchorId, media.timeline.frameCount],
- ]);
- for (const [index, token] of tokens.entries()) {
- frameByAnchor.set(token.startAnchorId, timed[index]!.startFrame);
- frameByAnchor.set(token.endAnchorId, timed[index]!.endFrameExclusive);
- }
- const anchors = narrative.semanticIndex.anchors
- .filter((anchor) => anchor.segmentId === excerpt.id)
- .map((anchor) => {
- const frame = frameByAnchor.get(anchor.id);
- if (frame === undefined) throw new Error(`Estimated timing cannot locate authored Anchor ${anchor.id}.`);
- return { identity: anchor.id, frame };
- });
- return { tokens: timed, anchors };
-}
-
-export function materializeEstimatedSemanticTake(
- narrative: Narrative,
- excerpt: NarrativeExcerpt,
- media: SynchronizedMedia,
- policy: SpeechEstimatePolicy,
-): SemanticTake {
- verifySynchronizedMedia(media);
- return materializeSemanticTake(
- narrative,
- excerpt,
- media,
- estimateSemanticTakeTiming(narrative, excerpt, media, policy),
- );
-}
diff --git a/packages/semantic-take-estimate/src/surface.ts b/packages/semantic-take-estimate/src/surface.ts
deleted file mode 100644
index c4bf0180..00000000
--- a/packages/semantic-take-estimate/src/surface.ts
+++ /dev/null
@@ -1,117 +0,0 @@
-import { estimateTypes, speechEstimatePolicyFromAttributes, speechEstimatePolicyFromRecipe, speechEstimatePolicyProperties } from "@hypit/estimate";
-import type { SpeechEstimatePolicy } from "@hypit/estimate";
-import { textAttribute } from "@hypit/markup";
-import type {
- MarkupAttributeValue,
- StructuredElement,
- StructuredSurfaceHandler,
- SurfaceResolvedReference,
-} from "@hypit/markup";
-import { mediaTypes } from "@hypit/media";
-import { narrativeTypes } from "@hypit/narrative";
-import type { NarrativeExcerpt } from "@hypit/narrative";
-import type { CanonicalValue } from "@hypit/protocol";
-import { sameType } from "@hypit/protocol";
-import { svsRecipeType } from "@hypit/svs";
-import type { SvsRecipe } from "@hypit/svs";
-
-import { semanticTakeEstimateBoundaryFragment, semanticTakeEstimateFragment } from "./fragment.js";
-
-function reference(
- element: StructuredElement,
- name: string,
- expected: SurfaceResolvedReference["type"],
- resolveReference: (path: string) => SurfaceResolvedReference | undefined,
-): SurfaceResolvedReference {
- const raw: MarkupAttributeValue | undefined = element.attributes[name];
- if (typeof raw !== "object" || raw.kind !== "reference") {
- throw new Error(`${element.name}.${name} must be a whole-value reference`);
- }
- const resolved = resolveReference(raw.path);
- if (resolved === undefined) throw new Error(`${element.name}.${name} cannot resolve ${raw.path}`);
- if (!sameType(resolved.type, expected)) throw new Error(`${element.name}.${name} has the wrong type`);
- return resolved;
-}
-
-function authoredExcerpt(value: SurfaceResolvedReference): NarrativeExcerpt | undefined {
- return value.record?.value.kind === "inline"
- ? value.record.value.value as unknown as NarrativeExcerpt
- : undefined;
-}
-
-/**
- * The delivery policy the estimate weights Tokens with: an SVS Recipe named by `policy`, or the same
- * properties written inline. The element owns its policy; nothing elsewhere in the graph computes it.
- */
-function policyOf(
- element: StructuredElement,
- resolveReference: (path: string) => SurfaceResolvedReference | undefined,
-): SpeechEstimatePolicy {
- const inline = speechEstimatePolicyProperties.filter((name) => element.attributes[name] !== undefined);
- if (element.attributes.policy !== undefined) {
- if (inline.length > 0) throw new Error(`${element.name}.policy cannot be combined with ${inline.join(", ")}`);
- const resolved = reference(element, "policy", svsRecipeType, resolveReference);
- const value = resolved.record?.value;
- if (value?.kind !== "inline") throw new Error(`${element.name}.policy must reference an authored SVS Recipe`);
- return speechEstimatePolicyFromRecipe(value.value as unknown as SvsRecipe, `${element.name}.policy`);
- }
- const attributes = Object.fromEntries(inline.map((name) => [name, element.attributes[name]]));
- return speechEstimatePolicyFromAttributes(attributes, element.name);
-}
-
-export const decodeSemanticTakeEstimateSurface: StructuredSurfaceHandler = ({ element, resolveReference }) => {
- const required = ["id", "narrative", "segment", "media"];
- const missing = required.filter((name) => element.attributes[name] === undefined);
- if (missing.length > 0) {
- throw new Error(`${element.name} requires ${required.join(", ")}`);
- }
- const narrative = reference(element, "narrative", narrativeTypes.narrative, resolveReference);
- const segment = reference(element, "segment", narrativeTypes.excerpt, resolveReference);
- const media = reference(element, "media", mediaTypes.synchronized, resolveReference);
- const excerpt = authoredExcerpt(segment);
- const hasNoTokens = excerpt !== undefined && excerpt.tokenStart === excerpt.tokenEndExclusive;
- const allowed = new Set(hasNoTokens ? required : [...required, "policy", ...speechEstimatePolicyProperties]);
- const unknown = Object.keys(element.attributes).filter((name) => !allowed.has(name));
- if (unknown.length > 0) {
- throw new Error(`${element.name} has unknown or inapplicable attributes ${unknown.join(", ")}`);
- }
- if (element.children.some((child) => child.kind === "element" || child.value.trim().length > 0)) {
- throw new Error(`${element.name} must be empty`);
- }
- const id = textAttribute(element, "id");
- if (hasNoTokens) {
- return {
- records: [],
- components: [{
- id,
- fragment: semanticTakeEstimateBoundaryFragment.id,
- inputs: { narrative: narrative.ref, segment: segment.ref, media: media.ref },
- outputs: { take: `${id}.take` },
- range: element.range,
- }],
- fragments: [semanticTakeEstimateBoundaryFragment],
- };
- }
- const policyId = `${id}.policy`;
- return {
- records: [{
- id: policyId,
- type: estimateTypes.speechPolicy,
- value: { kind: "inline", value: policyOf(element, resolveReference) as unknown as CanonicalValue },
- range: element.range,
- }],
- components: [{
- id,
- fragment: semanticTakeEstimateFragment.id,
- inputs: {
- narrative: narrative.ref,
- segment: segment.ref,
- media: media.ref,
- policy: { kind: "record", id: policyId },
- },
- outputs: { take: `${id}.take` },
- range: element.range,
- }],
- fragments: [semanticTakeEstimateFragment],
- };
-};
diff --git a/packages/semantic-take-estimate/test/semantic-take-estimate.test.ts b/packages/semantic-take-estimate/test/semantic-take-estimate.test.ts
deleted file mode 100644
index 8c722d95..00000000
--- a/packages/semantic-take-estimate/test/semantic-take-estimate.test.ts
+++ /dev/null
@@ -1,221 +0,0 @@
-import assert from "node:assert/strict";
-import test from "node:test";
-
-import { sealSpeechEstimatePolicy } from "@hypit/estimate";
-import { mediaTypes, sealSynchronizedMedia } from "@hypit/media";
-import { parseStructuredElement } from "@hypit/markup";
-import type { SurfaceResolvedReference } from "@hypit/markup";
-import {
- assertCaptionDocumentIdentity,
- assertNarrativeExcerptIdentity,
- assertNarrativeIdentity,
- narrativeTypes,
-} from "@hypit/narrative";
-import type { Narrative } from "@hypit/narrative";
-import { materializeSegmentBoundaryTake, speechProducers } from "@hypit/speech";
-import { fixtureResource } from "../../../test/fixture-resource.js";
-
-import {
- decodeSemanticTakeEstimateSurface,
- estimateSemanticTakeTiming,
- materializeEstimatedSemanticTake,
-} from "@hypit/semantic-take-estimate";
-
-const narrative: Narrative = {
- id: "test-narrative",
- segments: [{
- id: "opening",
- startAnchorId: "opening:start",
- endAnchorId: "opening:end",
- tokenStart: 0,
- tokenEndExclusive: 3,
- }],
- tokens: [
- { id: "a", segmentId: "opening", startAnchorId: "a:start", endAnchorId: "a:end", text: "A", normalized: "a" },
- { id: "wonderful", segmentId: "opening", startAnchorId: "wonderful:start", endAnchorId: "wonderful:end", text: "wonderful", normalized: "wonderful" },
- { id: "cat", segmentId: "opening", startAnchorId: "cat:start", endAnchorId: "cat:end", text: "cat.", normalized: "cat" },
- ],
- turns: [],
- selections: [],
- moments: [],
- semanticIndex: {
- anchors: [
- { id: "opening:start", kind: "segment-start", segmentId: "opening" },
- { id: "a:start", kind: "token-start", segmentId: "opening", tokenId: "a" },
- { id: "a:end", kind: "token-end", segmentId: "opening", tokenId: "a" },
- { id: "wonderful:start", kind: "token-start", segmentId: "opening", tokenId: "wonderful" },
- { id: "wonderful:end", kind: "token-end", segmentId: "opening", tokenId: "wonderful" },
- { id: "cat:start", kind: "token-start", segmentId: "opening", tokenId: "cat" },
- { id: "cat:end", kind: "token-end", segmentId: "opening", tokenId: "cat" },
- { id: "opening:end", kind: "segment-end", segmentId: "opening" },
- ],
- },
-};
-
-const excerpt = { narrativeId: narrative.id, kind: "segment" as const, id: "opening", tokenStart: 0, tokenEndExclusive: 3 };
-const media = sealSynchronizedMedia({
- timeline: { frameRate: { numerator: 30, denominator: 1 }, frameCount: 120 },
- visual: {
- artifact: { kind: "blob", resource: fixtureResource("estimated-take-video"), size: 1_024, mediaType: "video/mp4" },
- width: 1_080,
- height: 1_920,
- },
-});
-const policy = sealSpeechEstimatePolicy({
- language: "en",
- pace: "normal",
- rounding: "none",
-});
-
-test("estimated timing weights articulation by syllables and leaves visible gaps", () => {
- const timing = estimateSemanticTakeTiming(narrative, excerpt, media, policy);
- assert.equal(timing.tokens[0]!.startFrame, 4);
- assert.equal(timing.tokens[1]!.startFrame - timing.tokens[0]!.endFrameExclusive, 2);
- assert.equal(timing.tokens[2]!.startFrame - timing.tokens[1]!.endFrameExclusive, 2);
- assert.equal(media.timeline.frameCount - timing.tokens[2]!.endFrameExclusive, 4);
- const durations = timing.tokens.map((token) => token.endFrameExclusive - token.startFrame);
- assert.ok(durations[1]! > durations[0]!);
- assert.ok(durations[1]! > durations[2]!);
-});
-
-test("estimated timing fills the normalized media instead of stopping at a fixed speech length", () => {
- const frameCounts = [7 * 30, 10 * 30];
- const timings = frameCounts.map((frameCount) => estimateSemanticTakeTiming(
- narrative,
- excerpt,
- sealSynchronizedMedia({ ...media, timeline: { ...media.timeline, frameCount } }),
- policy,
- ));
-
- for (const [index, timing] of timings.entries()) {
- const frameCount = frameCounts[index]!;
- assert.ok(timing.tokens[0]!.startFrame <= 0.2 * 30);
- assert.ok(timing.tokens.at(-1)!.endFrameExclusive >= frameCount - 0.2 * 30);
- }
- assert.ok(
- timings[1]!.tokens[1]!.endFrameExclusive - timings[1]!.tokens[1]!.startFrame
- > timings[0]!.tokens[1]!.endFrameExclusive - timings[0]!.tokens[1]!.startFrame,
- );
-});
-
-test("estimated and measured alignment share the ordinary SemanticTake waist", () => {
- const take = materializeEstimatedSemanticTake(narrative, excerpt, media, policy);
- assert.equal(take.segment.segmentId, "opening");
- assert.deepEqual(take.tokens.map((token) => token.tokenId), ["a", "wonderful", "cat"]);
- assert.deepEqual(take.media, media);
- assert.equal(take.media.audio, undefined);
-});
-
-test("an implausibly short frame domain is refused instead of squeezing words together", () => {
- const short = sealSynchronizedMedia({
- ...media,
- timeline: { ...media.timeline, frameCount: 8 },
- });
- assert.throws(
- () => estimateSemanticTakeTiming(narrative, excerpt, short, policy),
- /keep every Token visible and separated/u,
- );
-});
-
-test("a wordless Segment receives the prepared media boundaries without an audio substitute", () => {
- const wordless: Narrative = {
- id: "wordless",
- segments: [{
- id: "pause",
- startAnchorId: "pause:start",
- endAnchorId: "pause:end",
- tokenStart: 0,
- tokenEndExclusive: 0,
- }],
- tokens: [],
- turns: [],
- selections: [],
- moments: [],
- semanticIndex: { anchors: [
- { id: "program:start", kind: "program-start" },
- { id: "pause:start", kind: "segment-start", segmentId: "pause" },
- { id: "pause:end", kind: "segment-end", segmentId: "pause" },
- { id: "program:end", kind: "program-end" },
- ] },
- };
- const wordlessExcerpt = {
- narrativeId: wordless.id,
- kind: "segment" as const,
- id: "pause",
- tokenStart: 0,
- tokenEndExclusive: 0,
- };
- assertNarrativeIdentity(wordless);
- assertNarrativeExcerptIdentity(wordlessExcerpt);
- assertCaptionDocumentIdentity({
- narrativeId: wordless.id,
- id: "wordless.caption",
- units: [],
- words: [],
- cueBreaks: [],
- });
-
- const take = materializeSegmentBoundaryTake(wordless, wordlessExcerpt, media);
- assert.deepEqual(take.tokens, []);
- assert.deepEqual(take.anchors, [
- { identity: "pause:start", frame: 0 },
- { identity: "pause:end", frame: media.timeline.frameCount },
- ]);
- assert.equal(take.media.audio, undefined);
-});
-
-test("the preview Surface sends an empty Segment straight to boundary materialization", async () => {
- const wordless: Narrative = {
- id: "wordless-preview",
- segments: [{
- id: "pause",
- startAnchorId: "pause:start",
- endAnchorId: "pause:end",
- tokenStart: 0,
- tokenEndExclusive: 0,
- }],
- tokens: [], turns: [], selections: [], moments: [],
- semanticIndex: { anchors: [
- { id: "pause:start", kind: "segment-start", segmentId: "pause" },
- { id: "pause:end", kind: "segment-end", segmentId: "pause" },
- ] },
- };
- const wordlessExcerpt = {
- narrativeId: wordless.id,
- kind: "segment" as const,
- id: "pause",
- tokenStart: 0,
- tokenEndExclusive: 0,
- };
- const authored = (
- path: string,
- type: SurfaceResolvedReference["type"],
- value: unknown,
- ): SurfaceResolvedReference => ({
- path,
- ref: { kind: "record", id: path },
- type,
- record: { id: path, type, value: { kind: "inline", value: value as never } },
- });
- const refs = new Map<string, SurfaceResolvedReference>([
- ["story", authored("story", narrativeTypes.narrative, wordless)],
- ["story.segment.pause", authored("story.segment.pause", narrativeTypes.excerpt, wordlessExcerpt)],
- ["pause-media.media", authored("pause-media.media", mediaTypes.synchronized, media)],
- ]);
- const output = await decodeSemanticTakeEstimateSurface({
- sourceName: "preview.svml",
- element: parseStructuredElement({ name: "preview.svml", text:
- '<estimate:SemanticTake id="pause-preview" narrative={story} segment={story.segment.pause} media={pause-media.media}/>',
- }, 0).element,
- resolveReference: (path) => refs.get(path),
- resolveAsset: () => { throw new Error("No assets are resolved by this test."); },
- });
-
- assert.equal(output.records.length, 0);
- assert.equal(output.fragments[0]?.operations[0]?.producer.name, speechProducers.materializeSegmentBoundaries.name);
- assert.deepEqual(output.components[0]?.inputs, {
- narrative: { kind: "record", id: "story" },
- segment: { kind: "record", id: "story.segment.pause" },
- media: { kind: "record", id: "pause-media.media" },
- });
-});
diff --git a/packages/semantic-track/README.md b/packages/semantic-track/README.md
index 0845fce3..259528da 100644
--- a/packages/semantic-track/README.md
+++ b/packages/semantic-track/README.md
@@ -11,3 +11,11 @@ part of this semantic truth.
The package exposes pure projections to `ProgramSpace` and `AudioTrack`, plus the
selection/segment/moment lookup functions used by semantic components. It performs no media I/O,
mixing, transcription or rendering.
+
+## Prepared material in a semantic window
+
+`projectSemanticMedia(track, window?)` returns each intersecting Take's `media`, `segmentId`, global
+`span` and local `source` frame span. The default window is the whole performance. An interval
+beginning inside a Take preserves its source offset. Audio-only Takes remain represented so the
+consumer can choose the streams it displays. This projection makes no layout or layering decisions;
+Media and custom visual components can consume the same prepared performance.
diff --git a/packages/semantic-track/src/index.ts b/packages/semantic-track/src/index.ts
index adb93675..e1245f55 100644
--- a/packages/semantic-track/src/index.ts
+++ b/packages/semantic-track/src/index.ts
@@ -2,5 +2,5 @@ export { semanticTrackComponent } from "./component.js";
export { assertSemanticTrackIdentity, sealSemanticTrack, semanticTrackFrameCount, semanticTrackSpans } from "./identity.js";
export { assertNarrativeMomentIdentity, assertNarrativeSelectionIdentity, momentFrame, segmentFrameSpan, selectionFrameSpan, semanticAnchorFrames, tokenFrameSpan } from "./location.js";
export { semanticTrackDependency, semanticTrackManifest, semanticTrackModuleRef, semanticTrackProducers, semanticTrackSchema, semanticTrackTypes } from "./manifest.js";
-export { projectSemanticAudioTrack, projectSemanticProgramSpace } from "./projection.js";
+export { projectSemanticAudioTrack, projectSemanticProgramSpace, projectSemanticMedia } from "./projection.js";
export type * from "./types.js";
diff --git a/packages/semantic-track/src/projection.ts b/packages/semantic-track/src/projection.ts
index 1fac68de..8258236a 100644
--- a/packages/semantic-track/src/projection.ts
+++ b/packages/semantic-track/src/projection.ts
@@ -10,6 +10,26 @@ import type { ProgramSpace } from "@hypit/program-space";
import { assertSemanticTrackIdentity, semanticTrackFrameCount, semanticTrackSpans } from "./identity.js";
import type { SemanticTrack } from "./types.js";
+/** Prepared material in an authored program interval, with its original source position retained. */
+export function projectSemanticMedia(track: SemanticTrack, window = {
+ startFrame: 0, endFrameExclusive: semanticTrackFrameCount(track),
+}) {
+ assertSemanticTrackIdentity(track);
+ if (!Number.isSafeInteger(window.startFrame) || !Number.isSafeInteger(window.endFrameExclusive)
+ || window.startFrame < 0 || window.endFrameExclusive <= window.startFrame
+ || window.endFrameExclusive > semanticTrackFrameCount(track)) throw new Error("Semantic media window is outside the performance.");
+ return semanticTrackSpans(track).flatMap(({ item, startFrame, endFrameExclusive }) => {
+ const start = Math.max(window.startFrame, startFrame);
+ const end = Math.min(window.endFrameExclusive, endFrameExclusive);
+ return end <= start ? [] : [{
+ segmentId: item.take.segment.segmentId,
+ media: item.take.media,
+ span: { startFrame: start, endFrameExclusive: end },
+ source: { startFrame: start - startFrame, endFrameExclusive: end - startFrame },
+ }];
+ });
+}
+
export function projectSemanticProgramSpace(track: SemanticTrack): ProgramSpace {
assertSemanticTrackIdentity(track);
const frameRate = track.items[0]!.take.media.timeline.frameRate;
diff --git a/packages/speech-track-studio/README.md b/packages/speech-track-studio/README.md
index ce43ac21..efe7227b 100644
--- a/packages/speech-track-studio/README.md
+++ b/packages/speech-track-studio/README.md
@@ -1,3 +1,3 @@
# `@hypit/speech-track-studio`
-Hypit Studio Companion for the visual and audio projections of `@hypit/speech-track`.
+Hypit Studio Companion for the original audio projection of `@hypit/speech-track`.
diff --git a/packages/speech-track-studio/src/index.ts b/packages/speech-track-studio/src/index.ts
index e3916dc9..67776ca7 100644
--- a/packages/speech-track-studio/src/index.ts
+++ b/packages/speech-track-studio/src/index.ts
@@ -1,54 +1,7 @@
-import { speechTrackMarkupSurfaces, speechTrackModuleRef } from "@hypit/speech-track";
+import { speechTrackModuleRef } from "@hypit/speech-track";
import { compositionTypes } from "@hypit/composition";
-import type { StudioTrackCompanion, StudioTrackCompanionContext, StudioEntityDraft, StudioInspectorFieldDeclaration, StudioSourceBindingDeclaration } from "@hypit/studio-adapter";
+import type { StudioTrackCompanion, StudioTrackCompanionContext, StudioEntityDraft } from "@hypit/studio-adapter";
import { artifactPreview, previewLayer } from "@hypit/studio-adapter";
-
-const frameParameters: readonly StudioSourceBindingDeclaration[] = [
- { name: "within" },
- ...["left", "top", "right", "bottom", "x", "y", "width", "height"].map((name) => ({ name, writable: true })),
-];
-
-const speechVisualProperties = (speechTrackMarkupSurfaces[0]
- ?.vocabulary.attributes.find((attribute) => attribute.name === "visual-appearance")?.recipe ?? [])
-;
-
-function title(name: string): string {
- return name.split("-").map((part) => `${part.slice(0, 1).toUpperCase()}${part.slice(1)}`).join(" ");
-}
-
-function valuesFor(property: typeof speechVisualProperties[number]): readonly string[] | undefined {
- return "values" in property ? property.values : undefined;
-}
-
-const speechInspector: readonly StudioInspectorFieldDeclaration[] = [
- ...frameParameters.filter(({ writable }) => writable === true).map(({ name }) => ({
- binding: `visual-frame.${name}`, label: title(name), domain: "where" as const,
- page: { id: "frame", label: "Frame" }, section: { id: "frame", label: "Frame" }, control: "text" as const,
- })),
- ...speechVisualProperties.map((property) => ({
- binding: `visual-appearance.${property.name}`, label: title(property.name), domain: "where" as const,
- page: { id: "fit", label: "Fit" }, section: { id: "fit", label: "Fit" },
- ...(property.summary === undefined ? {} : { summary: property.summary }),
- control: valuesFor(property) !== undefined ? "select" as const : "number" as const,
- ...(valuesFor(property) === undefined ? {} : { options: valuesFor(property)! }),
- })),
- {
- binding: "visual-z", label: "Stack", domain: "where", page: { id: "stacking", label: "Stacking" },
- section: { id: "stacking", label: "Stacking" }, control: "number",
- },
-];
-
-type SpeechVisualTrack = {
- readonly presents?: readonly {
- readonly id: string;
- readonly subjectId?: string;
- readonly elements?: readonly {
- readonly kind?: string;
- readonly artifact?: { readonly resource?: string };
- }[];
- }[];
-};
-
type SpeechAudioTrack = {
readonly clips?: readonly {
readonly id: string;
@@ -57,28 +10,6 @@ type SpeechAudioTrack = {
}[];
};
-function projectSpeechVisual(context: StudioTrackCompanionContext): readonly StudioEntityDraft[] {
- const presents = new Map(((context.track.value as SpeechVisualTrack).presents ?? [])
- .map((present) => [present.id, present] as const));
- return context.generic().map((entity) => {
- const id = entity.presentId ?? entity.authoredId;
- const present = presents.get(id);
- const subjectId = present?.subjectId;
- const artifact = present?.elements?.find((element) =>
- (element.kind === "image" || element.kind === "video") && element.artifact?.resource !== undefined)?.artifact;
- return {
- ...entity,
- authoredId: subjectId ?? id,
- ...(context.placement === undefined ? {} : { elementRange: context.placement.range }),
- display: {
- title: subjectId ?? "Speech",
- layers: artifact?.resource === undefined ? [] : [previewLayer(artifactPreview("video", artifact.resource), "storyboard")],
- },
- presentation: { entity: "media-item", chrome: "standard" },
- };
- });
-}
-
function projectSpeechAudio(context: StudioTrackCompanionContext): readonly StudioEntityDraft[] {
const clips = new Map(((context.track.value as SpeechAudioTrack).clips ?? [])
.map((clip) => [clip.id, clip] as const));
@@ -99,22 +30,6 @@ function projectSpeechAudio(context: StudioTrackCompanionContext): readonly Stud
}
export const speechTrackStudioTrackCompanions: readonly StudioTrackCompanion[] = [
- {
- id: "visual", role: "track",
- output: { type: compositionTypes.visualTrack, surface: "track", modules: [speechTrackModuleRef] },
- family: "speech-visual", tone: "blue", label: "Speech Visual", icon: "video",
- bindings: [
- { name: "visual-frame", referenced: frameParameters },
- {
- name: "visual-appearance",
- recipe: { bindings: speechVisualProperties.map(({ name }) => ({ name })) },
- },
- { name: "visual-z", writable: true },
- ],
- inspector: speechInspector,
- project: projectSpeechVisual,
- lane: { heightPx: 76 },
- },
{
id: "audio", role: "track",
output: { type: compositionTypes.audioTrack, surface: "track", modules: [speechTrackModuleRef] },
diff --git a/packages/speech-track/README.md b/packages/speech-track/README.md
index d31cf217..fbec4b3f 100644
--- a/packages/speech-track/README.md
+++ b/packages/speech-track/README.md
@@ -1,103 +1,51 @@
# `@hypit/speech-track`
-Assemble the performances carrying the Script into one semantic timeline, with separate picture and
-sound outputs. In the usual spoken production, these performances are the A-roll. A speaker can be
-covered by B-roll while their words continue to define the semantic time of the piece. A podcast's
-speaking turns share this timeline; an independent narration can also carry it.
-
-A-roll can be a circular picture-in-picture or a foreground presenter cutout over another main
-picture. Its speaking performance establishes the semantic timeline regardless of its screen area
-or stack order. Speech Track projects that same prepared Take into semantic, visual and audio
-outputs together; the inset or cutout does not need to be displayed a second time through Media
-Track.
-
-## Assemble prepared Takes
-
-Normalize the media and associate each Script Segment with a SemanticTake before assembly. A spoken
-Take includes aligned words; a wordless Take includes its media and Segment boundaries. One Take can
-contain several speakers or camera cuts. Takes are assembled in Source order:
+Assemble ordered SemanticTakes into a semantic timeline and its original sound. The performance
+carrying the Script is the A-roll, whether its picture fills the screen, appears in an inset,
+is a transparent cutout, or is covered by other pictures. This role establishes time; the visual
+composition decides where and how that material appears.
```svml
-<import as="speech" from="@hypit/speech-track@1"/>
-
-<speech:Track id="speech" visual-frame={layout.full}
- visual-appearance={look.performance} visual-z="0">
+<speech:Track id="speech">
<speech:Take source={opening.take}/>
<speech:Take source={answer.take}/>
</speech:Track>
```
-This excerpt assumes the Takes, Frame and appearance Recipe exist. An appearance Recipe can share
-the ordinary visual appearance of a Media Item:
-
-```svs
-performance {
- fit: cover;
- clip: rounded;
- radius: 270;
- border-width: 3;
- border-color: rgba(255, 255, 255, 0.9);
-}
-```
-
-With a `540 × 540` Frame, that rounded clip presents the performance as a circle. The shared frame
-rate and total ProgramSpace come from the ordered Takes. Their local word and boundary frames become
-positions in that assembled space.
+The Takes are already normalized and semantic. Source order and actual prepared lengths establish
+the shared ProgramSpace. Local word positions and Segment boundaries become global positions.
+One Take may contain several speakers or camera cuts; a wordless Take supplies its media boundaries.
| Output | Use |
| --- | --- |
-| `.semantic` | Supply semantic timing to Film, Caption, Media, Typography, Audio and other components |
-| `.visual` | Include the performance picture in Film when wanted |
-| `.audio` | Include the performance sound in Film, including beneath B-roll |
+| `.semantic` | Semantic time and prepared materials for Film, Caption, Media and project components |
+| `.audio` | Original performance sound at its assembled positions |
-Each Take always contributes its Segment and Anchor timing. A Take with no audio stream contributes
-no audio clip; a Take with no visual stream contributes no picture. Its remaining semantic and
-media projections continue normally, so a video-only wordless Take needs no synthetic audio and an
-audio-only narration needs no synthetic picture.
+Select `.audio` in Film when that sound belongs in the result. This explicit convenience projection
+keeps the prepared source at its original speed and gain; a Take without audio contributes no clip.
+For independent music, effects or authored mixing choices, use [Audio Track](../audio-track/README.md).
-Select each wanted picture and sound output explicitly in Film. Replacing the visible picture with
-Media Track coverage does not replace the semantic timeline or mute the included performance audio.
-An audio-only performance can supply the timeline while other Tracks supply the picture.
+## Present the performance
-## Present the performance directly
-
-`visual-frame`, `visual-appearance`, `visual-motion` and `visual-z` supply the Track's visual base. A
-Take can override them with `frame`, `appearance`, `motion` and `z`. Appearance can control fit and
-crop anchors, opacity and filters, rounded or rectangular clipping, padding, borders, shadows and
-frame paint. Lifecycle motion can move that visual presentation as it enters, remains or exits. None
-of these choices changes the Take's semantic timing or audio.
-
-This is the same destination/content geometry as a Media Item: the outer `frame` places and shapes
-the presentation; border and padding define its fitting area; the source's intrinsic extent, fit
-and alignment determine the inner picture rectangle. The shared spatial Recipe keys and defaults
-are described in [Spatial](../spatial/README.md#destination-and-fitted-content), and frame decoration
-in [Media Track](../media-track/README.md#place-the-frame-then-fit-its-contents). Rounded clipping is
-applied to the outer Frame, including when a contain fit leaves space around the picture.
-
-A Take override replaces the corresponding Track setting. In particular, `appearance` selects a
-complete Recipe rather than merging individual properties from `visual-appearance`. Speech Track
-authors stacking through `visual-z` / `z`; its appearance Recipe carries the shared picture and
-frame properties without Media Track's `stack-order`, playback or trim fields.
-
-Speech visuals occupy their prepared Take's Segment span. Their lifecycle motion repeats within
-each Take's span, and Sampling moves only the picture under the frame's clip. The current Speech
-Surface supports rectangular, rounded and unclipped frame presentation. An authored Path clip and
-Canvas-edge `enter-origin` / `exit-origin` are Media Track interfaces.
-
-Sampling children move the Take's picture inside its Frame over normalized Segment progress, using
-the same fields as a direct Media Item:
+[Media Track](../media-track/README.md#display-a-semantic-performance) can consume the assembled
+performance through a Media Performance:
```svml
-<speech:Take source={opening.take}>
- <speech:Sampling at="start" zoom="1"/>
- <speech:Sampling at="end" zoom="1.08" y="-18" easing="ease-out"/>
-</speech:Take>
+<media:Track id="performance" semantic={speech.semantic} canvas={canvas}>
+ <media:Performance during="program" frame={layout.full}
+ appearance={look.performance}/>
+</media:Track>
```
-Use [Media Track](../media-track/README.md) when a picture owns an independent semantic Window,
-source playback or trim, source audio, a replacement Sequence, or a visual source other than the
-performance itself. Caption and MG consume `.semantic` to follow the same words and events.
+Include `performance.visual` and `speech.audio` in Film. The Media Recipe supplies `stack-order`,
+fit, clipping, rounded corners, border and other presentation choices. A selected window that starts
+inside a Take begins at the matching source frame. Presentation continues across Take boundaries.
+
+A project component can also consume `.semantic` and use `projectSemanticMedia` from
+`hypit/semantic-track` to obtain selected material spans and their source positions. When video and
+graphics share layout or motion, that component can own both in one visual program. Independent
+Caption or other overlays can remain separate Tracks.
-The [Studio Companion](../speech-track-studio/src/index.ts) presents the assembled Takes and their
-materials. Media preparation is owned by [Media Pipeline](../media-pipeline/README.md), and exact
-SemanticTake values by [Speech](../speech/README.md).
+[Media Pipeline](../media-pipeline/README.md) owns preparation;
+[Semantic Track](../semantic-track/README.md) owns the timeline and its projections.
+The [Studio Companion](../speech-track-studio/src/index.ts) exposes the original audio clips.
diff --git a/packages/speech-track/package.json b/packages/speech-track/package.json
index e079c970..826a6597 100644
--- a/packages/speech-track/package.json
+++ b/packages/speech-track/package.json
@@ -14,12 +14,9 @@
"@hypit/component-kit": "workspace:*",
"@hypit/composition": "workspace:*",
"@hypit/elaborator": "workspace:*",
- "@hypit/media-track": "workspace:*",
"@hypit/protocol": "workspace:*",
"@hypit/speech": "workspace:*",
"@hypit/semantic-track": "workspace:*",
- "@hypit/spatial": "workspace:*",
- "@hypit/svs": "workspace:*",
"@hypit/markup": "workspace:*"
},
"devDependencies": {
diff --git a/packages/speech-track/src/component.ts b/packages/speech-track/src/component.ts
index a8d8b6e8..2c75cf97 100644
--- a/packages/speech-track/src/component.ts
+++ b/packages/speech-track/src/component.ts
@@ -2,13 +2,10 @@ import type { ComponentPackage } from "@hypit/component-kit";
import type { StoredValue } from "@hypit/protocol";
import { canonicalize } from "@hypit/protocol";
import type { SemanticTake } from "@hypit/speech";
-import type { ContentFit, SpatialFrame } from "@hypit/spatial";
import { speechTrackProducers } from "./manifest.js";
import { appendSpeechTrackTake, assembleSpeechTrack, createSpeechTrackSet } from "./program.js";
-import { projectSpeechTrackVisual } from "./projection.js";
-import type { SemanticTrack } from "@hypit/semantic-track";
-import type { SpeechTrackHeader, SpeechTrackSet, SpeechTrackVisualSpec } from "./types.js";
+import type { SpeechTrackHeader, SpeechTrackSet } from "./types.js";
function inline<T>(value: StoredValue | undefined, subject: string): T {
if (value?.kind !== "inline") throw new Error(`${subject} must be inline`);
@@ -30,9 +27,6 @@ export const speechTrackComponent = {
outputs: { set: { kind: "inline", value: canonicalize(appendSpeechTrackTake(
inline<SpeechTrackSet>(inputs.set?.value, "SpeechTrackSet"),
inline<SemanticTake>(inputs.take?.value, "SemanticTake"),
- inline<SpatialFrame>(inputs.frame?.value, "SpatialFrame"),
- inline<ContentFit>(inputs.fit?.value, "ContentFit"),
- inline<SpeechTrackVisualSpec>(inputs.visualSpec?.value, "SpeechTrackVisualSpec"),
)) } },
needs: {},
}),
@@ -47,15 +41,5 @@ export const speechTrackComponent = {
needs: {},
}),
},
- {
- producer: speechTrackProducers.projectVisual,
- handler: ({ inputs }) => ({
- outputs: { visual: { kind: "inline", value: canonicalize(projectSpeechTrackVisual(
- inline<SemanticTrack>(inputs.track?.value, "SemanticTrack"),
- inline<SpeechTrackSet>(inputs.set?.value, "SpeechTrackSet"),
- )) } },
- needs: {},
- }),
- },
],
} satisfies ComponentPackage;
diff --git a/packages/speech-track/src/fragment.ts b/packages/speech-track/src/fragment.ts
index 77859697..5604d365 100644
--- a/packages/speech-track/src/fragment.ts
+++ b/packages/speech-track/src/fragment.ts
@@ -3,7 +3,6 @@ import { compositionTypes } from "@hypit/composition";
import { sealGraphFragment } from "@hypit/elaborator";
import type { FragmentOperation } from "@hypit/elaborator";
import { semanticTrackProducers, semanticTrackTypes } from "@hypit/semantic-track";
-import { spatialTypes } from "@hypit/spatial";
import type { TypeRef } from "@hypit/protocol";
import { speechTrackProducers, speechTrackTypes } from "./manifest.js";
@@ -27,9 +26,6 @@ export function createSpeechTrackFragment(options: SpeechTrackFragmentOptions) {
addInput("header", speechTrackTypes.header);
for (const take of options.takes) {
addInput(take.takeName, speechTypes.semanticTake);
- addInput(take.visual.frameName, spatialTypes.frame);
- addInput(take.visual.fitName, spatialTypes.fit);
- addInput(take.visual.visualSpecName, speechTrackTypes.visualSpec);
}
const operations: FragmentOperation[] = [{
id: "track:set:empty",
@@ -46,9 +42,6 @@ export function createSpeechTrackFragment(options: SpeechTrackFragmentOptions) {
inputs: {
set: operation(current),
take: input(take.takeName),
- frame: input(take.visual.frameName),
- fit: input(take.visual.fitName),
- visualSpec: input(take.visual.visualSpecName),
},
result: { kind: "output", name: "set" },
});
@@ -61,12 +54,6 @@ export function createSpeechTrackFragment(options: SpeechTrackFragmentOptions) {
inputs: { header: input("header"), set: operation(current) },
result: { kind: "output", name: "track" },
},
- {
- id: "track:visual-track",
- producer: speechTrackProducers.projectVisual,
- inputs: { track: operation("track:semantic"), set: operation(current) },
- result: { kind: "output", name: "visual" },
- },
{
id: "track:audio-track",
producer: semanticTrackProducers.projectAudio,
@@ -79,9 +66,6 @@ export function createSpeechTrackFragment(options: SpeechTrackFragmentOptions) {
operations,
exports: [
{ name: "semantic", type: semanticTrackTypes.track, root: operation("track:semantic") },
- {
- name: "visual", type: compositionTypes.visualTrack, root: operation("track:visual-track"),
- },
{
name: "audio", type: compositionTypes.audioTrack, root: operation("track:audio-track"),
},
diff --git a/packages/speech-track/src/index.ts b/packages/speech-track/src/index.ts
index 1880ff06..eff8f838 100644
--- a/packages/speech-track/src/index.ts
+++ b/packages/speech-track/src/index.ts
@@ -1,8 +1,7 @@
/** Official Speech Track authoring and deterministic SemanticTrack assembly. */
export { speechTrackComponent } from "./component.js";
export { createSpeechTrackFragment } from "./fragment.js";
-export { speechTrackManifest, speechTrackMarkupSurfaces, speechTrackModuleRef, speechTrackProducers, speechTrackTypes, speechTrackHeaderSchema, speechTrackSetSchema, speechTrackVisualSpecSchema } from "./manifest.js";
-export { appendSpeechTrackTake, assembleSpeechTrack, assertSpeechTrackHeader, assertSpeechTrackSet, assertSpeechTrackVisualSpec, createSpeechTrackSet, sealSpeechTrackHeader, sealSpeechTrackVisualSpec } from "./program.js";
-export { projectSpeechTrackVisual } from "./projection.js";
+export { speechTrackManifest, speechTrackMarkupSurfaces, speechTrackModuleRef, speechTrackProducers, speechTrackTypes, speechTrackHeaderSchema, speechTrackSetSchema } from "./manifest.js";
+export { appendSpeechTrackTake, assembleSpeechTrack, assertSpeechTrackHeader, assertSpeechTrackSet, createSpeechTrackSet, sealSpeechTrackHeader } from "./program.js";
export { decodeSpeechTrackSurface } from "./surface.js";
export type * from "./types.js";
diff --git a/packages/speech-track/src/manifest.ts b/packages/speech-track/src/manifest.ts
index 4cc06c07..e55ffad2 100644
--- a/packages/speech-track/src/manifest.ts
+++ b/packages/speech-track/src/manifest.ts
@@ -1,214 +1,35 @@
-import { readFile } from "node:fs/promises";
-
import { semanticTakeSchema, speechDependency, speechTypes } from "@hypit/speech";
import { compositionDependency, compositionTypes } from "@hypit/composition";
-import {
- mediaFramePresentationSchema,
- mediaLifecycleMotionSchema,
- mediaPaintLayerSpecSchema,
- mediaSampleAppearanceSchema,
- mediaSamplingMotionSchema,
-} from "@hypit/media-track";
-import type { ModuleManifest, ProducerRef, TypeRef, ValueSchema } from "@hypit/protocol";
import { semanticTrackDependency, semanticTrackTypes } from "@hypit/semantic-track";
-import {
- contentFitSchema,
- spatialDependency,
- spatialFrameSchema,
- spatialTypes,
-} from "@hypit/spatial";
-import { svsModuleRef, svsRecipeType } from "@hypit/svs";
-
-const previewImage = (file: string) => ({
- mediaType: "image/png",
- path: `preview/${file}`,
- open: async () => Uint8Array.from(await readFile(new URL(`../preview/${file}`, import.meta.url))),
-});
-
+import type { ModuleManifest, ValueSchema } from "@hypit/protocol";
export const speechTrackModuleRef = { name: "@hypit/speech-track", version: "1" } as const;
export const speechTrackTypes = {
header: { module: speechTrackModuleRef, name: "SpeechTrackHeader" },
trackSet: { module: speechTrackModuleRef, name: "SpeechTrackSet" },
- visualSpec: { module: speechTrackModuleRef, name: "SpeechTrackVisualSpec" },
-} satisfies Record<string, TypeRef>;
+} as const;
export const speechTrackProducers = {
createSet: { module: speechTrackModuleRef, name: "create-track-set" },
appendTake: { module: speechTrackModuleRef, name: "append-track-take" },
assembleTrack: { module: speechTrackModuleRef, name: "assemble-semantic-track" },
- projectVisual: { module: speechTrackModuleRef, name: "project-semantic-visual-track" },
-} satisfies Record<string, ProducerRef>;
-
-const string = { kind: "string", minLength: 1 } as const;
-const object = (fields: Readonly<Record<string, { readonly schema: ValueSchema; readonly optional?: boolean }>>): ValueSchema => ({
- kind: "object",
- fields,
-});
-
-export const speechTrackHeaderSchema: ValueSchema = object({
- id: { schema: string },
-});
-
-export const speechTrackVisualSpecSchema: ValueSchema = object({
- stackingOrder: { schema: { kind: "number", integer: true } },
- presentation: { schema: mediaFramePresentationSchema },
- sampleAppearance: { schema: mediaSampleAppearanceSchema },
- motion: { schema: mediaLifecycleMotionSchema },
- framePaint: { schema: mediaPaintLayerSpecSchema, optional: true },
- samplingMotion: { schema: mediaSamplingMotionSchema, optional: true },
-});
-
-export const speechTrackSetSchema: ValueSchema = object({
- takes: { schema: { kind: "array", items: object({
- semantic: { schema: semanticTakeSchema },
- visual: { schema: object({
- frame: { schema: spatialFrameSchema },
- fit: { schema: contentFitSchema },
- spec: { schema: speechTrackVisualSpecSchema },
- }), optional: true },
- }) } },
-});
-
-const visualRecipeProperties = [
- { name: "fit", required: false, fallback: "contain",
- values: ["contain", "cover", "fit-width", "fit-height", "native", "scale-down", "stretch"],
- summary: "Decides how the Take's picture is scaled before it is placed: `contain` and `cover` keep its aspect ratio inside or across the Frame, `fit-width` and `fit-height` match one Frame edge, `native` keeps its own pixels, `scale-down` shrinks it only when it overflows, and `stretch` takes the Frame's exact size." },
- { name: "frame-x", required: false, fallback: "0.5",
- summary: "Places the destination alignment point across the fitting area left after border and padding, from 0 at its left edge to 1 at its right." },
- { name: "frame-y", required: false, fallback: "0.5",
- summary: "Places the destination alignment point down the fitting area left after border and padding, from 0 at its top edge to 1 at its bottom." },
- { name: "content-x", required: false, fallback: "0.5",
- summary: "Chooses the point across the scaled picture's width that meets the Frame's anchor, as a fraction from 0 at its left edge to 1 at its right." },
- { name: "content-y", required: false, fallback: "0.5",
- summary: "Chooses the point down the scaled picture's height that meets the Frame's anchor, as a fraction from 0 at its top edge to 1 at its bottom." },
- { name: "fit-offset-x", required: false, fallback: "0",
- summary: "Shifts the placed picture horizontally in pixels once the two anchor points meet." },
- { name: "fit-offset-y", required: false, fallback: "0",
- summary: "Shifts the placed picture vertically in pixels once the two anchor points meet." },
- { name: "fit-constraint", required: false, fallback: "bounded", values: ["bounded", "free"],
- summary: "With bounded, large content keeps the fitting area covered on each axis and small content stays inside it; free preserves the authored alignment and offsets. Clipping is controlled separately." },
- { name: "opacity", required: false, fallback: "1",
- summary: "Sets how opaque the Take's picture is drawn." },
- { name: "blur", required: false, fallback: "0",
- summary: "Blurs the Take's picture by a pixel radius." },
- { name: "brightness", required: false, fallback: "1",
- summary: "Scales the brightness of the Take's picture." },
- { name: "contrast", required: false, fallback: "1",
- summary: "Scales the contrast of the Take's picture." },
- { name: "saturation", required: false, fallback: "1",
- summary: "Scales the saturation of the Take's picture." },
- { name: "clip", required: false, values: ["none", "frame", "rounded"], fallback: "frame",
- summary: "Clips the Take's picture to its Frame, leaves overflow visible, or rounds the Frame." },
- { name: "radius", required: false, fallback: "0",
- summary: "Sets the rounded clip radius in pixels; half the side of a square Frame makes a circle." },
- { name: "padding", required: false, fallback: "0",
- summary: "Insets the picture's fitting area inside the border, using quoted pixel values: one for all sides, two for vertical/horizontal, or four for top/right/bottom/left." },
- { name: "border-width", required: false, fallback: "0",
- summary: "Draws a border of this pixel width around the Frame." },
- { name: "border-style", required: false, values: ["solid", "dashed", "dotted"], fallback: "solid",
- summary: "Chooses how a non-zero border is stroked." },
- { name: "border-color", required: false,
- summary: "Sets the color of a non-zero border." },
- { name: "shadows", required: false, fallback: "none",
- summary: "Casts Frame shadows written as `x y blur spread color` entries separated by semicolons." },
- { name: "frame-paint", required: false, fallback: "transparent",
- summary: "Fills the Frame behind the Take with a solid or gradient paint." },
-] as const;
-
-const visualMotionRecipeProperties = [
- { name: "enter", required: false, fallback: "none",
- values: ["none", "fade", "slide", "scale", "pop", "bounce", "blur-reveal", "wipe", "flip", "spin"],
- summary: "Chooses the visual entrance applied inside this Segment." },
- { name: "enter-frames", required: false,
- summary: "Sets the entrance length in frames when an entrance is selected." },
- { name: "enter-easing", required: false, values: ["linear", "ease-in", "ease-out", "ease-in-out"], fallback: "ease-in-out",
- summary: "Shapes the entrance's acceleration." },
- { name: "enter-direction", required: false, values: ["left", "right", "up", "down"],
- summary: "Sets the direction of a directional entrance." },
- { name: "enter-amount", required: false,
- summary: "Sets how far the entrance displaces the visual." },
- { name: "sustain", required: false, fallback: "none",
- summary: "Applies continuous visual motion over the Segment as `operator amount cycles [direction]`." },
- { name: "exit", required: false, fallback: "none",
- values: ["none", "fade", "slide", "scale", "pop", "bounce", "blur-reveal", "wipe", "flip", "spin"],
- summary: "Chooses the visual exit applied inside this Segment." },
- { name: "exit-frames", required: false,
- summary: "Sets the exit length in frames when an exit is selected." },
- { name: "exit-easing", required: false, values: ["linear", "ease-in", "ease-out", "ease-in-out"], fallback: "ease-in-out",
- summary: "Shapes the exit's acceleration." },
- { name: "exit-direction", required: false, values: ["left", "right", "up", "down"],
- summary: "Sets the direction of a directional exit." },
- { name: "exit-amount", required: false,
- summary: "Sets how far the exit displaces the visual." },
-] as const;
-
+} as const;
+export const speechTrackHeaderSchema: ValueSchema = { kind: "object", fields: { id: { schema: { kind: "string", minLength: 1 } } } };
+export const speechTrackSetSchema: ValueSchema = { kind: "object", fields: { takes: { schema: { kind: "array", items: { kind: "object", fields: { semantic: { schema: semanticTakeSchema } } } } } } };
export const speechTrackMarkupSurfaces = [{
- name: "track",
- tag: "Track",
- mode: "structured",
- outputs: [speechTrackTypes.header, speechTrackTypes.visualSpec, spatialTypes.fit,
- semanticTrackTypes.track,
- compositionTypes.visualTrack, compositionTypes.audioTrack],
- vocabulary: {
- summary: "Folds ordered SemanticTakes into one SemanticTrack, then publishes its aligned VisualTrack and AudioTrack projections.",
- appearance: "The performance picture, presented full-frame, as an inset, or as a transparent foreground cutout. Each Take is fitted into its selected Frame with optional rounded clipping, border, padding, backing and shadow. Visual-z or the Take's z sets its position among other visual Tracks. Takes run in Source order; a Take can choose its own Frame and appearance at a boundary. Lifecycle motion moves the framed presentation, while Sampling moves its picture inside the Frame. These visual choices preserve the performance's semantic time and separate audio output.",
- preview: previewImage("Track.png"),
- attributes: [
- { name: "id", kind: "identifier", required: true,
- summary: "Names this Track and prefixes every projection it publishes." },
- { name: "visual-frame", kind: "reference", required: true, accepts: [spatialTypes.frame],
- summary: "Chooses the Frame every visual Take occupies unless the Take names its own." },
- { name: "visual-appearance", kind: "reference", required: true, accepts: [svsRecipeType],
- summary: "Chooses the Recipe that fits every visual Take into its Frame unless the Take names its own.",
- recipe: visualRecipeProperties },
- { name: "visual-z", kind: "literal", required: true,
- summary: "Sets the stacking order every visual Take is composited at unless the Take names its own." },
- { name: "visual-motion", kind: "reference", required: false, accepts: [svsRecipeType],
- summary: "Chooses visual-only entrance, sustained motion and exit for every Take unless a Take names its own.",
- recipe: visualMotionRecipeProperties },
- ],
- children: [
- { tag: "Take", cardinality: "many",
- summary: "One self-contained SemanticTake, in document order; optional Sampling children move its picture inside the Frame.",
- attributes: [
- { name: "source", kind: "reference", required: true, accepts: [speechTypes.semanticTake],
- summary: "Chooses the normalized and locally aligned SemanticTake this Track assembles." },
- { name: "frame", kind: "reference", required: false, accepts: [spatialTypes.frame],
- summary: "Chooses this Take's own Frame in place of the Track's `visual-frame`." },
- { name: "appearance", kind: "reference", required: false, accepts: [svsRecipeType],
- summary: "Chooses this Take's own fit Recipe in place of the Track's `visual-appearance`.",
- recipe: visualRecipeProperties },
- { name: "z", kind: "literal", required: false,
- summary: "Sets this Take's own stacking order in place of the Track's `visual-z`." },
- { name: "motion", kind: "reference", required: false, accepts: [svsRecipeType],
- summary: "Chooses this Take's own visual-only motion in place of the Track's `visual-motion`.",
- recipe: visualMotionRecipeProperties },
- ] },
- ],
- ports: [
- { name: "semantic", type: semanticTrackTypes.track,
- summary: "The ordered semantic timeline whose items retain each self-contained SemanticTake." },
- { name: "visual", type: compositionTypes.visualTrack,
- summary: "The speech picture projected from the SemanticTrack, an ordinary peer VisualTrack." },
- { name: "audio", type: compositionTypes.audioTrack,
- summary: "The speech sound clips projected from the SemanticTrack, an ordinary peer AudioTrack." },
- ],
- example: `<speech:Track id="speech"
- visual-frame={speech-frame} visual-appearance={recipes.speech.visual} visual-z="0">
- <speech:Take source={opening.take}/>
- <speech:Take source={closing.take}/>
-</speech:Track>`,
- notes: [
- "A Track requires at least one Take and accepts no text content.",
- "`visual-appearance` and a Take's `appearance` use the shared Media Item styling listed here: fit, visual filtering, Frame paint, clipping, border and shadow.",
- "Media normalization, acoustic evidence and Segment alignment happen before a Take enters the Track.",
- "Speech visual motion changes only the projected picture inside its Segment; it does not retime the SemanticTake or its audio.",
- "A Take accepts Sampling children with the same `at`, `zoom`, `x`, `y`, `rotate` and `easing` fields as a direct Media Item; at least two keyframes cover normalized Segment progress.",
- "Playback, source trim, independent Windows, replacement Sequences and separate pictures remain ordinary Media Track concerns.",
- ],
- },
- }] as const;
-
-
+ name: "track", tag: "Track", mode: "structured",
+ outputs: [speechTrackTypes.header, semanticTrackTypes.track, compositionTypes.audioTrack],
+ vocabulary: {
+ summary: "Assembles ordered SemanticTakes into one semantic timeline and its original performance audio.",
+ attributes: [{ name: "id", kind: "identifier", required: true, summary: "Names the semantic assembly and its outputs." }],
+ children: [{ tag: "Take", cardinality: "many", summary: "A prepared SemanticTake in performance order.",
+ attributes: [{ name: "source", kind: "reference", required: true, accepts: [speechTypes.semanticTake], summary: "The normalized, aligned performance." }] }],
+ ports: [
+ { name: "semantic", type: semanticTrackTypes.track, summary: "The semantic timeline, retaining its prepared material." },
+ { name: "audio", type: compositionTypes.audioTrack, summary: "Original performance audio aligned to that timeline; select it explicitly in Film." },
+ ],
+ example: '<speech:Track id="speech"><speech:Take source={opening.take}/><speech:Take source={answer.take}/></speech:Track>',
+ notes: ["Use Media or a project visual component to present the performance. Those components choose placement and motion independently of semantic assembly."],
+ },
+}] as const;
export const speechTrackManifest: ModuleManifest = {
format: "hypit.module@1",
name: speechTrackModuleRef.name,
@@ -216,14 +37,11 @@ export const speechTrackManifest: ModuleManifest = {
dependencies: [
speechDependency,
compositionDependency,
- spatialDependency,
- { module: svsModuleRef },
semanticTrackDependency,
],
types: [
{ name: speechTrackTypes.header.name },
{ name: speechTrackTypes.trackSet.name },
- { name: speechTrackTypes.visualSpec.name },
],
capabilities: [],
producers: [
@@ -238,9 +56,6 @@ export const speechTrackManifest: ModuleManifest = {
inputs: [
{ name: "set", type: speechTrackTypes.trackSet },
{ name: "take", type: speechTypes.semanticTake },
- { name: "frame", type: spatialTypes.frame },
- { name: "fit", type: spatialTypes.fit },
- { name: "visualSpec", type: speechTrackTypes.visualSpec },
],
outputs: [{ name: "set", type: speechTrackTypes.trackSet }],
needs: [],
@@ -254,14 +69,5 @@ export const speechTrackManifest: ModuleManifest = {
outputs: [{ name: "track", type: semanticTrackTypes.track }],
needs: [],
},
- {
- name: speechTrackProducers.projectVisual.name,
- inputs: [
- { name: "track", type: semanticTrackTypes.track },
- { name: "set", type: speechTrackTypes.trackSet },
- ],
- outputs: [{ name: "visual", type: compositionTypes.visualTrack }],
- needs: [],
- },
],
};
diff --git a/packages/speech-track/src/program.ts b/packages/speech-track/src/program.ts
index 0c8a0e4d..c49ff5f4 100644
--- a/packages/speech-track/src/program.ts
+++ b/packages/speech-track/src/program.ts
@@ -2,79 +2,16 @@ import { assertSemanticTakeIdentity } from "@hypit/speech";
import type { SemanticTake } from "@hypit/speech";
import { sealSemanticTrack } from "@hypit/semantic-track";
import type { SemanticTrack } from "@hypit/semantic-track";
-import { canonicalize } from "@hypit/protocol";
-import {
- assertMediaFramePresentation,
- assertMediaLifecycleMotion,
- assertMediaPaintLayerSpec,
- sealMediaSampleLayerSpec,
-} from "@hypit/media-track";
-import { assertContentFit, assertSpatialFrame } from "@hypit/spatial";
-import type { ContentFit, SpatialFrame } from "@hypit/spatial";
-
-import type {
- SpeechTrackHeader,
- SpeechTrackSet,
- SpeechTrackTake,
- SpeechTrackVisualSpec,
-} from "./types.js";
-
+import type { SpeechTrackHeader, SpeechTrackSet, SpeechTrackTake } from "./types.js";
function assert(condition: unknown, message: string): asserts condition {
if (!condition) throw new Error(message);
}
-
-function headerContent(value: SpeechTrackHeader): SpeechTrackHeader {
- return { id: value.id };
-}
-
-export function sealSpeechTrackHeader(value: SpeechTrackHeader): SpeechTrackHeader {
- return headerContent(value);
-}
-
+export function sealSpeechTrackHeader(value: SpeechTrackHeader): SpeechTrackHeader { return { id: value.id }; }
export function assertSpeechTrackHeader(value: SpeechTrackHeader): void {
assert(value.id.trim().length > 0, "SpeechTrackHeader id must not be empty");
}
-
-function setContent(value: SpeechTrackSet): SpeechTrackSet {
- return canonicalize({
- takes: value.takes,
- }) as unknown as SpeechTrackSet;
-}
-
-function sealSpeechTrackSet(value: SpeechTrackSet): SpeechTrackSet {
- return setContent(value);
-}
-
-function assertTake(take: SpeechTrackTake): void {
- assertSemanticTakeIdentity(take.semantic);
- const { media, segment } = take.semantic;
- assert((media.visual === undefined) === (take.visual === undefined),
- `Speech Segment ${segment.segmentId} visual policy does not match its media`);
- if (take.visual !== undefined) {
- assertSpatialFrame(take.visual.frame);
- assertContentFit(take.visual.fit);
- assertSpeechTrackVisualSpec(take.visual.spec);
- }
-}
-
-export function sealSpeechTrackVisualSpec(value: SpeechTrackVisualSpec): SpeechTrackVisualSpec {
- const result = structuredClone(value);
- assertSpeechTrackVisualSpec(result);
- return result;
-}
-
-export function assertSpeechTrackVisualSpec(value: SpeechTrackVisualSpec): void {
- assert(Number.isSafeInteger(value.stackingOrder), "SpeechTrackVisualSpec stacking order is invalid");
- assertMediaFramePresentation(value.presentation, "SpeechTrackVisualSpec.presentation");
- assertMediaLifecycleMotion(value.motion, 1, "SpeechTrackVisualSpec.motion");
- sealMediaSampleLayerSpec({
- id: "speech-visual",
- appearance: value.sampleAppearance,
- ...(value.samplingMotion === undefined ? {} : { samplingMotion: value.samplingMotion }),
- });
- if (value.framePaint !== undefined) assertMediaPaintLayerSpec(value.framePaint);
-}
-
+function sealSpeechTrackSet(value: SpeechTrackSet): SpeechTrackSet { return structuredClone(value); }
+function assertTake(take: SpeechTrackTake): void { assertSemanticTakeIdentity(take.semantic); }
export function assertSpeechTrackSet(value: SpeechTrackSet): void {
const segments = new Set<string>();
for (const take of value.takes) {
@@ -104,26 +41,8 @@ function appendTake(
});
}
-export function appendSpeechTrackTake(
- set: SpeechTrackSet,
- semantic: SemanticTake,
- frame: SpatialFrame,
- fit: ContentFit,
- visualSpec: SpeechTrackVisualSpec,
-): SpeechTrackSet {
- assertSpatialFrame(frame);
- assertContentFit(fit);
- assertSpeechTrackVisualSpec(visualSpec);
- assertSemanticTakeIdentity(semantic);
- const take = {
- semantic,
- ...(semantic.media.visual === undefined ? {} : { visual: {
- frame: structuredClone(frame),
- fit: structuredClone(fit),
- spec: structuredClone(visualSpec),
- } }),
- } satisfies SpeechTrackTake;
- return appendTake(set, take);
+export function appendSpeechTrackTake(set: SpeechTrackSet, semantic: SemanticTake): SpeechTrackSet {
+ return appendTake(set, { semantic });
}
export function assembleSpeechTrack(
diff --git a/packages/speech-track/src/projection.ts b/packages/speech-track/src/projection.ts
deleted file mode 100644
index e0b9cee9..00000000
--- a/packages/speech-track/src/projection.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-import { sealVisualTrack } from "@hypit/composition";
-import type { VisualTrack } from "@hypit/composition";
-import { lowerRestrictedSpeechVisualPresents } from "@hypit/media-track";
-import { projectSemanticProgramSpace, semanticTrackSpans } from "@hypit/semantic-track";
-import type { SemanticTrack } from "@hypit/semantic-track";
-import { assertSpeechTrackSet } from "./program.js";
-import type { SpeechTrackSet } from "./types.js";
-
-export function projectSpeechTrackVisual(track: SemanticTrack, set: SpeechTrackSet): VisualTrack {
- assertSpeechTrackSet(set);
- const space = projectSemanticProgramSpace(track);
- const trackId = `${track.id}:visual`;
- const placementBySegment = new Map(set.takes.flatMap((item) => item.visual === undefined
- ? []
- : [[item.semantic.segment.segmentId, item.visual] as const]));
- return sealVisualTrack({
- programSpaceId: space.id,
- visualIr: "hypit.visual-ir@1",
- id: trackId,
- presents: lowerRestrictedSpeechVisualPresents(
- trackId,
- space,
- semanticTrackSpans(track).flatMap(({ item, startFrame, endFrameExclusive }) => {
- const visual = item.take.media.visual;
- const placement = placementBySegment.get(item.take.segment.segmentId);
- if (visual === undefined || placement === undefined) return [];
- return [{
- id: item.take.segment.segmentId,
- subjectId: item.take.segment.segmentId,
- span: { startFrame, endFrameExclusive },
- artifact: visual.artifact,
- extent: { widthPx: visual.width, heightPx: visual.height },
- frameRate: space.frameRate,
- frameCount: endFrameExclusive - startFrame,
- frame: placement.frame,
- fit: placement.fit,
- ...placement.spec,
- }];
- }),
- ),
- });
-}
diff --git a/packages/speech-track/src/surface.ts b/packages/speech-track/src/surface.ts
index c1a05027..b7055bb9 100644
--- a/packages/speech-track/src/surface.ts
+++ b/packages/speech-track/src/surface.ts
@@ -1,275 +1,35 @@
-import {
- localName,
- textAttribute as stringAttribute,
- type StructuredElement,
- type StructuredSurfaceHandler,
- type SurfaceResolvedReference,
- type MarkupAttributeValue,
-} from "@hypit/markup";
+import { assertAttributes, assertEmptyElement, localName, textAttribute, type StructuredSurfaceHandler } from "@hypit/markup";
import { sameType } from "@hypit/protocol";
import { speechTypes } from "@hypit/speech";
-import {
- decodeMediaFramePaint,
- decodeMediaMotion,
- decodeMediaPresentation,
- decodeMediaSamplingKeyframe,
- decodeMediaSampleAppearance,
- mediaAppearanceKeys,
-} from "@hypit/media-track";
-import type { MediaSamplingMotion } from "@hypit/media-track";
-import type { SvsRecipe } from "@hypit/svs";
-import { svsRecipeType } from "@hypit/svs";
-
import { createSpeechTrackFragment } from "./fragment.js";
import { speechTrackTypes } from "./manifest.js";
-import { sealSpeechTrackHeader, sealSpeechTrackVisualSpec } from "./program.js";
-import {
- contentFitPropertyNames,
- decodeContentFitProperties,
- spatialTypes,
-} from "@hypit/spatial";
-
-function allowedAttributes(element: StructuredElement, required: readonly string[], optional: readonly string[]): void {
- const keys = Object.keys(element.attributes);
- const missing = required.filter((name) => !keys.includes(name));
- const unknown = keys.filter((name) => !required.includes(name) && !optional.includes(name));
- if (missing.length > 0 || unknown.length > 0) {
- throw new Error(`${element.name} requires ${required.join(", ")}${optional.length === 0 ? "" : ` and optionally ${optional.join(", ")}`}`);
- }
-}
-
-function integerAttribute(element: StructuredElement, name: string): number {
- const raw = stringAttribute(element, name);
- const value = Number(raw);
- if (!Number.isSafeInteger(value)) throw new Error(`${element.name}.${name} must be an integer`);
- return value;
-}
-
-function referencePath(element: StructuredElement, name: string): string {
- const value: MarkupAttributeValue | undefined = element.attributes[name];
- if (typeof value !== "object" || value.kind !== "reference" || !value.path) {
- throw new Error(`${element.name}.${name} must be a whole-value reference`);
- }
- return value.path;
-}
-
-function resolve(
- element: StructuredElement,
- name: string,
- expected: SurfaceResolvedReference["type"],
- resolveReference: (path: string) => SurfaceResolvedReference | undefined,
-): SurfaceResolvedReference {
- const path = referencePath(element, name);
- const value = resolveReference(path);
- if (value === undefined) throw new Error(`${element.name}.${name} cannot resolve ${path}`);
- if (!sameType(value.type, expected)) throw new Error(`${element.name}.${name} has the wrong type`);
- return value;
-}
-
-const visualAppearancePropertyNames = [
- ...contentFitPropertyNames,
- ...mediaAppearanceKeys.sample.filter((name) => name !== "playback" && name !== "trim-start" && name !== "trim-end"),
- ...mediaAppearanceKeys.frame.filter((name) => name !== "stack-order"),
-] as readonly string[];
-const visualMotionPropertyNames = mediaAppearanceKeys.motion.filter(
- (name) => name !== "enter-origin" && name !== "exit-origin",
-);
-function recipe(value: SurfaceResolvedReference, label: string, allowed: readonly string[]): SvsRecipe {
- if (!sameType(value.type, svsRecipeType) || value.record?.value.kind !== "inline") {
- throw new Error(`${label} must be an authored SVS Recipe`);
- }
- const result = value.record.value.value as unknown as SvsRecipe;
- const unknown = Object.keys(result.properties).filter((name) => !allowed.includes(name));
- if (unknown.length > 0) throw new Error(`${label} has unsupported properties ${unknown.join(", ")}`);
- return result;
-}
-
-function takes(element: StructuredElement): StructuredElement[] {
- const result: StructuredElement[] = [];
- for (const child of element.children) {
- if (child.kind === "text") {
- if (child.value.trim()) throw new Error(`${element.name} accepts only Take children`);
- continue;
- }
- if (localName(child.name) !== "Take") throw new Error(`${element.name} accepts only Take children`);
- result.push(child);
- }
- if (result.length === 0) throw new Error(`${element.name} requires at least one Take`);
- return result;
-}
-
-function samplingMotion(element: StructuredElement): MediaSamplingMotion | undefined {
- const keyframes = element.children.flatMap((child) => {
+export const decodeSpeechTrackSurface: StructuredSurfaceHandler = ({ element, resolveReference }) => {
+ assertAttributes(element, ["id"]);
+ const id = textAttribute(element, "id");
+ const takes = element.children.flatMap(child => {
if (child.kind === "text") {
- if (child.value.trim()) throw new Error(`${element.name} accepts only Sampling children`);
+ if (child.value.trim()) throw new Error("Speech Track accepts only Take children.");
return [];
}
- if (localName(child.name) !== "Sampling") {
- throw new Error(`${element.name} accepts only Sampling children`);
- }
- return [decodeMediaSamplingKeyframe(child)];
- });
- return keyframes.length === 0 ? undefined : { keyframes };
-}
-
-export const decodeSpeechTrackSurface: StructuredSurfaceHandler = ({ element, resolveReference }) => {
- allowedAttributes(element, ["id", "visual-frame", "visual-appearance", "visual-z"], ["visual-motion"]);
- const id = stringAttribute(element, "id");
- const baseFrame = resolve(element, "visual-frame", spatialTypes.frame, resolveReference);
- const baseAppearanceReference = resolve(element, "visual-appearance", svsRecipeType, resolveReference);
- const baseAppearance = recipe(
- baseAppearanceReference,
- `${element.name}.visual-appearance`,
- visualAppearancePropertyNames,
- );
- const baseZ = integerAttribute(element, "visual-z");
- const baseMotionReference = element.attributes["visual-motion"] === undefined
- ? undefined
- : resolve(element, "visual-motion", svsRecipeType, resolveReference);
- const baseMotion = baseMotionReference === undefined
- ? undefined
- : recipe(baseMotionReference, `${element.name}.visual-motion`, visualMotionPropertyNames);
- const frameInputNames = new Map<string, string>();
- const frameInputName = (value: SurfaceResolvedReference, fallback: string): string => {
- const key = JSON.stringify(value.ref);
- const previous = frameInputNames.get(key);
- if (previous !== undefined) return previous;
- frameInputNames.set(key, fallback);
- return fallback;
- };
- const fitInputNames = new Map<string, string>();
- const fitInputName = (value: SurfaceResolvedReference, fallback: string): string => {
- const key = JSON.stringify(value.ref);
- const previous = fitInputNames.get(key);
- if (previous !== undefined) return previous;
- fitInputNames.set(key, fallback);
- return fallback;
- };
- const visualSpecInputNames = new Map<string, string>();
- const visualSpecInputName = (spec: ReturnType<typeof sealSpeechTrackVisualSpec>, fallback: string): string => {
- const key = JSON.stringify(spec);
- const previous = visualSpecInputNames.get(key);
- if (previous !== undefined) return previous;
- visualSpecInputNames.set(key, fallback);
- return fallback;
- };
- const declaredTakes = takes(element).map((take, index) => {
- allowedAttributes(take, ["source"], ["frame", "appearance", "motion", "z"]);
- const suffix = String(index + 1).padStart(4, "0");
- const effectiveFrame = take.attributes.frame === undefined
- ? baseFrame
- : resolve(take, "frame", spatialTypes.frame, resolveReference);
- const effectiveAppearanceReference = take.attributes.appearance === undefined
- ? baseAppearanceReference
- : resolve(take, "appearance", svsRecipeType, resolveReference);
- const effectiveAppearance = take.attributes.appearance === undefined
- ? baseAppearance
- : recipe(effectiveAppearanceReference, `${take.name}.appearance`, visualAppearancePropertyNames);
- const effectiveZ = take.attributes.z === undefined ? baseZ : integerAttribute(take, "z");
- const effectiveMotionReference = take.attributes.motion === undefined
- ? baseMotionReference
- : resolve(take, "motion", svsRecipeType, resolveReference);
- const effectiveMotion = take.attributes.motion === undefined
- ? baseMotion
- : recipe(effectiveMotionReference!, `${take.name}.motion`, visualMotionPropertyNames);
- const effectiveSamplingMotion = samplingMotion(take);
- const framePaint = decodeMediaFramePaint(effectiveAppearance, `${id}.take.${suffix}.frame-paint`);
- const visualSpec = sealSpeechTrackVisualSpec({
- stackingOrder: effectiveZ,
- presentation: decodeMediaPresentation(effectiveAppearance),
- sampleAppearance: decodeMediaSampleAppearance(effectiveAppearance),
- motion: decodeMediaMotion(effectiveMotion),
- ...(framePaint === undefined ? {} : { framePaint }),
- ...(effectiveSamplingMotion === undefined ? {} : { samplingMotion: effectiveSamplingMotion }),
- });
- const visual = {
- frameName: frameInputName(effectiveFrame, take.attributes.frame === undefined ? "visual-base-frame" : `take-${suffix}-frame`),
- fitName: fitInputName(effectiveAppearanceReference, take.attributes.appearance === undefined ? "visual-base-fit" : `take-${suffix}-fit`),
- visualSpecName: visualSpecInputName(visualSpec, `take-${suffix}-visual-spec`),
- frame: effectiveFrame,
- appearance: effectiveAppearance,
- spec: visualSpec,
- };
- return {
- suffix,
- takeName: `take-${suffix}`,
- source: resolve(take, "source", speechTypes.semanticTake, resolveReference),
- visual,
- range: take.range,
- };
- });
- const headerId = `${id}.header`;
- const header = sealSpeechTrackHeader({ id });
- const assembly = createSpeechTrackFragment({
- takes: declaredTakes.map(({ takeName, visual }) => ({
- takeName,
- visual: {
- frameName: visual.frameName,
- fitName: visual.fitName,
- visualSpecName: visual.visualSpecName,
- },
- })),
- });
- const emittedFits = new Set<string>();
- const emittedSpecs = new Set<string>();
- const visualRecords = declaredTakes.flatMap((take) => {
- if (take.visual === undefined) return [];
- const records = [];
- if (!emittedFits.has(take.visual.fitName)) {
- emittedFits.add(take.visual.fitName);
- records.push({
- id: `${id}.${take.visual.fitName}`,
- type: spatialTypes.fit,
- value: { kind: "inline" as const, value: decodeContentFitProperties(
- take.visual.appearance.properties,
- `Speech visual Recipe ${take.visual.appearance.path}`,
- ) },
- range: take.range,
- });
- }
- if (!emittedSpecs.has(take.visual.visualSpecName)) {
- emittedSpecs.add(take.visual.visualSpecName);
- records.push({
- id: `${id}.${take.visual.visualSpecName}`,
- type: speechTrackTypes.visualSpec,
- value: { kind: "inline" as const, value: take.visual.spec },
- range: take.range,
- });
- }
- return records;
+ if (localName(child.name) !== "Take") throw new Error("Speech Track accepts only Take children.");
+ assertAttributes(child, ["source"]);
+ assertEmptyElement(child);
+ const source = child.attributes.source;
+ if (typeof source !== "object" || source.kind !== "reference") throw new Error("Speech Take source must be a reference.");
+ const resolved = resolveReference(source.path);
+ if (resolved === undefined || !sameType(resolved.type, speechTypes.semanticTake)) throw new Error("Speech Take source must be a SemanticTake.");
+ return [resolved];
});
+ const inputs = takes.map((_, index) => ({ takeName: `take-${index + 1}` }));
+ const fragment = createSpeechTrackFragment({ takes: inputs });
return {
- records: [
- { id: headerId, type: speechTrackTypes.header, value: { kind: "inline", value: header }, range: element.range },
- ...visualRecords,
- ],
- components: [
- {
- id,
- fragment: assembly.id,
- inputs: {
- header: { kind: "record", id: headerId },
- ...Object.fromEntries(declaredTakes.flatMap((take) => [
- [take.takeName, take.source.ref],
- ...(take.visual === undefined ? [] : [
- [take.visual.frameName, take.visual.frame.ref],
- [take.visual.fitName, { kind: "record" as const, id: `${id}.${take.visual.fitName}` }],
- [take.visual.visualSpecName, { kind: "record" as const, id: `${id}.${take.visual.visualSpecName}` }],
- ]),
- ])),
- },
- outputs: {
- semantic: `${id}.semantic`,
- visual: `${id}.visual`,
- audio: `${id}.audio`,
- },
- range: element.range,
- },
- ],
- fragments: [assembly],
- exports: [
- `${id}.semantic`, `${id}.visual`, `${id}.audio`,
- ],
+ records: [{ id: `${id}.header`, type: speechTrackTypes.header, value: { kind: "inline", value: { id } }, range: element.range }],
+ fragments: [fragment],
+ components: [{ id, fragment: fragment.id, inputs: {
+ header: { kind: "record", id: `${id}.header` },
+ ...Object.fromEntries(takes.map((take, index) => [inputs[index]!.takeName, take.ref])),
+ }, outputs: { semantic: `${id}.semantic`, audio: `${id}.audio` }, range: element.range }],
+ exports: [`${id}.semantic`, `${id}.audio`],
};
};
diff --git a/packages/speech-track/src/types.ts b/packages/speech-track/src/types.ts
index 567d684a..d8e58683 100644
--- a/packages/speech-track/src/types.ts
+++ b/packages/speech-track/src/types.ts
@@ -1,52 +1,6 @@
-import type { ContentFit, SpatialFrame } from "@hypit/spatial";
-import type {
- MediaFramePresentation,
- MediaLifecycleMotion,
- MediaPaintLayerSpec,
- MediaSampleAppearance,
- MediaSamplingMotion,
-} from "@hypit/media-track";
-
-/** Author-owned policy for one ordered Speech Track. */
-export type SpeechTrackHeader = {
- readonly id: string;
-};
-
-export type SpeechTrackTake = {
- readonly semantic: import("@hypit/speech").SemanticTake;
- readonly visual?: {
- readonly frame: SpatialFrame;
- readonly fit: ContentFit;
- readonly spec: SpeechTrackVisualSpec;
- };
-};
-
-export type SpeechTrackVisualSpec = {
- readonly stackingOrder: number;
- readonly presentation: MediaFramePresentation;
- readonly sampleAppearance: MediaSampleAppearance;
- readonly motion: MediaLifecycleMotion;
- readonly framePaint?: MediaPaintLayerSpec;
- readonly samplingMotion?: MediaSamplingMotion;
-};
-
-/**
- * Package-private immutable fold value. Its order is author meaning; Core sees
- * only fixed-port append Operations for the concrete Track declaration.
- */
-export type SpeechTrackSet = {
- readonly takes: readonly SpeechTrackTake[];
-};
-
-export type SpeechTrackInput = {
- readonly takeName: string;
- readonly visual: {
- readonly frameName: string;
- readonly fitName: string;
- readonly visualSpecName: string;
- };
-};
-
-export type SpeechTrackFragmentOptions = {
- readonly takes: readonly SpeechTrackInput[];
-};
+import type { SemanticTake } from "@hypit/speech";
+export type SpeechTrackHeader = { readonly id: string };
+export type SpeechTrackTake = { readonly semantic: SemanticTake };
+export type SpeechTrackSet = { readonly takes: readonly SpeechTrackTake[] };
+export type SpeechTrackInput = { readonly takeName: string };
+export type SpeechTrackFragmentOptions = { readonly takes: readonly SpeechTrackInput[] };
diff --git a/packages/speech-track/test/program.test.ts b/packages/speech-track/test/program.test.ts
index f4a26243..68ddaf4c 100644
--- a/packages/speech-track/test/program.test.ts
+++ b/packages/speech-track/test/program.test.ts
@@ -1,3 +1,4 @@
+import { projectSemanticAudioTrack, projectSemanticMedia } from "@hypit/semantic-track";
import assert from "node:assert/strict";
import test from "node:test";
import { fixtureResource } from "../../../test/fixture-resource.js";
@@ -8,20 +9,9 @@ import {
appendSpeechTrackTake,
assembleSpeechTrack,
createSpeechTrackSet,
- projectSpeechTrackVisual,
sealSpeechTrackHeader,
- sealSpeechTrackVisualSpec,
} from "@hypit/speech-track";
-const frame = { xPx: 40, yPx: 80, widthPx: 640, heightPx: 900 };
-const fit = {
- sizing: "cover" as const,
- framePoint: { x: 0.5, y: 0.5 },
- contentPoint: { x: 0.5, y: 0.5 },
- offsetPx: { x: 0, y: 0 },
- constraint: "bounded" as const,
-};
-
function semantic(id: string, visual: boolean): SemanticTake {
const media: SynchronizedMedia = {
timeline: { frameRate: { numerator: 30, denominator: 1 }, frameCount: 30 },
@@ -50,39 +40,19 @@ function semantic(id: string, visual: boolean): SemanticTake {
};
}
-test("one Track assembles a continuous SemanticTrack and only visual Takes become presents", () => {
- const header = sealSpeechTrackHeader({ id: "speech" });
- const visualSpec = sealSpeechTrackVisualSpec({
- stackingOrder: 30,
- presentation: {
- clip: { kind: "rounded", radiusPx: 320 },
- padding: { topPx: 0, rightPx: 0, bottomPx: 0, leftPx: 0 },
- border: { widthPx: 4, style: "solid", color: "#ffffff" },
- shadows: [],
- },
- sampleAppearance: {
- opacity: 1,
- filter: { blurPx: 0, brightness: 1, contrast: 1, saturation: 1 },
- },
- motion: { sustain: [] },
- samplingMotion: { keyframes: [
- { atProgress: 0, zoom: 1, offsetX: 0, offsetY: 0, rotationDeg: 0 },
- { atProgress: 1, zoom: 1.08, offsetX: 0, offsetY: -18, rotationDeg: 0 },
- ] },
- });
- let set = createSpeechTrackSet();
- set = appendSpeechTrackTake(set, semantic("voiceover", false), frame, fit, visualSpec);
- set = appendSpeechTrackTake(set, semantic("answer", true), frame, fit, visualSpec);
-
- const semanticTrack = assembleSpeechTrack(header, set);
- const visualTrack = projectSpeechTrackVisual(semanticTrack, set);
-
- assert.deepEqual(semanticTrack.items.map((item) => item.take.segment.segmentId), ["voiceover", "answer"]);
- assert.equal(visualTrack.presents.length, 1);
- assert.equal(visualTrack.presents[0]?.id, "speech:visual:answer");
- assert.deepEqual(visualTrack.presents[0]?.span, { startFrame: 30, endFrameExclusive: 60 });
- const styles = visualTrack.presents[0]?.elements.flatMap((element) => element.style) ?? [];
- assert.equal(styles.find((style) => style.name === "border-radius")?.value, "320px");
- assert.equal(styles.find((style) => style.name === "border")?.value, "4px solid #ffffff");
- assert.equal(visualTrack.presents[0]?.elements.some((element) => element.animation !== undefined), true);
+test("semantic assembly retains audio and material timing without requiring placement", () => {
+ const track = assembleSpeechTrack(sealSpeechTrackHeader({ id: "speech" }),
+ appendSpeechTrackTake(appendSpeechTrackTake(createSpeechTrackSet(), semantic("voiceover", false)), semantic("answer", true)));
+ assert.deepEqual(track.items.map(item => item.take.segment.segmentId), ["voiceover", "answer"]);
+ const audio = projectSemanticAudioTrack(track);
+ assert.deepEqual(audio.clips.map(clip => clip.target), [
+ { startSample: 0, endSampleExclusive: 48000 }, { startSample: 48000, endSampleExclusive: 96000 },
+ ]);
+ const selected = projectSemanticMedia(track, { startFrame: 20, endFrameExclusive: 45 });
+ assert.deepEqual(selected.map(({ span, source }) => ({ span, source })), [
+ { span: { startFrame: 20, endFrameExclusive: 30 }, source: { startFrame: 20, endFrameExclusive: 30 } },
+ { span: { startFrame: 30, endFrameExclusive: 45 }, source: { startFrame: 0, endFrameExclusive: 15 } },
+ ]);
+ assert.equal(selected[0]!.media.visual, undefined);
+ assert.equal(selected[1]!.media.visual?.artifact.resource, fixtureResource("answer:video"));
});
diff --git a/packages/speech-track/test/surface.test.ts b/packages/speech-track/test/surface.test.ts
index b7451f5f..7c13cd6c 100644
--- a/packages/speech-track/test/surface.test.ts
+++ b/packages/speech-track/test/surface.test.ts
@@ -5,8 +5,6 @@ import { fixtureResource } from "../../../test/fixture-resource.js";
import type { StructuredElement, SurfaceResolvedReference } from "@hypit/markup";
import type { SemanticTake } from "@hypit/speech";
import { speechTypes } from "@hypit/speech";
-import { spatialTypes } from "@hypit/spatial";
-import { svsRecipeType } from "@hypit/svs";
import { decodeSpeechTrackSurface } from "@hypit/speech-track";
const take: SemanticTake = {
@@ -43,25 +41,6 @@ function resolved(path: string): SurfaceResolvedReference | undefined {
type: speechTypes.semanticTake,
record: { id: path, type: speechTypes.semanticTake, value: { kind: "inline", value: take } },
};
- if (path === "full") return {
- path,
- ref: { kind: "record", id: path },
- type: spatialTypes.frame,
- record: { id: path, type: spatialTypes.frame, value: { kind: "inline", value: {
- xPx: 0, yPx: 0, widthPx: 720, heightPx: 1280,
- } } },
- };
- if (path === "speech-style") return {
- path,
- ref: { kind: "record", id: path },
- type: svsRecipeType,
- record: { id: path, type: svsRecipeType, value: { kind: "inline", value: {
- path: "speech.base", properties: {
- fit: "cover", clip: "rounded", radius: 360,
- "border-width": 4, "border-color": "#ffffff",
- },
- } } },
- };
return undefined;
}
@@ -69,29 +48,9 @@ test("Speech Track accepts only already-semantic Segment Takes", async () => {
const element: StructuredElement = {
kind: "element",
name: "speech:Track",
- attributes: {
- id: "speech",
- "visual-frame": { kind: "reference", path: "full" },
- "visual-appearance": { kind: "reference", path: "speech-style" },
- "visual-z": "0",
- },
- children: [{
- kind: "element",
- name: "speech:Take",
- attributes: { source: { kind: "reference", path: "opening.take" } },
- children: [
- {
- kind: "element", name: "speech:Sampling",
- attributes: { at: "start", zoom: "1" }, children: [], range: { start: 30, end: 40 },
- },
- {
- kind: "element", name: "speech:Sampling",
- attributes: { at: "end", zoom: "1.08", y: "-18", easing: "ease-out" },
- children: [], range: { start: 41, end: 55 },
- },
- ],
- range: { start: 20, end: 60 },
- }],
+ attributes: { id: "speech" },
+ children: [{ kind: "element", name: "speech:Take",
+ attributes: { source: { kind: "reference", path: "opening.take" } }, children: [], range: { start: 20, end: 60 } }],
range: { start: 0, end: 70 },
};
const output = await decodeSpeechTrackSurface({
@@ -102,21 +61,9 @@ test("Speech Track accepts only already-semantic Segment Takes", async () => {
});
assert.deepEqual(output.components[0]?.outputs, {
semantic: "speech.semantic",
- visual: "speech.visual",
audio: "speech.audio",
});
assert.equal(output.exports?.includes("speech.audio") ?? false, true);
- const visualSpec = output.records.find((record) => record.type.name === "SpeechTrackVisualSpec");
- assert.equal(visualSpec?.value.kind, "inline");
- if (visualSpec?.value.kind !== "inline") throw new Error("Speech Track visual spec was not materialized");
- const value = visualSpec.value.value as unknown as {
- presentation: { clip: { kind: string; radiusPx?: number }; border?: { widthPx: number } };
- samplingMotion?: { keyframes: readonly { atProgress: number; zoom: number; offsetY: number }[] };
- };
- assert.deepEqual(value.presentation.clip, { kind: "rounded", radiusPx: 360 });
- assert.equal(value.presentation.border?.widthPx, 4);
- assert.deepEqual(value.samplingMotion?.keyframes.map(({ atProgress, zoom, offsetY }) => ({ atProgress, zoom, offsetY })), [
- { atProgress: 0, zoom: 1, offsetY: 0 },
- { atProgress: 1, zoom: 1.08, offsetY: -18 },
- ]);
+ assert.equal(output.records.length, 1);
+ assert.deepEqual(output.fragments?.[0]?.inputs.map(input => input.name), ["header", "take-1"]);
});
diff --git a/packages/stand-in/README.md b/packages/stand-in/README.md
deleted file mode 100644
index fc822a4f..00000000
--- a/packages/stand-in/README.md
+++ /dev/null
@@ -1,39 +0,0 @@
-# `@hypit/stand-in`
-
-A stand-in Card is an ordinary generic image Candidate selected by a Run when a composition needs
-visible pixels before the intended media exists. It knows nothing about the displaced Candidate's
-Producer, model, prompt or request. The resulting file goes through the same media operations as any
-other image.
-
-This package exports `card` and the convenience composition `timed-card`. A local media Provider
-draws the Card. `timed-card` then gives that image to `@hypit/media-pipeline`, which holds it for the
-requested duration and adds its clip-local time guide. Model packages do not know these
-Fragments exist.
-
-```xml
-<import from="@hypit/stand-in@1" as="stand-in"/>
-<fragment id="kitchen-card" using="stand-in:timed-card">
- <input name="canvas" from="vertical"/>
- <input name="duration" value="5"/>
- <input name="clock" from="clock"/>
-</fragment>
-<satisfy output="kitchen.video" candidate="kitchen-card.video"/>
-```
-
-Remove the `satisfy` line to select the Source's primary Candidate again. The Card has one visible
-label and its canvas dimensions. The timed composition adds a coherent timecode, frame count and
-progress guide, so the exact clip-local frame remains visible.
-
-## Fragment inputs and exports
-
-| Fragment | Inputs | Export |
-| --- | --- | --- |
-| `card` | `canvas`: CanvasSpace | `image`: BlobArtifact |
-| `timed-card` | `canvas`: CanvasSpace, `duration`: SpeechDuration in seconds, `clock`: ProgramClock | `video`: BlobArtifact |
-
-`from` on a Run input refers to a public value of the Author entry; literal duration can use
-`value="5"`. The card capability still needs a selected media Provider. Studio can use it
-when that Provider admits it for transient execution. An estimated SemanticTake is a separate
-choice supplied by `@hypit/semantic-take-estimate` after normalization.
-
-These are Run Fragments, so this package has no Markup Surface entries in `hypit vocabulary`.
diff --git a/packages/stand-in/package.json b/packages/stand-in/package.json
deleted file mode 100644
index 9c3dd841..00000000
--- a/packages/stand-in/package.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "name": "@hypit/stand-in",
- "version": "0.0.0-dev",
- "license": "SEE LICENSE IN LICENSE",
- "private": true,
- "type": "module",
- "exports": {
- ".": "./src/index.ts"
- },
- "hypit": {
- "activation": "./src/activation.ts"
- },
- "dependencies": {
- "@hypit/artifact": "workspace:*",
- "@hypit/component-kit": "workspace:*",
- "@hypit/elaborator": "workspace:*",
- "@hypit/media-pipeline": "workspace:*",
- "@hypit/program-space": "workspace:*",
- "@hypit/protocol": "workspace:*",
- "@hypit/run": "workspace:*",
- "@hypit/spatial": "workspace:*",
- "@hypit/speech": "workspace:*"
- }
-}
diff --git a/packages/stand-in/src/activation.ts b/packages/stand-in/src/activation.ts
deleted file mode 100644
index 31579be9..00000000
--- a/packages/stand-in/src/activation.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { standInComponent, standInManifest } from "./index.js";
-import { createRunFragmentHostFacet } from "@hypit/run";
-import { standInCardFragment, standInTimedCardFragment } from "./fragment.js";
-
-export const hypitPackage = {
- format: "hypit.node-package@1" as const,
- modules: [{ manifest: standInManifest }],
- components: [standInComponent],
- hostFacets: [createRunFragmentHostFacet({
- name: "@hypit/stand-in@1",
- fragments: {
- card: standInCardFragment,
- "timed-card": standInTimedCardFragment,
- },
- })],
-};
-
-export default hypitPackage;
diff --git a/packages/stand-in/src/fragment.ts b/packages/stand-in/src/fragment.ts
deleted file mode 100644
index 1bbc409e..00000000
--- a/packages/stand-in/src/fragment.ts
+++ /dev/null
@@ -1,64 +0,0 @@
-import { artifactTypes } from "@hypit/artifact";
-import { sealGraphFragment } from "@hypit/elaborator";
-import { mediaPipelineProducers } from "@hypit/media-pipeline";
-import { programSpaceTypes } from "@hypit/program-space";
-import { spatialTypes } from "@hypit/spatial";
-import { speechTypes } from "@hypit/speech";
-
-import { standInProducers } from "./manifest.js";
-
-const input = (name: string) => ({ kind: "fragment-input" as const, name });
-const operation = (name: string) => ({ kind: "fragment-operation" as const, operation: name });
-
-export const standInCardFragment = sealGraphFragment({
- inputs: [{ name: "canvas", type: spatialTypes.canvas }],
- operations: [{
- id: "card",
- producer: standInProducers.card,
- inputs: { canvas: input("canvas") },
- result: { kind: "need", name: "image" },
- }],
- exports: [{ name: "image", type: artifactTypes.blob, root: operation("card") }],
-});
-
-/** A Card held by media-pipeline with its optional clip-local diagnostic guide. */
-export const standInTimedCardFragment = sealGraphFragment({
- inputs: [
- { name: "canvas", type: spatialTypes.canvas },
- { name: "duration", type: speechTypes.duration },
- { name: "clock", type: programSpaceTypes.clock },
- ],
- operations: [
- {
- id: "card",
- producer: standInProducers.card,
- inputs: { canvas: input("canvas") },
- result: { kind: "need", name: "image" },
- },
- {
- id: "layout",
- producer: mediaPipelineProducers.clipTimeLayout,
- inputs: {},
- result: { kind: "output", name: "layout" },
- },
- {
- id: "plan",
- producer: mediaPipelineProducers.planStill,
- inputs: { duration: input("duration"), clock: input("clock"), layout: operation("layout") },
- result: { kind: "output", name: "request" },
- },
- {
- id: "bind",
- producer: mediaPipelineProducers.bindStill,
- inputs: { request: operation("plan"), source: operation("card") },
- result: { kind: "output", name: "request" },
- },
- {
- id: "render",
- producer: mediaPipelineProducers.renderStill,
- inputs: { request: operation("bind") },
- result: { kind: "need", name: "video" },
- },
- ],
- exports: [{ name: "video", type: artifactTypes.blob, root: operation("render") }],
-});
diff --git a/packages/stand-in/src/index.ts b/packages/stand-in/src/index.ts
deleted file mode 100644
index ad99b997..00000000
--- a/packages/stand-in/src/index.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-import type { ComponentPackage } from "@hypit/component-kit";
-import { canonicalize } from "@hypit/protocol";
-import type { CanonicalValue, StoredValue } from "@hypit/protocol";
-import { assertCanvasSpace } from "@hypit/spatial";
-import type { CanvasSpace } from "@hypit/spatial";
-
-import { standInProducers, standInTypes } from "./manifest.js";
-
-export {
- standInCapabilities,
- standInDependency,
- standInManifest,
- standInModuleRef,
- standInProducers,
- standInTypes,
-} from "./manifest.js";
-export { standInCardFragment, standInTimedCardFragment } from "./fragment.js";
-
-/**
- * The minimum visible shape of a generic stand-in. It says nothing about the
- * Producer or model whose output a Run may choose to replace with it.
- */
-export type StandInCardRequest = {
- /** Positive pixel dimensions of the Card. */
- readonly width: number;
- readonly height: number;
-};
-
-function assert(condition: unknown, message: string): asserts condition {
- if (!condition) throw new Error(message);
-}
-
-function positiveInteger(value: unknown, subject: string): number {
- assert(typeof value === "number" && Number.isSafeInteger(value) && value > 0,
- `${subject} must be a positive integer`);
- return value;
-}
-
-export function verifyStandInCardRequest(value: unknown): asserts value is StandInCardRequest {
- assert(value !== null && typeof value === "object" && !Array.isArray(value), "StandInCardRequest must be an object");
- const item = value as Record<string, unknown>;
- positiveInteger(item.width, "StandInCardRequest width");
- positiveInteger(item.height, "StandInCardRequest height");
-}
-
-export function sealStandInCardRequest(value: StandInCardRequest): StandInCardRequest {
- verifyStandInCardRequest(value);
- return canonicalize(value as unknown as CanonicalValue) as unknown as StandInCardRequest;
-}
-
-function inline(value: StoredValue, subject: string): unknown {
- assert(value.kind === "inline", `${subject} must be inline`);
- return value.value;
-}
-
-function typedInline<T>(value: StoredValue, subject: string): T {
- return inline(value, subject) as T;
-}
-
-export const standInComponent = {
- validators: [
- {
- type: standInTypes.cardRequest,
- handler: ({ value }) => { verifyStandInCardRequest(inline(value, "StandInCardRequest")); },
- },
- ],
- producers: [
- {
- producer: standInProducers.card,
- handler: ({ inputs }) => {
- const canvas = typedInline<CanvasSpace>(inputs.canvas!.value, "stand-in Canvas");
- assertCanvasSpace(canvas);
- return { outputs: {}, needs: { image: canonicalize(sealStandInCardRequest({
- width: canvas.widthPx, height: canvas.heightPx,
- })) } };
- },
- },
- ],
-} satisfies ComponentPackage;
diff --git a/packages/stand-in/src/manifest.ts b/packages/stand-in/src/manifest.ts
deleted file mode 100644
index 2c7a946d..00000000
--- a/packages/stand-in/src/manifest.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import { artifactDependency, artifactTypes } from "@hypit/artifact";
-import type { CapabilityRef, ModuleManifest, TypeRef } from "@hypit/protocol";
-import { spatialDependency, spatialTypes } from "@hypit/spatial";
-
-export const standInModuleRef = { name: "@hypit/stand-in", version: "1" } as const;
-export const standInDependency = { module: standInModuleRef } as const;
-
-export const standInTypes = {
- cardRequest: { module: standInModuleRef, name: "StandInCardRequest" },
-} satisfies Record<string, TypeRef>;
-
-/** Draw one stand-in card. Served by a local media Provider; it draws, it never generates. */
-export const standInCapabilities = {
- drawCard: { module: standInModuleRef, name: "draw-card" },
-} satisfies Record<string, CapabilityRef>;
-
-export const standInProducers = {
- card: { module: standInModuleRef, name: "stand-in-card" },
-} as const;
-
-export const standInManifest: ModuleManifest = {
- format: "hypit.module@1",
- name: standInModuleRef.name,
- version: standInModuleRef.version,
- dependencies: [artifactDependency, spatialDependency],
- types: Object.values(standInTypes).map((item) => ({ name: item.name })),
- capabilities: Object.values(standInCapabilities).map((item) => ({ name: item.name, returns: artifactTypes.blob })),
- producers: [
- {
- name: standInProducers.card.name,
- inputs: [{ name: "canvas", type: spatialTypes.canvas }],
- outputs: [],
- needs: [{ name: "image", capability: standInCapabilities.drawCard, returns: artifactTypes.blob }],
- },
- ],
-};
diff --git a/packages/studio/README.md b/packages/studio/README.md
index 448bc9c4..ebec05f9 100644
--- a/packages/studio/README.md
+++ b/packages/studio/README.md
@@ -109,9 +109,8 @@ their Provider explicitly allows in transient authoring execution. The Runtime o
Endpoint activation, Profile bindings, request-level `supports`, credentials and
invocation; Studio receives no Endpoint Registry and makes no decision from pricing,
process location, model name or package name. A Need without transient support stops
-with its exact capability named. A stand-in is an ordinary generic image, video or
-silence Candidate from `@hypit/stand-in`; the Run supplies its visible dimensions and
-duration and selects it with `satisfy`. Model packages do not manufacture stand-ins.
+with its exact capability named. Existing media and completed Outputs enter through
+ordinary Run Candidates selected with `satisfy`.
Studio and an encoded review use the same ordinary Run. Studio evaluates its
transient display closure in the browser; building that Run evaluates the
diff --git a/packages/video-cli/src/vocabulary.ts b/packages/video-cli/src/vocabulary.ts
index d36f2496..1935038e 100644
--- a/packages/video-cli/src/vocabulary.ts
+++ b/packages/video-cli/src/vocabulary.ts
@@ -4,7 +4,7 @@ import { dirname, join, resolve } from "node:path";
import type { CliIo } from "@hypit/cli";
import {
animatableLocalStyles,
- visualBoxSchema, visualElementSchema, visualImageSchema, visualMaskSchema, visualPathCommandSchema,
+ visualProgramSchema, visualBoxSchema, visualElementSchema, visualImageSchema, visualMaskSchema, visualPathCommandSchema,
visualSurfaceSchema, visualTextDocumentSchema, visualTextFlowSchema, visualTextPaintSchema,
visualTextSchema, visualTextTypographySchema, visualTrackSchema, visualVideoSchema,
} from "@hypit/composition";
@@ -220,6 +220,7 @@ export function describeSchema(schema: ValueSchema, indent = ""): string[] {
const VISUAL_SHAPES: Readonly<Record<string, ValueSchema>> = {
"visual-track": visualTrackSchema,
"visual-element": visualElementSchema,
+ program: visualProgramSchema,
box: visualBoxSchema,
mask: visualMaskSchema,
text: visualTextSchema,
@@ -235,7 +236,7 @@ const VISUAL_SHAPES: Readonly<Record<string, ValueSchema>> = {
// Each of these is refused somewhere in composition, or follows from how the emitted CSS is written.
const VISUAL_RULES = [
- "A Present holds exactly one element with no `parent`; every other element names one, and it must be a box or a mask.",
+ "A Present holds exactly one element with no `parent`; every other element names one, and it must be a box, mask or program.",
"`order` is unique across the whole Present, not among siblings.",
"A child's position is measured from its parent's box, not from the Canvas.",
"An animation carries at least two keyframes, and every keyframe of one animation declares the same properties; `atFrame` is Present-relative.",
diff --git a/packages/video-cli/test/packages.ts b/packages/video-cli/test/packages.ts
index 0086c6be..e6eb38a6 100644
--- a/packages/video-cli/test/packages.ts
+++ b/packages/video-cli/test/packages.ts
@@ -23,7 +23,6 @@ import speech from "../../speech/src/activation.js";
import speechEvidence from "../../speech-evidence/src/activation.js";
import semanticTrack from "../../semantic-track/src/activation.js";
import spatial from "../../spatial/src/activation.js";
-import standIn from "../../stand-in/src/activation.js";
import temporal from "../../temporal/src/activation.js";
import visualIr from "../../visual-ir/src/activation.js";
import svs from "../../svs/src/activation.js";
@@ -60,7 +59,6 @@ export const videoTestPackages = [
bind("@hypit/speech-track", speechTrack),
bind("@hypit/whisperx", whisperX),
bind("@hypit/spatial", spatial),
- bind("@hypit/stand-in", standIn),
bind("@hypit/temporal", temporal),
bind("@hypit/media-track", mediaTrack),
bind("@hypit/typography-track", typographyTrack),
diff --git a/packages/visual-ir/README.md b/packages/visual-ir/README.md
index 285e0ae6..408e0a79 100644
--- a/packages/visual-ir/README.md
+++ b/packages/visual-ir/README.md
@@ -1,7 +1,7 @@
# `@hypit/visual-ir`
-The renderer-neutral, code-free terminal visual vocabulary. HyperFrames is the current reference
-render route, not the identity or only possible implementation of this IR.
+The terminal visual vocabulary includes structural elements and explicit renderer-program payloads.
+HyperFrames renders both structural elements and its browser program format.
## Writing a visual program
@@ -17,7 +17,7 @@ coordinates are relative to their parent.
An element may have an `animation` with ordered `keyframes`. Each keyframe has `atFrame`, optional
`easing`, and `style`. `atFrame` is measured from the containing Present's start. Supported animated
-properties are `opacity`, `transform`, `filter` and `clip-path`; easing is `linear`, `ease-in`,
+properties are `opacity`, `transform`, `filter`, `backdrop-filter` and `clip-path`; easing is `linear`, `ease-in`,
`ease-out` or `ease-in-out`. A renderer can evaluate these values at any requested frame.
Video playback uses the element's separate `sampling` map. Its local target intervals select source
@@ -28,3 +28,9 @@ For prepared pixels from another rendering tool, emit a `surface` element with a
CompositableSurfaceRef. Its resource, geometry, color/alpha and temporal metadata let composition
place and sample it through the same Track model. Local masks name their owned content and mask
children. Preparation that transforms another material receives that material as an explicit input.
+
+A `program` element carries an explicit format, an object payload and referenced artifacts. The
+rendering package owns that payload's language and execution. It can place owned structural children
+inside a local program, retaining typed media and fonts. For browser HTML/CSS/JavaScript see
+[HyperFrames](../hyperframes/README.md#local-browser-programs). This separates structural convenience
+from the renderer's fuller composition capabilities.
diff --git a/packages/visual-ir/src/style.ts b/packages/visual-ir/src/style.ts
index 0623a316..70a23254 100644
--- a/packages/visual-ir/src/style.ts
+++ b/packages/visual-ir/src/style.ts
@@ -1,11 +1,4 @@
-/**
- * The one code-free terminal visual language accepted by the official video
- * stack. Author packages may own any Program they want, but a VisualTrack that
- * participates in Composition must lower to this closed profile or contribute
- * a typed CompositableSurface.
- *
- * This is a video contract, not a Core concept and not an author component.
- */
+/** Structural style vocabulary. Renderer programs own their richer layout and code formats. */
export const VISUAL_IR_V1 = "hypit.visual-ir@1" as const;
/**
@@ -30,6 +23,9 @@ export const VISUAL_STYLE_NAMES_V1 = [
"align-self",
"aspect-ratio",
"background",
+ "backdrop-filter",
+ "mix-blend-mode",
+ "isolation",
"background-clip",
"background-color",
"background-image",
@@ -161,7 +157,6 @@ export const VISUAL_STYLE_NAMES_V1 = [
export type VisualStyleNameV1 = typeof VISUAL_STYLE_NAMES_V1[number];
const STYLE_NAMES = new Set<string>(VISUAL_STYLE_NAMES_V1);
-const CROSS_TRACK_STYLES = new Set(["backdrop-filter", "mix-blend-mode"]);
export const VISUAL_STYLE_ENUM_VALUES_V1 = {
"box-sizing": ["border-box", "content-box"],
@@ -191,9 +186,6 @@ export function assertVisualStyleV1(
value: string | number,
label: string,
): void {
- if (CROSS_TRACK_STYLES.has(name)) {
- throw new Error(`${label} contains cross-Track style ${name}.`);
- }
if (!/^-?[a-z][a-z0-9-]*$/u.test(name)) {
throw new Error(`${label} contains invalid style name ${name}.`);
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 8028c36f..7c43a580 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -231,9 +231,6 @@ importers:
'@hypit/seedream':
specifier: workspace:*
version: link:packages/seedream
- '@hypit/semantic-take-estimate':
- specifier: workspace:*
- version: link:packages/semantic-take-estimate
'@hypit/semantic-track':
specifier: workspace:*
version: link:packages/semantic-track
@@ -255,9 +252,6 @@ importers:
'@hypit/speech-track-studio':
specifier: workspace:*
version: link:packages/speech-track-studio
- '@hypit/stand-in':
- specifier: workspace:*
- version: link:packages/stand-in
'@hypit/store-sqlite':
specifier: workspace:*
version: link:packages/store-sqlite
@@ -316,6 +310,18 @@ importers:
specifier: 5.9.3
version: 5.9.3
+ examples/semantic-composition/packages/responsive-explainer:
+ devDependencies:
+ '@types/node':
+ specifier: 24.10.1
+ version: 24.10.1
+ hypit:
+ specifier: workspace:*
+ version: link:../../../..
+ typescript:
+ specifier: 5.9.3
+ version: 5.9.3
+
packages/artifact:
dependencies:
'@hypit/protocol':
@@ -1681,9 +1687,6 @@ importers:
'@hypit/speech':
specifier: workspace:*
version: link:../speech
- '@hypit/stand-in':
- specifier: workspace:*
- version: link:../stand-in
packages/media-pipeline:
dependencies:
@@ -2192,9 +2195,6 @@ importers:
'@hypit/speech':
specifier: workspace:*
version: link:../speech
- '@hypit/stand-in':
- specifier: workspace:*
- version: link:../stand-in
devDependencies:
'@hypit/driver-node':
specifier: workspace:*
@@ -2715,43 +2715,6 @@ importers:
specifier: workspace:*
version: link:../speech
- packages/semantic-take-estimate:
- dependencies:
- '@hypit/component-kit':
- specifier: workspace:*
- version: link:../component-kit
- '@hypit/elaborator':
- specifier: workspace:*
- version: link:../elaborator
- '@hypit/estimate':
- specifier: workspace:*
- version: link:../estimate
- '@hypit/markup':
- specifier: workspace:*
- version: link:../markup
- '@hypit/media':
- specifier: workspace:*
- version: link:../media
- '@hypit/narrative':
- specifier: workspace:*
- version: link:../narrative
- '@hypit/protocol':
- specifier: workspace:*
- version: link:../protocol
- '@hypit/run':
- specifier: workspace:*
- version: link:../run
- '@hypit/speech':
- specifier: workspace:*
- version: link:../speech
- '@hypit/svs':
- specifier: workspace:*
- version: link:../svs
- devDependencies:
- '@hypit/script':
- specifier: workspace:*
- version: link:../script
-
packages/semantic-track:
dependencies:
'@hypit/component-kit':
@@ -2870,24 +2833,15 @@ importers:
'@hypit/markup':
specifier: workspace:*
version: link:../markup
- '@hypit/media-track':
- specifier: workspace:*
- version: link:../media-track
'@hypit/protocol':
specifier: workspace:*
version: link:../protocol
'@hypit/semantic-track':
specifier: workspace:*
version: link:../semantic-track
- '@hypit/spatial':
- specifier: workspace:*
- version: link:../spatial
'@hypit/speech':
specifier: workspace:*
version: link:../speech
- '@hypit/svs':
- specifier: workspace:*
- version: link:../svs
devDependencies:
'@hypit/core':
specifier: workspace:*
@@ -2914,36 +2868,6 @@ importers:
specifier: workspace:*
version: link:../studio-adapter
- packages/stand-in:
- dependencies:
- '@hypit/artifact':
- specifier: workspace:*
- version: link:../artifact
- '@hypit/component-kit':
- specifier: workspace:*
- version: link:../component-kit
- '@hypit/elaborator':
- specifier: workspace:*
- version: link:../elaborator
- '@hypit/media-pipeline':
- specifier: workspace:*
- version: link:../media-pipeline
- '@hypit/program-space':
- specifier: workspace:*
- version: link:../program-space
- '@hypit/protocol':
- specifier: workspace:*
- version: link:../protocol
- '@hypit/run':
- specifier: workspace:*
- version: link:../run
- '@hypit/spatial':
- specifier: workspace:*
- version: link:../spatial
- '@hypit/speech':
- specifier: workspace:*
- version: link:../speech
-
packages/store-sqlite:
dependencies:
'@hypit/core':
diff --git a/skills/hypit/references/playbooks/craft/compositing.md b/skills/hypit/references/playbooks/craft/compositing.md
index 02c35139..da4e10fd 100644
--- a/skills/hypit/references/playbooks/craft/compositing.md
+++ b/skills/hypit/references/playbooks/craft/compositing.md
@@ -54,6 +54,8 @@ Use actual screenshots or recordings when the interface's wording, numbers, navi
are evidence. A generated context shot may surround that screen; explicit compositing is useful
when the exact interface must remain editable and legible. A screenshot as a model reference helps
direct appearance but does not establish that every generated label remained accurate.
+For acquiring that material, [browser capture](../../production/browser-capture.md) provides direct
+screenshots and ordinary scripts for real page interaction and recording.
Keep the screen on the visible screen plane, with believable perspective, gaze and physical access.
For a reverse angle, reason about which background sector the camera now sees instead of mirroring
@@ -76,7 +78,7 @@ evidence, and the feeling of the shot rather than from a fixed layout recipe.
| Full-frame | A `9:16` character-and-scene image and reference-generated performance are the common fit for vertical creator footage. Frame the face, body and real setting for the later composite. |
| Upper or lower split | A square camera image and performance often cover a `9:8` half of a vertical Canvas cleanly, with a small top/bottom crop. A close, intimate phone view may instead be a vertically generated performance whose other half is covered. |
| Foreground cutout | A vertical performance often preserves a natural amount of the speaking body. Remove its background, normalize the alpha-bearing result, and use that same prepared performance as the SemanticTake. |
-| Circular picture-in-picture | A square source with the face near its own center is a useful starting point. Give Speech Track a square Frame and rounded clip whose radius is half the side; its semantic, visual and audio outputs remain one assembly. |
+| Circular picture-in-picture | A square source with the face near its own center is a useful starting point. Present the semantic performance through Media Performance with a square Frame and rounded clip whose radius is half the side. |
| Audio-only A-roll | The performance contributes semantic time and sound but no picture. Another Track fills the Segment with the intended demonstration, POV, B-roll, Typography or MG. |
For a non-overlapping upper/lower split, equal stacking order can express two peer regions; the
@@ -92,7 +94,8 @@ visual evidence and intended target composition decide.
The source image and video direction describe a complete physical scene and camera view. Position a
face high or low, left or right, through framing and meaningful scene relationships when that serves
-the final layout. Editorial graphics remain separate layers and are not objects for the generated
+the final layout. Editorial graphics are composed with the generated material; they may share a component when their
+layout or motion belongs together. They are not objects for the generated
person to see, touch or point toward. [Image direction](image-direction.md#frame-the-image-for-what-it-will-become)
owns the camera-image wording; [Spatial layout](../../production/spatial.md) owns Frame, fit and crop.
@@ -161,7 +164,7 @@ require another kind of Take or Track. Choose which role the cutout serves in th
| Role | Consume the prepared output |
| --- | --- |
-| A speaking performance establishing semantic time | `cutout-media.media` → SemanticTake → Speech Track; include its visual and audio outputs in Film. |
+| A speaking performance establishing semantic time | `cutout-media.media` → SemanticTake → Speech Track; show its prepared picture through Media or a project component and include `speech.audio` when wanted. |
| A visual overlay on an existing semantic timeline | `cutout-media.media` → a Media Item's `media` input; select its Window and include the Track's visual output in Film. |
When the intended artifact is a fixed flattened arrangement of still images, use
diff --git a/skills/hypit/references/production/authoring.md b/skills/hypit/references/production/authoring.md
index 841c34df..c68b11c7 100644
--- a/skills/hypit/references/production/authoring.md
+++ b/skills/hypit/references/production/authoring.md
@@ -106,18 +106,15 @@ Candidate for a Logical Output:
- `<file>` admits project media as a zero-input Candidate;
- `<build-record>` names one public Output from one earlier Build Result;
-- a Run Fragment may provide one or more Candidates, including a generic Card from
- `@hypit/stand-in` or a timed composition of that Card;
+- a Run Fragment computes one or more Candidates from its explicit inputs;
- `<satisfy>` selects one declared Candidate for one Logical Output.
Candidate selection is an implementation decision for this Run. Core checks nominal Type
compatibility and plans the combined Author and Run graphs. It replaces the displaced upstream
subgraph while preserving any upstream Outputs that the selected Candidate itself consumes.
-The Card carries only its Canvas dimensions. When a timed video is needed, the timed composition
-passes that image to Media Pipeline with the Run's duration and clock.
-[Runs and substitutes](runs.md#a-complete-layout-preview) provides a complete example with media
-normalization and estimated semantic timing.
+[Runs](runs.md#generate-material-while-composing) shows how to target prepared material while
+component work continues, then reuse that material for focused rendering and delivery.
## Reuse produced work explicitly
diff --git a/skills/hypit/references/production/component-design.md b/skills/hypit/references/production/component-design.md
index 8e73e504..ff442ad1 100644
--- a/skills/hypit/references/production/component-design.md
+++ b/skills/hypit/references/production/component-design.md
@@ -19,6 +19,16 @@ A board whose rows share layout and persistent state benefits from one component
photo and title can remain peer Tracks. An object that survives several camera cuts keeps the same
authored identity while its state develops. Let shared behavior define the unit.
+A performance moving from full screen into a side viewport and a diagram filling the released space
+can share one component. It owns their relative layout, overlap, masking and coordinated motion.
+A-roll names the performance carrying semantic time; it does not reserve the picture for Speech
+Track. Ordinary presentation can reuse Media; a new relationship can be authored directly. A
+one-off scene is a useful component too. Caption and independent overlays can remain separate.
+
+Give a reusable scene the prepared performance, its outer Window and the Moment that changes its
+layout. Replacing a product or rewriting the Script then changes content and semantic anchors while
+preserving the behavior. The final frame positions come from the selected Takes.
+
Sketch its intended Source use with this video's actual content. The tag and its children should
read like a concise account of the visual idea: which subjects are compared, which answer is already
known, and which statement reveals the next one. This makes the important choices visible early and
diff --git a/skills/hypit/references/production/component-visuals.md b/skills/hypit/references/production/component-visuals.md
index 52b9e8fe..d5edd7ec 100644
--- a/skills/hypit/references/production/component-visuals.md
+++ b/skills/hypit/references/production/component-visuals.md
@@ -23,7 +23,7 @@ The public representation has these parts:
| Present | An independently timed and stacked appearance |
| `span` | Program frames from `startFrame` through the frame before `endFrameExclusive` |
| `stacking` | Absolute paint order among Presents; higher order appears above lower order |
-| Elements | One rooted tree of boxes, text, media, masks or compositable surfaces |
+| Elements | One rooted tree of boxes, text, media, masks, compositable surfaces or renderer programs |
| Animation | Keyframes relative to the containing Present's start |
Use several Presents when items have separate lifetimes or stacking positions. A persistent board
@@ -83,3 +83,33 @@ placement, sampling and lifetime.
For an effect that transforms an image, pass that image as an explicit input to the effect's
preparation. For a local mask, own the mask and content in the same element tree. These relationships
make the required materials available both in Studio and in a render of any selected interval.
+
+## Compose video and graphics in one browser program
+
+When a scene's video viewport and graphics share motion or layout, one component can draw them
+together. `browserProgram` from `hypit/hyperframes` creates a `program` element's payload. Its HTML
+owns the local structure; CSS supplies layout, stacking, masks, filters and blending; optional
+`setup(root, data)` code returns `render(localFrame)`. This function sets the complete state at that
+frame. A range render may start in the middle, so compute state from the frame and authored inputs.
+
+Use ordinary typed children for prepared video, images and exact-font text. A `{{child-id}}` slot in
+the HTML places each direct child exactly once. These children retain their declared resources,
+video sampling and font handling while participating in the program's HTML layout. Extra artifacts
+used by the program belong in its `artifacts` list; `hyperframesResourceUri` supplies their resource
+URLs. The rendering environment materializes those references.
+
+For a semantic performance, `projectSemanticMedia(semantic, window.span)` from
+`hypit/semantic-track` returns each intersecting Take's prepared media, program span and source
+span. Subtract the outer Window's start to obtain Present-local video sampling intervals. Preserve
+the returned source offset: moving or reframing a video changes its presentation while playback
+continues from the same place. Original sound can remain `speech.audio` in Film.
+
+A reusable scene might expose `during={story.selection.explanation}` for its lifetime and
+`reveal={story.moment.demonstrate}` for its layout change. The Surface projects these independently;
+the Producer receives a Window and an Instant. The installed Distribution's
+`examples/semantic-composition/packages/responsive-explainer` shows this complete package: video
+moves from full screen to a side viewport while a diagram enters, with Caption available as a peer.
+
+The program format belongs to the renderer package. `hypit.browser-program@1` runs in the
+HyperFrames browser; another renderer implements the formats it supports. Core still schedules
+ordinary Needs and has no knowledge of scenes, video windows or browser layout.
diff --git a/skills/hypit/references/production/examples/detail.svrun b/skills/hypit/references/production/examples/detail.svrun
new file mode 100644
index 00000000..b5c847b7
--- /dev/null
+++ b/skills/hypit/references/production/examples/detail.svrun
@@ -0,0 +1,8 @@
+<?svml using="@hypit/run-markup@1"?>
+<svrun version="1">
+ <author source="./production.svml"/>
+ <target output="detail.video"/>
+ <!-- Replace the Build id with the Result containing this production's Take. -->
+ <build-record id="kept-take" build="bld_..." output="opening-semantic.take"/>
+ <satisfy output="opening-semantic.take" candidate="kept-take"/>
+</svrun>
diff --git a/skills/hypit/references/production/examples/look.svs b/skills/hypit/references/production/examples/look.svs
index 56483baf..67886058 100644
--- a/skills/hypit/references/production/examples/look.svs
+++ b/skills/hypit/references/production/examples/look.svs
@@ -1,6 +1,6 @@
<?svml using="@hypit/svs@1"?>
<sheet version="1">
- media.performance { fit: cover; }
+ media.performance { stack-order: 0; fit: cover; }
text.title { size: 54; weight: 700; stack-order: 20; }
film.main { background: #18212A; }
</sheet>
diff --git a/skills/hypit/references/production/examples/material.svrun b/skills/hypit/references/production/examples/material.svrun
new file mode 100644
index 00000000..cb2236ce
--- /dev/null
+++ b/skills/hypit/references/production/examples/material.svrun
@@ -0,0 +1,5 @@
+<?svml using="@hypit/run-markup@1"?>
+<svrun version="1">
+ <author source="./production.svml"/>
+ <target output="opening-semantic.take"/>
+</svrun>
diff --git a/skills/hypit/references/production/examples/preview.svrun b/skills/hypit/references/production/examples/preview.svrun
deleted file mode 100644
index 66c99ec0..00000000
--- a/skills/hypit/references/production/examples/preview.svrun
+++ /dev/null
@@ -1,22 +0,0 @@
-<?svml using="@hypit/run-markup@1"?>
-<svrun version="1">
- <author source="./production.svml"/>
- <import as="stand-in" from="@hypit/stand-in@1"/>
- <import as="estimate" from="@hypit/semantic-take-estimate@1"/>
- <target output="main.composition"/>
-
- <fragment id="card" using="stand-in:timed-card">
- <input name="canvas" from="canvas"/>
- <input name="duration" value="5"/>
- <input name="clock" from="clock"/>
- </fragment>
- <satisfy output="performance.video" candidate="card.video"/>
-
- <fragment id="timing" using="estimate:semantic-take">
- <input name="narrative" from="story"/>
- <input name="segment" from="story.segment.opening"/>
- <input name="media" from="performance-preview-media.media"/>
- <input name="policy" from="estimated.policy"/>
- </fragment>
- <satisfy output="opening-semantic.take" candidate="timing.take"/>
-</svrun>
diff --git a/skills/hypit/references/production/examples/production.svml b/skills/hypit/references/production/examples/production.svml
index 38ef559c..93d33bdc 100644
--- a/skills/hypit/references/production/examples/production.svml
+++ b/skills/hypit/references/production/examples/production.svml
@@ -1,11 +1,11 @@
<?svml using="@hypit/markup@1"?>
<svml>
+ <import as="media-track" from="@hypit/media-track@1"/>
<import from="@hypit/script@1"/>
<import as="text" from="@hypit/text@1"/>
<import as="seedance" from="@hypit/seedance@1"/>
<import as="pipeline" from="@hypit/media-pipeline@1"/>
<import as="whisperx" from="@hypit/whisperx@1"/>
- <import as="estimate" from="@hypit/semantic-take-estimate@1"/>
<import as="speech" from="@hypit/speech-track@1"/>
<import as="space" from="@hypit/spatial@1"/>
<import as="program" from="@hypit/program-space@1"/>
@@ -33,29 +33,26 @@
duration="5" aspect-ratio="9:16" generate-audio="true"/>
<pipeline:Normalize id="performance-media" source={performance.video} clock={clock}
video="primary-moving" audio="default" span-authority="video"/>
- <pipeline:Normalize id="performance-preview-media" source={performance.video} clock={clock}
- video="primary-moving" audio="none" span-authority="video"/>
<whisperx:SemanticTake id="opening-semantic" narrative={story}
segment={story.segment.opening} media={performance-media.media} language="en"/>
- <estimate:SemanticTake id="estimated" narrative={story}
- segment={story.segment.opening} media={performance-preview-media.media}
- language="en" pace="normal" rounding="round"/>
- <speech:Track id="speech" visual-frame={full}
- visual-appearance={look.media.performance} visual-z="0">
+ <speech:Track id="speech">
<speech:Take source={opening-semantic.take}/>
</speech:Track>
+ <media-track:Track id="speech-picture" semantic={speech.semantic} canvas={canvas}>
+ <media-track:Performance during="program" frame={full}
+ appearance={look.media.performance}/>
+ </media-track:Track>
<fonts:Stack id="title-font" family="inter" weight="700" style="normal" emoji="color"/>
<typo:Style id="title-style" recipe={look.text.title} font={title-font}>
<typo:Fill color="#F1E7D8"/>
- <typo:Stroke color="#18212A" width="2" placement="outside"/>
</typo:Style>
<typo:Track id="titles" semantic={speech.semantic}>
<typo:Area id="proof-label" placement={title-frame} style={title-style}
during={story.selection.proof}>The useful part</typo:Area>
</typo:Track>
<film:Film id="main" canvas={canvas} semantic={speech.semantic} appearance={look.film.main}>
- <film:Track source={speech.visual}/>
+ <film:Track source={speech-picture.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={titles.track}/>
</film:Film>
diff --git a/skills/hypit/references/production/media.md b/skills/hypit/references/production/media.md
index 84f034e5..03df9ab6 100644
--- a/skills/hypit/references/production/media.md
+++ b/skills/hypit/references/production/media.md
@@ -2,6 +2,8 @@
Read this when admitting files, connecting generated media, choosing streams, or editing a clip
before using it in a Track or a model reference. [Tracks](tracks.md) covers placement and playback.
+For acquiring website screenshots, page recordings or local HTML graphics, read
+[browser capture](browser-capture.md).
Media carries the visible performance and sound. Preparing it for a video answers two further
questions: how it occupies the program's time, and which Script passage it realizes. Normalization
@@ -75,14 +77,13 @@ For an already declared Script and prepared spoken performance:
segment={story.segment.opening} media={performance-media.media} language="en"/>
```
-WhisperX measures the audio; alignment locates the authored words in that evidence. The result
-`opening-semantic.take` contains the same media and that Segment's local timing. Speech Track
-assembles Takes in their intended order and translates their local positions into program time.
+WhisperX supplies timed speech evidence; alignment locates the authored Script in that evidence.
+Script remains the wording authority, and this step establishes where its words occur in the
+performance. The result `opening-semantic.take` contains the same media and that Segment's local
+timing. Speech Track assembles Takes in their intended order and translates their local positions
+into program time.
Use the performed language supported by the selected package and Endpoint.
-For a layout study before speech exists, estimated timing can preserve the same Script identities.
-[Runs and substitutes](runs.md) explains choosing it and the evidence it supplies.
-
Audio-only A-roll follows the same path with audio-only media. Voice Clone produces the Segment's
performed audio from its Script and the person's Voice Reference. Normalize that output with
`video="none"`, `audio="default"` and `span-authority="audio"`, then align it to the same Segment.
@@ -95,24 +96,16 @@ An ordinary Script Segment such as `<empty></empty>` can carry a passage without
media gives it a duration, so the resulting SemanticTake has the Segment's start/end Anchors and no
timed Tokens. It enters the same Speech Track assembly as a spoken Take.
-Use the Surface that matches the evidence you have. For real media, the real semantic Surface maps
-the empty Segment directly to its media domain:
+The semantic Surface maps an empty Segment directly to its prepared media domain:
```svml
<whisperx:SemanticTake id="pause" narrative={story}
segment={story.segment.pause} media={pause-media.media}/>
```
-For preview media, the prediction Surface performs the same boundary materialization:
-
-```svml
-<estimate:SemanticTake id="pause-preview" narrative={story}
- segment={story.segment.pause} media={pause-preview-media.media}/>
-```
-
-Neither branch calls WhisperX or predicts word windows because the Segment has no Tokens. Action,
-music or visual rhythm can determine the media duration. Both publish the ordinary SemanticTake
-consumed by Speech Track; there is no separate wordless downstream type.
+This performs boundary materialization without a transcription request because the Segment has no
+Tokens. Action, music or visual rhythm can determine the media duration. The ordinary SemanticTake
+enters Speech Track alongside spoken Takes.
## Give a still a duration when that is its role
@@ -130,16 +123,7 @@ time-bearing clip, use StillVideo:
StillVideo produces a video-only BlobArtifact. Multiple `media:Still` children divide the authored
duration by their optional weights. Normalization then makes that clip usable as prepared moving
media. Choose it when one or more held images need to become a time-bearing video Artifact; its role
-is assigned by the downstream Source relationships just like any other video. Add
-`guide="clip-time"` only when a short-lived diagnostic view benefits from a visible local timecode,
-frame count and progress ruler; the guide is one display treatment and says nothing about later Film
-placement.
-
-StillVideo itself is not a preview state. A held image intended to remain in the Film is ordinary
-production media. When a Run uses a held image only in place of a future moving shot, that Candidate
-is temporary: keep the actual image as evidence while it is useful, then select the produced video
-when the question depends on motion, performance or changing overlap.
-[Runs](runs.md#use-the-most-representative-visual-evidence-available) owns that choice.
+is assigned by the downstream Source relationships just like any other video.
## Edit bytes at an explicit point in the graph
diff --git a/skills/hypit/references/production/rendering.md b/skills/hypit/references/production/rendering.md
index c547fa06..e7a2240f 100644
--- a/skills/hypit/references/production/rendering.md
+++ b/skills/hypit/references/production/rendering.md
@@ -17,7 +17,7 @@ With the named inputs already declared:
<film:Film id="main" canvas={canvas} semantic={speech.semantic}
appearance={look.film.main}>
- <film:Track source={speech.visual}/>
+ <film:Track source={performance.visual}/>
<film:Track source={speech.audio}/>
<film:Track source={coverage.visual}/>
<film:Track source={captions.track}/>
diff --git a/skills/hypit/references/production/review.md b/skills/hypit/references/production/review.md
index 7ebb439f..83d3c6a0 100644
--- a/skills/hypit/references/production/review.md
+++ b/skills/hypit/references/production/review.md
@@ -14,34 +14,22 @@ Caption readable, does the B-roll cover the intended explanation, and do entries
the right words or actions? Adjust the layout, timing or component behavior that will make the
passage work better. Judge a local change in the surrounding composition.
-Use Craft to give generated pictures and performances strong reference and prompt direction before
-requesting them. Composition usually develops around those produced assets. When a generated item
-fails its intended role, identify the concrete defect and improve the responsible direction before
-deciding on another authorized request. That decision has its own purpose and cost.
+Work from the authored Script and the production's existing semantic timing when locating a word,
+reveal or handoff. Those relationships identify the passages whose composition needs attention;
+Studio and rendered frames show how the chosen assets work there. Carry the same produced media
+and semantic Outputs through layout and component revisions.
## Review the work the Run actually selects
-Open Studio with the ordinary Run intended for the work. That Run binds the Author Source, Targets,
-files, earlier Results, and stand-in Candidates, so Studio and a Build see the same authored graph.
-A separate review Run is useful when its Candidate selection is intentionally different.
+Use the Run that selects the production's actual material. It binds the Author Source, Targets,
+files and earlier Results. Preserve the produced media and semantic Outputs as the composition
+changes. A focused Run can render the affected interval; Studio can open the same selected work
+for interactive playback and editing.
-Judge a visual fact from the most representative evidence that actually exists. Supplied and produced
-images and videos are the primary evidence for their appearance. A held production image can prove
-what that image contains and how it composes with deterministic graphics; it cannot prove the future
-shot's movement or performance. A produced video is the evidence for its changing face position,
-gesture, timing and interaction with Caption or MG.
-
-Studio renders the selected display closure with deterministic Producers and the exact capabilities
-that the Runtime Provider declares safe for transient authoring. It submits no Build and no paid
-generation. When that closure still needs external generation, use an existing file or Build
-Output. An existing image can enter through StillVideo; a Card can fill the remaining case where no
-suitable pixels exist and a component or wiring question still deserves an early look.
-
-A Card can establish that the downstream graph renders, show broad geometry, and carry provisional
-clip time. Its visible marking keeps that evidence distinct from subject identity, performance,
-shot composition, texture, continuity, or the interaction between production media and graphics.
-It stops being useful when the same question can be answered from actual production pixels; earlier
-use does not create an approval state that the work must preserve.
+Judge the relationship that the evidence can establish. A component's own example can show its
+style and behavior. The actual production image establishes its framing and color; the produced
+video shows how moving faces and gestures interact with Caption and MG. Inspect those interactions
+with the material that will appear in the deliverable.
## Separate legality from judgment
@@ -63,10 +51,6 @@ location remains an open question.
Use whichever view can answer the current question:
-- Open Studio, seek and play the ordinary Run, look at the
- current frame, and discover where a layout or motion deserves closer inspection. This is usually
- the cheapest way to work on Caption, MG, Effects, and composition; a Card can supply the minimal
- visible unknown when no more representative media exists yet.
- Once a numeric interval is known, a range render can inspect the corresponding frames of the same
HyperFrames program. The range may come from the playhead, authored clock time, or an existing
Result; HyperFrames does not need to know whether language helped the Agent locate it.
@@ -74,6 +58,8 @@ Use whichever view can answer the current question:
relationship to upstream Candidate reuse.
- On an encoded Result, focused media operations such as frames, cut, and tile can expose exact
pixels, adjacent frames, or a short passage.
+- Open Studio when interactive playback, parameter editing or a component's Companion helps the
+ current work. Seek or select semantic entities to inspect their place in the composition.
- Watch the whole deliverable when the question concerns Hook clarity, story movement, payoff,
CTA, or how A-roll, B-roll, Caption, MG and Effects work together.
@@ -132,7 +118,7 @@ which of those choices belong in this piece.
| The intended story, shot logic, or visual system is wrong | `TREATMENT.md` |
| Words, speakers, Cue breaks, Selections, or Moments are wrong | the Author Source's Script |
| Composition, authored parameters, or semantic/clock relation is wrong | Author Source or Recipe |
-| The wrong file, earlier Output, or stand-in is selected | Run Source |
+| The wrong file or earlier Output is selected | Run Source |
| A reusable visual role cannot express or render its intended design | the project Author Package |
Before changing the work, connect the composition problem to its consequence and the intended
diff --git a/skills/hypit/references/production/runs.md b/skills/hypit/references/production/runs.md
index 53b4e844..e1ed561e 100644
--- a/skills/hypit/references/production/runs.md
+++ b/skills/hypit/references/production/runs.md
@@ -1,7 +1,6 @@
-# Runs, Candidates and substitutes
+# Runs, Targets and reuse
-Read this when choosing deliverables, reusing an Output, replacing media, or preparing a layout
-study before a performance exists. [Authoring](authoring.md#reuse-produced-work-explicitly) explains
+Read this when choosing deliverables, reusing an Output, or selecting media for an execution. [Authoring](authoring.md#reuse-produced-work-explicitly) explains
which produced value still fits an edit; [Builds](builds.md) explains finding and executing it.
A Run says what this execution should complete and which existing or alternative values it should
@@ -16,7 +15,7 @@ One Run uses these author-facing declarations:
| Declaration | Role |
| --- | --- |
| `<author source="./main.svml"/>` | Select the Run's one Author entry. |
-| `<import as="stand-in" from="@hypit/stand-in@1"/>` | Make one installed Run Fragment library available. |
+| `<import as="media" from="@hypit/media-pipeline@1"/>` | Make one installed Run Fragment library available. |
| `<target output="final.video"/>` | Demand one public Author Output; several Targets may be declared. |
| `<file .../>` | Admit one project file as a typed zero-input Candidate. |
| `<build-record .../>` | Admit one exact public Output from one earlier Build Result. |
@@ -64,109 +63,60 @@ Selecting a completed SemanticTake instead preserves its media, Script associati
together. Choose the Output whose meaning matches what should stay; the receiving Type identifies
which kind of value fits that position.
-## Use a Fragment when the substitute needs computation
+## Use a Fragment when a Candidate needs computation
-A Run Fragment connects the computations that produce a Candidate. This composition draws one
-generic Card, then asks Media Pipeline to hold it for the chosen duration with a clip-local guide:
+A Run Fragment connects computations that produce a Candidate. For example, an authored still image
+can become a timed video through Media Pipeline's ordinary `still-video` Fragment:
```svrun
-<import as="stand-in" from="@hypit/stand-in@1"/>
-<fragment id="card" using="stand-in:timed-card">
- <input name="canvas" from="canvas"/>
+<import as="media" from="@hypit/media-pipeline@1"/>
+<fragment id="product-hold" using="media:still-video">
<input name="duration" value="5"/>
<input name="clock" from="clock"/>
+ <input name="layout" from="product-layout"/>
+ <input name="source-0" from="product-image"/>
</fragment>
-<satisfy output="performance.video" candidate="card.video"/>
+<satisfy output="product-clip.video" candidate="product-hold.video"/>
```
+Here `product-layout` is an Author value of Type `@hypit/media-pipeline@1#StillVideoLayout`,
+containing `{"weights":[1]}`; `product-image` is an authored image Blob. The package README owns the
+Fragment's exact inputs. [Media](media.md#give-a-still-a-duration-when-that-is-its-role) shows the
+simpler `StillVideo` Surface for authoring this directly in the Source.
+
Place imports after `author` and before execution declarations. `using` names a Fragment from an
installed package. `from` on an input names a public value of the Run's Author entry, including a
computed Output. The latter retains its own dependencies and any Candidate selection. It does not
name another Run Candidate or automatically expose an imported Source's private bindings.
-The resulting Candidate is named `card.video`. Selecting it replaces the performance request while
-retaining the preparation and composition that consume that video. A substitute can also consume
-an existing computed Output; that Output remains part of the selected dependencies.
-
-## Use the most representative visual evidence available
-
-Supplied and produced images and videos are the primary visual evidence for a production. Select a
-usable video itself when it exists. While an intended video is still unavailable, an actual image
-from the work can be held with `media-pipeline:still-video` or
-`media-pipeline:clip-time-still-video`; it carries real subject, color and camera evidence into the
-composition, although it cannot establish the future motion or performance. A generic Card is useful
-only when no suitable pixels exist and a current component or wiring question is worth answering
-before generation completes.
-
-For example, keep a previously produced presenter image, give it provisional clip time, and use that
-video Candidate at the position where the future performance will enter:
-
-```svrun
-<import as="media" from="@hypit/media-pipeline@1"/>
-<build-record id="presenter-image" build="bld_..." output="presenter.image"/>
-<satisfy output="presenter.image" candidate="presenter-image"/>
-
-<fragment id="held-presenter" using="media:clip-time-still-video">
- <input name="duration" value="5"/>
- <input name="clock" from="clock"/>
- <input name="source" from="presenter.image"/>
-</fragment>
-<satisfy output="performance.video" candidate="held-presenter.video"/>
-```
+The resulting Candidate is named `product-hold.video`. Selecting it replaces the computation at
+`product-clip.video` while retaining the preparation and composition that consume that video.
-Preview choices answer the question that exists now; they are not a sequence of production states.
-A production may skip them entirely, use one while media is being generated, or replace one as soon
-as more representative media is available. The Card normally loses its purpose first. A held image
-used in place of future motion loses that purpose when the video exists. Run Candidate selection
-makes each choice explicit without inventing an acceptance or promotion workflow.
+## Generate material while composing
-## A complete layout preview
+Media requests depend on the Script, direction, references and requested duration. Once those
+choices are ready and the commission covers their cost, a Run can target the prepared Takes while
+component and Recipe work continues. Shared decisions such as where a presenter leaves room for
+an overlay belong in Treatment and image direction; encode them in both the material and composition.
The small [production Source](examples/production.svml), [Recipe](examples/look.svs),
-[production Run](examples/production.svrun) and [preview Run](examples/preview.svrun) demonstrate
-the same Film with two execution choices. Copy the files together into a video project to study or
-adapt them. Their simple performance request illustrates system wiring; the actual video's casting,
-references and direction come from its Treatment and the relevant Playbook.
-
-The Source declares measured timing and an estimated alternative. The estimated Surface publishes
-its authored `estimated.policy` as a typed value. The preview Run uses the estimate package's Run
-Fragment to supply the Candidate for the original measured Take:
-
-```svrun
-<fragment id="timing" using="estimate:semantic-take">
- <input name="narrative" from="story"/>
- <input name="segment" from="story.segment.opening"/>
- <input name="media" from="performance-preview-media.media"/>
- <input name="policy" from="estimated.policy"/>
-</fragment>
-<satisfy output="opening-semantic.take" candidate="timing.take"/>
-```
-
-Together with the card selection, this leaves Card drawing, StillVideo rendering, video-only
-normalization and timing estimation as the media work. The original generated performance and
-WhisperX alignment are outside this preview's selected graph. The estimator retains the real
-Segment, Token and Anchor identities and distributes their positions across the prepared media's
-frame count. Those positions show provisional rhythm; real alignment supplies the performance's
-actual word timing.
-
-From the directory containing the copied example:
-
-```bash
-hypit check preview.svrun
-hypit plan preview.svrun
-hypit-studio --run preview.svrun
-```
-
-Studio can materialize this preview with a selected local media Provider that supports the required
-transient capabilities. If the chosen environment does not provide them for Studio, build the
-selected preview media through that environment and reuse its completed Outputs. The normal
-production Run still requests generation and measured alignment, under the work's spending authority.
-
-For an existing production with usable footage, select its Result or file directly. If only an
-authored or generated picture exists, StillVideo gives downstream composition more relevant pixels
-than a Card. The held picture can establish its own identity, color and framing; the actual shot is
-the evidence for motion, performance and the changing relationship between a face and graphics.
-[Studio](studio.md) explains what the selected preview can show.
+[material Run](examples/material.svrun) and [production Run](examples/production.svrun) illustrate
+these execution choices. Copy them together into a project. The simple performance request shows
+system wiring; the work's actual casting, references and direction come from its Treatment and Craft.
+
+`material.svrun` targets `opening-semantic.take`. While it runs, the author can work on the title and
+its placement. Once the Take completes, select it with `build-record` in the production Run so that
+rendering uses the produced performance and its word timing. If material is already available, use
+it directly. Choose Targets according to the dependencies the current work needs.
+
+For a focused composition change, [detail.svrun](examples/detail.svrun) targets frames 30–90 from the
+same Source and reuses that Take. Replace its example Build id with the actual Result id. The new
+Build evaluates the changed composition and selected render interval. The final Run can reuse the
+same Take for full delivery.
+
+[Rendering](rendering.md#choose-a-render-interval-in-frames) explains frame ranges and reuse;
+[Review](review.md) explains judging the actual arrangement. [Studio](studio.md) provides an
+interactive view when playback, parameter editing or a component's Companion is useful.
## Preserve the choices that still apply
diff --git a/skills/hypit/references/production/source-syntax.md b/skills/hypit/references/production/source-syntax.md
index f5998378..1ca4f6d4 100644
--- a/skills/hypit/references/production/source-syntax.md
+++ b/skills/hypit/references/production/source-syntax.md
@@ -56,7 +56,7 @@ Output paths are package vocabulary, not inferred from the element's tag:
- an imported `media:Image id="logo"` publishes `{logo}`;
- `gpt:Image id="portrait"` publishes `{portrait.image}`;
- `pipeline:Normalize id="prepared"` publishes `{prepared.media}`;
-- `speech:Track id="speech"` publishes `{speech.semantic}`, `{speech.visual}` and `{speech.audio}`.
+- `speech:Track id="speech"` publishes `{speech.semantic}` and `{speech.audio}`.
Inspect `hypit vocabulary` for the actual Surface's exports and use the published path it reports.
Public bindings can be authored Records or realizable Logical Outputs. Script,
diff --git a/skills/hypit/references/production/spatial.md b/skills/hypit/references/production/spatial.md
index f2ef3aa9..fb3a34ce 100644
--- a/skills/hypit/references/production/spatial.md
+++ b/skills/hypit/references/production/spatial.md
@@ -47,7 +47,7 @@ commands. [Fonts and text](fonts-and-text.md) shows which Typography placement c
## Fit the source into the Frame
-Media Track and Speech Track's visual branch share two spatial roles:
+Media Track separates two spatial roles:
- The **destination Frame** places the visual on the Canvas and supplies its outer shape.
- The **fitted content rectangle** places the scaled source inside that Frame. Its size and position
@@ -106,14 +106,18 @@ already available:
```svml
<space:AnchoredFrame id="presenter-frame" within={canvas}
x="94%" y="94%" width="320px" height="320px" anchor="bottom-right"/>
-<speech:Track id="speech" visual-frame={presenter-frame}
- visual-appearance={look.presenter} visual-z="20">
+<speech:Track id="speech">
<speech:Take source={opening.take}/>
</speech:Track>
+<media:Track id="presenter" semantic={speech.semantic} canvas={canvas}>
+ <media:Performance during="program" frame={presenter-frame}
+ appearance={look.presenter}/>
+</media:Track>
```
```svs
look.presenter {
+ stack-order: 20;
fit: cover;
clip: rounded;
radius: 160;
@@ -142,18 +146,26 @@ and paint. `Sampling` children pan, zoom or rotate the fitted picture under that
for a moving crop or a slow push-in while a card's outline stays still:
```svml
-<speech:Take source={opening.take}>
- <speech:Sampling at="start" zoom="1"/>
- <speech:Sampling at="end" zoom="1.08" y="-18"/>
-</speech:Take>
+<media:Item media={prepared.media} during={story.selection.detail}
+ frame={detail-frame} appearance={look.detail}>
+ <media:Sampling at="start" zoom="1"/>
+ <media:Sampling at="end" zoom="1.08" y="-18"/>
+</media:Item>
```
-This Take excerpt belongs inside Speech Track. Media Track accepts the same Sampling fields on a
-direct-source Item or Member, or on a sampled Layer. `x` and `y` are pixel offsets, `rotate` is in
+This excerpt belongs inside Media Track, with prepared media, a Selection, Frame and Recipe already
+available. Sampling fields apply to a direct-source Item or Member, a sampled Layer, or a Performance.
+`x` and `y` are pixel offsets, `rotate` is in
degrees, and `at` follows the source unit's active span from `start` to `end`, with percentages for
intermediate keys. Sampling acts after the static fit; its movement can expose space inside the
Frame. Choose the crop and motion together for the intended coverage.
+A Performance uses the Track's prepared semantic material, with Sampling and whole-frame motion
+running across its full display Window, including Take boundaries. A scene that coordinates a moving
+performance viewport with surrounding graphics can own that motion in its
+[component program](component-visuals.md#compose-video-and-graphics-in-one-browser-program), while
+retaining the prepared video's source positions.
+
[Tracks](tracks.md) explains the Media/Speech inputs and timing roles. Read their installed
vocabulary for the complete appearance and motion fields.
diff --git a/skills/hypit/references/production/studio.md b/skills/hypit/references/production/studio.md
index 7419b5d5..6fb1b2ee 100644
--- a/skills/hypit/references/production/studio.md
+++ b/skills/hypit/references/production/studio.md
@@ -27,6 +27,19 @@ Runtime or Result repository requires restarting that Studio session: those impl
selections are loaded at startup. A browser refresh alone does not reload the server-side modules.
Stop only the relevant Studio process; stopping Studio does not cancel a submitted Build.
+## Show the finished work
+
+Alongside the delivered video, a brief look at its editable production can make the handoff more
+tangible. When Studio is readily accessible to the user, open the finished work and share the session
+URL. Use a Run that reuses the completed media and SemanticTakes while keeping its Tracks and Recipes
+available for editing. Reuse a suitable existing session or launch one as described above.
+
+Point out something specific to this piece: a reveal tied to a word, the Caption styling, or a
+component parameter they can adjust. Let the actual work demonstrate the editing experience. For a
+remote user, a readily available screenshot or short recording can provide the same introduction.
+[Project handoff](../creation/project-files.md#hand-over-an-editable-production) explains what to
+include when the user wants to continue editing on another machine.
+
## Read the different views
| View | What it shows and what it can change |
@@ -44,22 +57,14 @@ repository. With no Runtime selected, finished Results remain accessible; previe
display closure needs no unresolved Endpoint work. Active Runtime status and transient Endpoint
processing require the selected environment.
-Studio creates no Build and submits no paid generation. It can execute deterministic Producers and
-only those exact immediate capabilities a Provider explicitly permits for transient authoring.
-If new image/video generation blocks the display closure, select an existing Output or file; use
-an existing image through StillVideo when one is available. An explicit Card Candidate can keep a
-component or wiring study moving when no suitable pixels exist yet. It supplies a visible canvas
-and provisional clip time. The selected production image establishes its actual subject, color and
-framing; the produced video adds the evidence for performance, motion and changing overlap with
-graphics.
-
-The Preview view renders what the Run selected; it does not upgrade a Card or held image into stronger
-evidence. Prefer the production's supplied or produced pixels, and revise the Run selection when more
-representative media becomes available. [Runs](runs.md#use-the-most-representative-visual-evidence-available)
-explains the short-lived substitute choices.
-
-[Runs and substitutes](runs.md#a-complete-layout-preview) includes a complete Source and Run with
-a card Candidate, normalization and estimated semantic timing for this kind of layout study.
+Studio opens the selected work for interactive playback and editing. It creates no Build and submits
+no paid generation. It can evaluate deterministic Producers and the exact immediate capabilities a
+Provider permits for transient authoring, such as media inspection and normalization. Select existing
+files or produced Outputs through the Run for the material the view needs. If a required generation
+is still running, continue component work and open its resulting composition when the material is ready.
+
+[Runs](runs.md) explains selection and reuse. [Rendering](rendering.md) provides frame-range Builds
+for inspecting the composition as encoded media; choose the view that helps answer the current question.
## Edit the owning Source fact
diff --git a/skills/hypit/references/production/track-authoring.md b/skills/hypit/references/production/track-authoring.md
index b930817d..170af478 100644
--- a/skills/hypit/references/production/track-authoring.md
+++ b/skills/hypit/references/production/track-authoring.md
@@ -82,7 +82,7 @@ not decide when the spoken answer occurred; it consumes the already projected ev
The installed Speech Track expresses one particular and useful assembly: every Segment-local
SemanticTake keeps its complete span, and Source order forms one continuous prefix-sum
-`SemanticTrack`. Its audio and picture projections follow that same assembly.
+`SemanticTrack`. Its original audio follows that assembly. Visual components consume its prepared materials.
A work may intentionally need interruptions, overlapping dialogue, a time-consuming transition or
another performance-time relationship. That is a legitimate project Track when it makes the edited
diff --git a/skills/hypit/references/production/tracks.md b/skills/hypit/references/production/tracks.md
index 55096bdc..61b44f6f 100644
--- a/skills/hypit/references/production/tracks.md
+++ b/skills/hypit/references/production/tracks.md
@@ -7,13 +7,13 @@ implementation, read [Track authoring](track-authoring.md); for a new Caption fa
[Media preparation](media.md) explains incoming files, normalized media and SemanticTakes;
[spatial layout](spatial.md) explains placement, and [rendering](rendering.md) explains the deliverable.
-## Choose by the layer's job
+## Choose by the contribution's job
| Role | Owns | Common published values |
| --- | --- | --- |
| SemanticTrack | The ordered media timeline and aligned semantic locations; it draws nothing | Usually `speech.semantic` |
-| Speech Track | An ordered performance's picture and sound | `.semantic`, `.visual`, `.audio` |
-| Media Track | Framed images, prepared moving media, or authored surfaces; B-roll is one use | `.program`, `.visual`, optional `.audio` |
+| Speech Track | Ordered semantic performances and their original sound | `.semantic`, `.audio` |
+| Media Track | Framed images, semantic performances, prepared moving media, or authored surfaces; B-roll is one use | `.program`, `.visual`, optional `.audio` |
| Audio Track | Independently timed music, ambience and effects | `.program`, `.track` |
| Caption | Script-derived display text presented with speech | Fine publishes `.schedule`, `.track` |
| Typography / Text | Titles, labels and other independently authored text | `.program`, `.track` |
@@ -91,40 +91,45 @@ independent-narration-led. Music, sound effects and covering footage then follow
assembled work. [Voice and performance](../playbooks/craft/voice-and-performance.md) owns the choice
between visible A-roll, covered visible A-roll and audio-only A-roll.
-A-roll can sit above those pictures: a circular presenter inset over a screen recording, or a moving
-cutout in the corner over a product demonstration, still carries the main Script. The SemanticTake
-owns the performance and timing. Speech Track publishes its semantic, visual and audio contributions
-together; its visual Frame, fit, clipping, appearance, lifecycle motion and stack order present an
-inset or cutout directly. Include the wanted peer outputs in Film. This is one assembly of the same
-Take, not a Speech Track followed by a Media Track that displays it again. [Compositing](../playbooks/craft/compositing.md)
-explains insets and background removal.
-
-Declare a Clock for normalization, normalize generated or supplied media with explicit stream
-choices, and associate each Segment with its SemanticTake, locating spoken words when present. Speech Track assembles
-those Takes in source order; global frame positions follow their actual normalized lengths.
+A-roll can be a circular presenter inset or a moving cutout over a demonstration. Its role is
+semantic: it carries the Script. Speech Track assembles its time and original sound; the visual
+component decides how to present its prepared material.
```svml
-<speech:Track id="speech" visual-frame={layout.full}
- visual-appearance={look.performance} visual-z="0">
+<speech:Track id="speech">
<speech:Take source={opening-take}/>
<speech:Take source={answer-take}/>
</speech:Track>
+<media-track:Track id="performance" semantic={speech.semantic} canvas={canvas}>
+ <media-track:Performance during="program" frame={layout.full}
+ appearance={look.performance}/>
+</media-track:Track>
```
-This is an assembly excerpt: the imports, layout, fit Recipe and SemanticTakes must already exist.
-One Take may contain several speakers or generated cuts. Estimates help request a duration; they do
-not supply word timestamps. Covering or reframing its picture leaves the same performance and audio.
-Speech Track shares the ordinary visual appearance of a Media Item: fit and crop,
-opacity and filters, clipping, padding, border, shadow, frame paint, lifecycle motion and stack
-order. Sampling children can pan, zoom or rotate the Take's picture inside that Frame over normalized
-Segment progress. Media Track remains the owner of an independent Window, source playback and trim,
-source audio, replacement Sequences and pictures that are not the speaking performance.
-
-The Track's `visual-frame`, `visual-appearance`, `visual-motion` and `visual-z` are defaults for its
-Takes. A Take's `frame`, `appearance`, `motion` or `z` replaces that corresponding choice; an
-appearance override selects a complete Recipe. In Speech Track, use `visual-z` / `z` for stacking.
-The visual branch uses the Take's existing span, so a new Frame or crop changes its presentation
-while preserving semantic time and speech.
+The imports, Canvas, Frame, Recipe and prepared SemanticTakes exist in this excerpt. The Media
+Recipe specifies `stack-order`, fitting and frame presentation. Select `performance.visual` and
+`speech.audio` in Film. The material is generated once and remains the same performance.
+
+The Track's `semantic` supplies the performance and the time context for all its children.
+`Performance` displays that performance's picture; `Item` places an independently supplied image,
+media source or layered composition. Both use `during` to choose their display interval.
+
+`Performance during="program"` shows all the Takes in order under one frame and lifecycle.
+Use `during={story.segment.explanation}` or a Selection to show only the corresponding passage.
+If a Take begins at program second 5, a Window from seconds 7 to 10 shows source seconds 2 to 5;
+the source offset preserves synchronization with `speech.audio`. Media fitting, clipping, decoration,
+`motion` and `Sampling` control presentation. Use an Item with direct `media` for independent
+playback or source trim.
+
+A moving performance viewport and its neighboring diagram may belong in one component because they
+share a layout change. That component consumes prepared material and projected Moments or Windows,
+then draws their shared state. Independent Caption and coverage remain separate when useful.
+Its Surface can expose a Scene, Item or another useful authoring unit. Inside the component,
+`projectSemanticMedia` supplies the intersecting prepared Takes, their program spans and their source
+offsets, so changing the layout preserves playback alignment.
+[Component design](component-design.md) explains where to draw these boundaries;
+[drawing a component](component-visuals.md#compose-video-and-graphics-in-one-browser-program) explains
+HTML, CSS and frame-driven code inside one visual contribution.
Semantic structure also supports a wordless passage. It has no speaking A-roll, yet a named empty
Script Segment receives its actual boundaries from prepared media and remains addressable through
@@ -133,9 +138,8 @@ its boundaries; it does not classify the passage or require spoken words.
[Media preparation](media.md#empty-segments-use-their-media-boundaries) owns that construction.
Every Take contributes its Segment boundaries to the assembled semantic time. When its prepared
-media has no audio stream, Speech Track emits no audio clip for that Take; when it has no visual
-stream, it emits no picture. The available projections continue without manufacturing a missing
-stream.
+media has no audio stream, Speech Track emits no audio clip for that Take. A visual consumer skips
+an audio-only Take while preserving its place in semantic time.
## Coverage has a Window and a separate playback choice
diff --git a/skills/hypit/references/production/vocabulary.md b/skills/hypit/references/production/vocabulary.md
index 1a9587e9..272076e6 100644
--- a/skills/hypit/references/production/vocabulary.md
+++ b/skills/hypit/references/production/vocabulary.md
@@ -36,8 +36,8 @@ The package README supplies exact behavior that is local to that installed imple
When the question requires more detail, inspect the relevant implementation and exported API. An
existing component can also provide a useful implementation example for a new project package.
-Run Fragment libraries have a separate interface. A package such as `@hypit/stand-in` can provide
-useful Candidates while declaring no Markup Surfaces. Read [Runs](runs.md) and the library's
+Run Fragment libraries have a separate interface. A package can provide
+Candidates while declaring no Markup Surfaces. Read [Runs](runs.md) and the library's
package-local Fragment documentation for those inputs and exports.
## Choose a component for its behavior