# Place and time nested sequences

[Canonical page](https://nothing.graphics/docs/format/guides/sequences-and-audio) · [Page source on GitHub](https://github.com/gridaco/nothing/blob/main/ncf/docs/guides/sequences-and-audio.md)

Move or slip a clip and calculate its picture and sound sample across nested clocks.



A `sequence` places one source on a parent timeline. Use `href` for audio, video, or a separate scene. Omit `href` and author drawable children for a local compound clip. A placement has `begin`, positive `dur`, and `source-start`. Place it in the parent with `begin`, trim its visible interval with `dur`, and slip its content with `source-start`. Resolve relative paths from the file containing that placement. [Sequence syntax and clocks](https://nothing.graphics/docs/format/spec/sequences#sequence)

## Compute the source address [#compute-the-source-address]

At parent time `t`, check that `begin ≤ t < begin + dur`. If active, compute:

```text
source-time = source-start + (t - begin)
```

Apply the same calculation again at the next nesting level. A property on the placement itself, such as its transform or gain, samples the parent clock. Its filter and mask also sample that clock. The picture and audio inside the clip sample the mapped source clock. Convert `f` addresses using the authored rate of the scene that declares them. A referenced scene uses its own rate, and an inline sequence inherits the containing scene’s rate. Use seconds for `source-start`.

In the [moving-card scene](https://github.com/gridaco/nothing/blob/main/ncf/examples/composition-card.nothing), two placements start together at frame 0 and show the same [child scene](https://github.com/gridaco/nothing/blob/main/ncf/examples/card-picture.nothing). At frame 24 in the 24 fps parent, the left placement reads child time 1s and the right reads child time 2s. Changing only the right `source-start` from `1s` to `1.25s` advances its stripe six child units. The right placement’s own translation and its window remain at the values sampled for parent frame 24. Both placements become inactive at frame 72. [Moving-card observations](https://github.com/gridaco/nothing/blob/main/ncf/conformance/composition-card.md)

## Predict a nested mix [#predict-a-nested-mix]

Consider a compound clip beginning at shot time 4s with `dur="6s"` and `source-start="0s"`. Inside it, a voice starts at child time 2s with `dur="3s"` and `source-start="10s"`.

| Shot sample | Compound clip source time | Voice source sample        |
| ----------- | ------------------------- | -------------------------- |
| 6s          | 2s                        | 10s, the inclusive start   |
| 7s          | 3s                        | 11s                        |
| 9s          | 5s                        | Silence, the exclusive end |

On aligned sample grids with matching channel layouts, sum active source samples per channel after applying each placement’s gain. Two coincident samples of 0.75 at gain 1 yield 1.5 inside a compound clip. The clip’s own gain of 0.5 then contributes 0.75 to its parent. Picture transforms, masks and opacity leave audio unchanged. [Audio sampling and mixing](https://nothing.graphics/docs/format/spec/sequences#audio-sampling-and-mixing)

A picture request with a placement needs an explicit time, including at the opening. The SVG preview can sample inline and linked `.nothing` pictures. Use a media-capable host such as N4 for footage and audio. [Preview coverage](https://github.com/gridaco/nothing/blob/main/ncf/tools/ncf-preview/README.md#preview-coverage) · [N4 CLI](https://github.com/gridaco/nothing/blob/main/n4/cli/README.md)

## Examples

[Download the complete .nothing source](https://nothing.graphics/format/moving-card/source.nothing) · [Source on GitHub](https://github.com/gridaco/nothing/blob/main/ncf/examples/composition-card.nothing)

Rendered with ncf-preview at 320 × 200.

Bound resources

- [fixtures/fonts/PT_Serif/PTSerif-Bold.ttf](https://github.com/gridaco/fixtures/blob/main/fonts/PT_Serif/PTSerif-Bold.ttf) for `PT Serif@700`
- [fixtures/fonts/PT_Serif/PTSerif-Regular.ttf](https://github.com/gridaco/fixtures/blob/main/fonts/PT_Serif/PTSerif-Regular.ttf) for `PT Serif@400`
- [ncf/examples/card-picture.nothing](https://nothing.graphics/format/moving-card/card-picture.nothing)

- [Frame 12 · Distinct in-points](https://nothing.graphics/format/moving-card/12.webp). Two masked windows show different times of the same picture. A progress line is halfway revealed beneath the caption Status READY.
- [Frame 24 · Full progress stripe](https://nothing.graphics/format/moving-card/24.webp). The left and right panels show source frames 24 and 48. The word WAIT appears in green and the progress stripe reaches the bend’s upper tip.

```xml
      <sequence href="./card-picture.nothing" begin="0f" dur="72f" source-start="1s" translate-x="16" translate-y="16">
        <animate attributeName="translate-x" fill="freeze">
          <key frame="0" value="16" ease="linear"/>
          <key frame="24" value="4"/>
        </animate>
      </sequence>
```
