# Aroma Signal Media File (`.asmf`), version 1.1

An Aroma Signal Media File (ASMF) describes a scent signal for one piece of media, a video or an audio recording:
which aroma is released, when, and how strongly, together with the booster (fan) spans that carry the scent to the
viewer. It is a single JSON document.
Like a MIDI file, which records "which instrument, when, how loud" and leaves the sound to the instrument that plays it,
an ASMF document records "which aroma, when, how strongly" and leaves the scent to the viewer's device.

Every JSON example in this document is checked by the reference implementation (see section 12). The line above each
example says whether it is a valid document, an invalid one (and the error it gives first), or a fragment; a comment
that is not shown when the document is rendered repeats the verdict for the checker.

## 1. Scope

This document is part 1 of the ASMF specification. It defines:

- the document format (sections 3 to 9 and 13 to 16),
- what a player does with a document (section 10),
- a canonical form for comparing and hashing documents (section 11),
- how to check an implementation (section 12).

It does not define how an ASMF document is carried inside a media container (for example as a track in an MP4 file),
streaming, or a binary representation; those belong to a later part. It does not define a spatial channel layout (the
names for it are reserved, section 14), a procedure for issuing or publishing aroma identifiers, or a rule for choosing a
substitute aroma (section 10).

An ASMF document can be used as a sidecar file next to its media: `video.mp4` and `video.asmf`, or `song.mp3` and
`song.asmf`.

The later part for MP4 files is part 2, [`asmf-mp4.md`](asmf-mp4.md): it carries one document inside an MP4 file as a
timed-metadata track, so that a single video or audio file carries its scent.

## 2. Terminology

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY" and
"OPTIONAL" in this document are to be interpreted as described in BCP 14 (RFC 2119 and RFC 8174) when, and only when,
they appear in all capitals, as shown here.

- **Document**: one ASMF JSON text.
- **Reader**: software that parses and validates documents. Its **version** is the ASMF version it implements; a reader
  of this specification has version 1.1.
- **Writer**: software that produces documents, for example an authoring tool or a converter.
- **Player**: a reader that drives a scent device from a document while the media plays.
- **Viewer**: the person the scent reaches, whether they watch a video or listen to audio.
- **Span**: an object with `startMs` and `endMs` that is active from `startMs` (inclusive) to `endMs` (exclusive).
  An **aroma span** is an item of `flows`; a **booster span** is an item of `boosters`.
- **Lane**: the set of spans that may not overlap each other (section 4).
- **Level**: the `concentration` of an aroma span or the `intensity` of a booster span.
- **Chamber**: the unit of space in a device that holds one aroma (on an Aroma Shooter 3, one cartridge; numbered 1 to 6). In a `layout` its number
  is `chamber` (section 9).
- **Structural error** and **rule violation**: the two groups of errors of section 5. An **advisory** (section 8) is
  neither.
- **Path**: where an error is reported, written like `flows[3].endMs`: member names joined by `.`, array indexes in
  `[]`, counting from 0. The empty path means the document as a whole.

## 3. Document

A document is a single JSON text (RFC 8259) encoded in UTF-8 without a byte order mark. Its top level is an object.
A text that is not valid UTF-8 is not a document: it is `MALFORMED` with the empty path (section 5.1), and so is a
string whose escapes encode a lone surrogate (`\ud800` not followed by a low surrogate escape, or a low surrogate
escape on its own), since it does not denote Unicode text.

Valid.
<!-- asmf:valid -->
```json
{
  "asmf": "1.1",
  "meta": {"title": "Morning walk in the forest", "author": "mina", "createdAt": "2026-11-05T09:00:00Z", "tool": "Example Editor 1.0"},
  "media": {"durationMs": 252000},
  "aromas": [
    {"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40", "name": {"en": "Pine", "fr": "Pin"}},
    {"key": "a2", "id": "b81d4e2a-07c3-4f5e-9d16-4a2c6e8f0b13"}
  ],
  "flows": [
    {"aroma": "a1", "startMs": 1200, "endMs": 3400, "concentration": 80},
    {"aroma": "a2", "startMs": 2000, "endMs": 4000, "concentration": 100}
  ],
  "boosters": [
    {"booster": "inner", "startMs": 1000, "endMs": 4000, "intensity": 60, "fadeInMs": 200},
    {"booster": "outer", "startMs": 1000, "endMs": 4000, "intensity": 30, "fadeInMs": 500, "fadeOutMs": 1000}
  ],
  "layout": {
    "device": "aroma-shooter-3",
    "chamberCount": 2,
    "chambers": [{"chamber": 1, "aroma": "a1"}, {"chamber": 2, "aroma": "a2"}],
    "flows":    [{"chamber": 1, "startMs": 1200, "endMs": 3400, "concentration": 80},
                 {"chamber": 2, "startMs": 2000, "endMs": 4000, "concentration": 100}],
    "boosters": [{"chamber": 1, "booster": "inner", "startMs": 1000, "endMs": 4000, "intensity": 60, "fadeInMs": 200},
                 {"chamber": 1, "booster": "outer", "startMs": 1000, "endMs": 4000, "intensity": 30, "fadeInMs": 500, "fadeOutMs": 1000}]
  }
}
```

Pine is released at 80 from 1.2 s to 3.4 s and the second aroma at 100 from 2 s to 4 s. The inner booster rises to 60
during the 200 ms before the first aroma starts and stays there until 4 s; the outer booster fades in to 30 over 0.5 s
and fades out over the last second.

The smallest document:

Valid.
<!-- asmf:valid -->
```json
{"asmf": "1.0", "aromas": [], "flows": [], "boosters": []}
```

### 3.1 Top level

| Field | Required | Type | Meaning |
|---|---|---|---|
| `asmf` | yes | string | Format version `"<major>.<minor>"` (section 6). This specification is `"1.1"`; a document that uses nothing added in 1.1 MAY say `"1.0"` (sections 6 and 11). |
| `requires` | no | array of strings | Feature names a reader MUST understand to play the document (section 6). Versions 1.0 and 1.1 define none. |
| `meta` | no | object | Display information (section 3.2). Has no effect on playback. |
| `media` | no | object | Hints about the media the signal belongs to (section 3.3). |
| `aromas` | yes | array | The aromas the document uses (section 3.4). At most 64. |
| `flows` | yes | array | Aroma spans (section 3.5). |
| `boosters` | yes | array | Booster spans (section 3.6). |
| `layout` | no | object | The complete arrangement on the author's device (section 9). Not the basis of playback. |

`aromas`, `flows` and `boosters` MUST be present; a writer writes `[]` when there are none. `flows` and `boosters`
together have at most 10000 items.

### 3.2 `meta`

| Field | Type | Meaning |
|---|---|---|
| `title` | string | Title. |
| `author` | string | Author. |
| `createdAt` | string | Creation time, RFC 3339 date-time. |
| `tool` | string | The writer that produced the document. |
| `language` | string | Language of the texts, BCP 47 language tag. |
| `license` | string | License of the document. |

Every member is optional. Each string is at most 200 Unicode code points.

`createdAt` MUST have the form `YYYY-MM-DDThh:mm:ss`, optionally followed by `.` and one or more digits, followed by
`Z` or `+hh:mm` or `-hh:mm`, with the letters `T` and `Z` in capitals, a valid calendar date (leap years included),
hours 00–23, minutes 00–59, seconds 00–60, and offset hours 00–23 and minutes 00–59.

A language tag, here and in `aromas[].name`, MUST match `^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$` (ASCII). Validation
checks only this shape, not whether the subtags are registered.

### 3.3 `media`

| Field | Type | Meaning |
|---|---|---|
| `durationMs` | integer | Duration of the media in milliseconds, 1–4294967295. Optional. |

When `durationMs` is present (and in range), every span of the document, including the spans of `layout`, MUST end at
or before it: `endMs <= durationMs`. The duration of embedded media is not always known; a writer then leaves it out.

### 3.4 `aromas[]`

| Field | Required | Type | Meaning |
|---|---|---|---|
| `key` | yes | string | A short name used only inside this document; spans refer to aromas by it. MUST match `^[a-z0-9_]{1,16}$` (ASCII) and be unique in the document. |
| `id` | yes | string | The identity of the aroma: a UUID (section 13) written as 32 hexadecimal digits in groups `8-4-4-4-12` separated by `-` (36 ASCII characters). Compared without regard to letter case; the canonical form is lower case. The all-zero UUID is not allowed. Unique in the document (ignoring case). |
| `name` | no | object | Human-readable names: language tag → string of at most 200 code points. For display by a player that does not know the `id`. |

The member names of `name` are data (language tags), not fields: the field rules of section 6 do not apply to them.

An aroma that no span uses is allowed.

### 3.5 `flows[]` (aroma spans)

| Field | Required | Type | Meaning |
|---|---|---|---|
| `aroma` | yes | string | The `key` of an item of `aromas`. |
| `startMs` | yes | integer | Start on the media timeline, milliseconds. |
| `endMs` | yes | integer | End (exclusive), milliseconds. |
| `concentration` | yes | integer 1–100 | Release strength. |

Aroma spans have no intensity effects. The names `fadeInMs`, `fadeOutMs`, `fadeInCurve` and `fadeOutCurve` are reserved inside `flows[]` items
(section 14).

### 3.6 `boosters[]` (booster spans)

| Field | Required | Type | Meaning |
|---|---|---|---|
| `booster` | yes | string | Which booster: `"inner"` or `"outer"` (section 7). |
| `startMs` | yes | integer | Start on the media timeline, milliseconds. |
| `endMs` | yes | integer | End (exclusive), milliseconds. |
| `intensity` | yes | integer 1–100 | Booster strength; the strongest level of the span. |
| `fadeInMs` | no | integer ≥ 0 | Length of the fade-in. Absent means 0. |
| `fadeOutMs` | no | integer ≥ 0 | Length of the fade-out. Absent means 0. |
| `fadeInCurve` | no | `"linear"` \| `"ease-in"` \| `"ease-out"` \| `"ease-in-out"` | Shape of the fade-in (section 7.3). Absent means `"linear"`. Added in 1.1. |
| `fadeOutCurve` | no | same as `fadeInCurve` | Shape of the fade-out. Absent means `"linear"`. Added in 1.1. |

Booster spans are independent of aromas. The inner and the outer booster are two independent lanes.

### 3.7 Numbers and times

Every number in a member defined by this specification that the reader reads MUST be a JSON integer: a number token
without a fraction part and without an exponent part. `80.0` and `8e1` are not integers, even where their value is
whole, and `"80"` is a string, not a number. The token `-0` is not an integer in this format either: where it is
read, it is `MALFORMED` at the member's path. An integer outside the signed 64-bit range is `MALFORMED` at the
member's path too (values inside that range reach validation, which reports `OUT_OF_RANGE`).

Numbers inside members the reader ignores are not examined: `x-` members, unknown members of a document whose minor
version is higher than the reader's (section 6), and everything in a `layout` whose `device` the reader does not know
(section 9.1). There is one exception, which applies to every number token wherever it appears, read or ignored: a
number whose value is too large in magnitude to be represented as a finite IEEE 754 double-precision number (above
about 1.8 × 10^308, for example `1e999` or an integer of several hundred digits) makes the whole document `MALFORMED`
with the empty path.

All times are integer milliseconds on the timeline of the media. Every span satisfies
`0 <= startMs < endMs <= 4294967295`.

A fraction inside an `x-` member is not examined:

Valid.
<!-- asmf:valid -->
```json
{"asmf": "1.0", "x-editor": {"zoom": 1.5, "scale": 2e-3}, "aromas": [], "flows": [], "boosters": []}
```

`-0` where it is read:

Invalid: `MALFORMED` at `flows[0].startMs`.
<!-- asmf:invalid MALFORMED flows[0].startMs -->
```json
{"asmf": "1.0", "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}],
 "flows": [{"aroma": "a1", "startMs": -0, "endMs": 1000, "concentration": 50}],
 "boosters": []}
```

A number too large for a double, even inside an `x-` member:

Invalid: `MALFORMED` (empty path).
<!-- asmf:invalid MALFORMED -->
```json
{"asmf": "1.0", "x-editor": {"zoom": 1e999}, "aromas": [], "flows": [], "boosters": []}
```

## 4. Rules

A document that breaks one of these rules has a rule violation (section 5.2). The rules for `layout` are in section 9.

1. **Times.** `0 <= startMs < endMs <= 4294967295` for every span; `endMs <= durationMs` when `media.durationMs` is
   present.
2. **Levels.** `concentration` and `intensity` are 1–100. `media.durationMs` is 1–4294967295.
3. **Aroma lanes.** The aroma spans that name the same `aroma` form one lane. Within a lane, spans MUST NOT overlap.
   Two spans that touch (one ends at the millisecond the other starts) MUST have different `concentration`; two touching
   spans of equal `concentration` MUST be written as one span. Spans of different aromas may overlap.
4. **Booster lanes.** The booster spans with the same `booster` form one lane (the inner lane and the outer lane).
   Within a lane, spans MUST NOT overlap; the inner and the outer lane may overlap each other. Two touching spans of one
   lane MUST be written as one span when they can be: it is a violation when they have equal `intensity` and there is
   no fade at the joint (the earlier span's `fadeOutMs` and the later span's `fadeInMs` are both 0).
5. **Fades.** `fadeInMs` and `fadeOutMs` are at least 0, and `fadeInMs + fadeOutMs <= endMs - startMs`.
6. **Booster names.** `booster` is `"inner"` or `"outer"`. Names a reader does not know are treated as in section 6.
7. **Counts.** At most 64 items in `aromas`; at most 10000 items in `flows` and `boosters` together.
8. **References.** `flows[].aroma` MUST be the `key` of an item of `aromas`.
9. **Identity.** `aromas[].key` is unique; `aromas[].id` is unique ignoring ASCII letter case. Keys, identifiers,
   language tags and the `meta` strings have the forms and lengths of section 3.
10. **Order.** `flows` is sorted ascending by (`startMs`, order in `aromas` of the aroma it names). `boosters` is
    sorted ascending by (`startMs`, booster order), where `inner` comes before `outer`. Items with equal sort keys may
    appear in either order.

### 4.1 How overlaps and order are judged

Validators MUST apply these procedures so that they agree on where a violation is reported.

**Overlap and merge, per lane:**

1. Leave out spans with `endMs <= startMs` (they already have an `OUT_OF_RANGE` violation). Count a negative fade as 0.
2. Order the remaining spans by `startMs`; spans that start at the same millisecond are ordered by their index in the
   array.
3. Visit the spans in that order, keeping a *reference span*: the visited span with the greatest `endMs` (the first one
   visited, if several share it). For each span after the first:
   1. If it starts before the reference span's `endMs`, report `OVERLAP` on its `startMs`.
   2. Otherwise, in the top-level `flows` and `boosters` only, if it starts exactly at the reference span's `endMs`,
      has the same level, the reference span's `fadeOutMs` is 0 and its own `fadeInMs` is 0, report `NOT_MERGED` on its
      `startMs`.
   3. If it ends later than the reference span, it becomes the reference span.

So `OVERLAP` and `NOT_MERGED` are reported on the `startMs` of the later span, and when two spans of one lane start at
the same millisecond, the later one is the one later in the array. A span is reported at most once with `OVERLAP`.

**Order:** `NOT_SORTED` is reported once per array, on the first item whose sort key is smaller than the sort key of the
item just before it, at the path of the item itself (for example `flows[3]`). In `flows`, an `aroma` that is not a key
of `aromas` sorts after every key; when two items of `aromas` share a key, the first one gives the order. Booster
spans whose `booster` name the reader does not know take no part in the order check: the remaining spans are compared
with each other.

Invalid: `OVERLAP` at `flows[1].startMs`.
<!-- asmf:invalid OVERLAP flows[1].startMs -->
```json
{"asmf": "1.0", "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}],
 "flows": [{"aroma": "a1", "startMs": 0, "endMs": 1000, "concentration": 50},
           {"aroma": "a1", "startMs": 500, "endMs": 1500, "concentration": 60}],
 "boosters": []}
```

Invalid: `NOT_MERGED` at `flows[1].startMs`.
<!-- asmf:invalid NOT_MERGED flows[1].startMs -->
```json
{"asmf": "1.0", "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}],
 "flows": [{"aroma": "a1", "startMs": 0, "endMs": 1000, "concentration": 50},
           {"aroma": "a1", "startMs": 1000, "endMs": 2000, "concentration": 50}],
 "boosters": []}
```

Touching spans of different concentration, and overlapping spans of different aromas, are valid:

Valid.
<!-- asmf:valid -->
```json
{"asmf": "1.0",
 "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}, {"key": "a2", "id": "b81d4e2a-07c3-4f5e-9d16-4a2c6e8f0b13"}],
 "flows": [{"aroma": "a1", "startMs": 0, "endMs": 1000, "concentration": 50},
           {"aroma": "a2", "startMs": 500, "endMs": 1500, "concentration": 50},
           {"aroma": "a1", "startMs": 1000, "endMs": 2000, "concentration": 51}],
 "boosters": []}
```

Two touching inner spans of equal intensity are one span written twice; a fade at the joint makes them two:

Invalid: `NOT_MERGED` at `boosters[1].startMs`.
<!-- asmf:invalid NOT_MERGED boosters[1].startMs -->
```json
{"asmf": "1.0", "aromas": [], "flows": [],
 "boosters": [{"booster": "inner", "startMs": 0, "endMs": 1000, "intensity": 60},
              {"booster": "inner", "startMs": 1000, "endMs": 2000, "intensity": 60}]}
```

Valid.
<!-- asmf:valid -->
```json
{"asmf": "1.0", "aromas": [], "flows": [],
 "boosters": [{"booster": "inner", "startMs": 0, "endMs": 1000, "intensity": 60, "fadeOutMs": 300},
              {"booster": "inner", "startMs": 1000, "endMs": 2000, "intensity": 60, "fadeInMs": 300}]}
```

The inner and the outer booster are separate lanes and may overlap:

Valid.
<!-- asmf:valid -->
```json
{"asmf": "1.0", "aromas": [], "flows": [],
 "boosters": [{"booster": "inner", "startMs": 0, "endMs": 2000, "intensity": 60},
              {"booster": "outer", "startMs": 500, "endMs": 1500, "intensity": 40}]}
```

Invalid: `OVERLAP` at `boosters[1].startMs`.
<!-- asmf:invalid OVERLAP boosters[1].startMs -->
```json
{"asmf": "1.0", "aromas": [], "flows": [],
 "boosters": [{"booster": "outer", "startMs": 0, "endMs": 2000, "intensity": 60},
              {"booster": "outer", "startMs": 500, "endMs": 1500, "intensity": 40}]}
```

Order: `flows` with equal `startMs` follow the order of `aromas`, and `inner` comes before `outer`:

Valid.
<!-- asmf:valid -->
```json
{"asmf": "1.0",
 "aromas": [{"key": "b", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}, {"key": "a", "id": "b81d4e2a-07c3-4f5e-9d16-4a2c6e8f0b13"}],
 "flows": [{"aroma": "b", "startMs": 0, "endMs": 1000, "concentration": 50},
           {"aroma": "a", "startMs": 0, "endMs": 1000, "concentration": 50}],
 "boosters": [{"booster": "inner", "startMs": 0, "endMs": 1000, "intensity": 60},
              {"booster": "outer", "startMs": 0, "endMs": 1000, "intensity": 40}]}
```

Invalid: `NOT_SORTED` at `flows[1]`.
<!-- asmf:invalid NOT_SORTED flows[1] -->
```json
{"asmf": "1.0",
 "aromas": [{"key": "b", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}, {"key": "a", "id": "b81d4e2a-07c3-4f5e-9d16-4a2c6e8f0b13"}],
 "flows": [{"aroma": "a", "startMs": 0, "endMs": 1000, "concentration": 50},
           {"aroma": "b", "startMs": 0, "endMs": 1000, "concentration": 50}],
 "boosters": []}
```

Invalid: `NOT_SORTED` at `boosters[1]`.
<!-- asmf:invalid NOT_SORTED boosters[1] -->
```json
{"asmf": "1.0", "aromas": [], "flows": [],
 "boosters": [{"booster": "outer", "startMs": 0, "endMs": 1000, "intensity": 40},
              {"booster": "inner", "startMs": 0, "endMs": 1000, "intensity": 60}]}
```

## 5. Errors

Errors come in two groups. A document is **valid** when it has neither.

### 5.1 Structural errors

A structural error means the text is not an ASMF document this reader can read. The reader reports exactly one
structural error, `{"code": …, "path": …}`, and stops; it does not check the rules.

| Code | Meaning |
|---|---|
| `MALFORMED` | The text is not valid UTF-8 or is not JSON (this includes a string escape for a lone surrogate, section 3); the top level is not an object; the text starts with a byte order mark; the text is larger than 4 MiB (4194304 bytes); nesting deeper than 32 levels (the top-level object is level 1); a member name appears twice in one object; a number token anywhere in the text is too large for a finite double (section 3.7); a required field is missing; a value has the wrong JSON type; a number in a member the reader reads (section 3.7) is not an integer (including `-0`), or is an integer outside the signed 64-bit range. Other numbers inside ignored members are not examined. |
| `UNSUPPORTED_VERSION` | `asmf` is not of the form `"<integer>.<integer>"` (one or more ASCII digits on both sides of one `.`, each number at most 4294967295), or its major version is not one the reader implements. |
| `UNSUPPORTED_FEATURE` | `requires` names a feature the reader does not know. |
| `UNKNOWN_FIELD` | A member the reader does not know, under the conditions of section 6. The reserved names of section 14 are reported this way. |

Errors about the document as a whole (not valid UTF-8, not JSON, a lone surrogate escape, top level not an object,
byte order mark, too large, too deep, a duplicate member name in any object, a number too large for a finite double
anywhere in the text) carry the empty path. Other structural errors carry the path of the offending
member: the missing field (`boosters`, `flows[0].endMs`), the value of the wrong type (`meta.title`,
`aromas[0].name.en`), the version (`asmf`), the unknown feature (`requires[0]`) or the unknown member
(`flows[0].colour`).

A reader checks in this order and reports the first error it finds:

1. The size limit and the byte order mark.
2. The UTF-8 encoding, the JSON syntax (including lone surrogate escapes and numbers too large for a finite double),
   duplicate member names and the nesting depth, over the whole text.
3. The top level is an object.
4. `asmf`: present and a string (`MALFORMED` at `asmf`), then its form and major version (`UNSUPPORTED_VERSION` at `asmf`).
   Nothing else is read in a document of another major version.
5. `requires`, when present: an array (`MALFORMED` at `requires`); its entries are examined in order, an entry that is
   not a string is `MALFORMED` and the first entry that names an unknown feature is `UNSUPPORTED_FEATURE`, both at
   `requires[i]`.
6. Unknown members of the top-level object.
7. `meta`, `media`, `aromas`, `flows`, `boosters`, `layout`, in that order; arrays item by item in index order, the
   arrays inside `layout` included: each item is checked completely (that it is an object, then its members) before
   the next item is looked at. Inside each object, unknown members are checked first, then the fields are read in the
   order of their table, with two exceptions: in `layout`, `device` is read before the unknown members are checked
   (section 9.1), and in an item of `aromas`, `name` is read before `key` and `id`.

Invalid: `MALFORMED` (empty path).
<!-- asmf:invalid MALFORMED -->
```json
{"asmf": "1.0", "aromas": [], "flows": [], "boosters": [], "boosters": []}
```

Invalid: `MALFORMED` at `flows[0].concentration`.
<!-- asmf:invalid MALFORMED flows[0].concentration -->
```json
{"asmf": "1.0", "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}],
 "flows": [{"aroma": "a1", "startMs": 0, "endMs": 1000, "concentration": 80.0}],
 "boosters": []}
```

Invalid: `MALFORMED` at `boosters`.
<!-- asmf:invalid MALFORMED boosters -->
```json
{"asmf": "1.0", "aromas": [], "flows": []}
```

Invalid: `UNSUPPORTED_VERSION` at `asmf`.
<!-- asmf:invalid UNSUPPORTED_VERSION asmf -->
```json
{"asmf": "2.0", "aromas": [], "flows": [], "boosters": []}
```

Invalid: `UNSUPPORTED_FEATURE` at `requires[0]`.
<!-- asmf:invalid UNSUPPORTED_FEATURE requires[0] -->
```json
{"asmf": "1.0", "requires": ["pulse"], "aromas": [], "flows": [], "boosters": []}
```

Invalid: `UNKNOWN_FIELD` at `flows[0].concentraton`.
<!-- asmf:invalid UNKNOWN_FIELD flows[0].concentraton -->
```json
{"asmf": "1.0", "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}],
 "flows": [{"aroma": "a1", "startMs": 0, "endMs": 1000, "concentraton": 80}],
 "boosters": []}
```

### 5.2 Rule violations

A rule violation means the text is an ASMF document that breaks a rule of section 4 or 9. The reader reports every
violation as a list of `{"path": …, "code": …}`:

Fragment.
<!-- asmf:skip -->
```json
[{"path": "flows[3].endMs", "code": "OUT_OF_RANGE"}, {"path": "flows[5].startMs", "code": "OVERLAP"}]
```

| Code | Meaning | Path |
|---|---|---|
| `OUT_OF_RANGE` | A number is outside its range: `durationMs` not 1–4294967295; `startMs` not 0–4294967295; `endMs` not greater than `startMs`, greater than 4294967295 or greater than `durationMs`; `concentration` or `intensity` not 1–100; a negative `fadeInMs` or `fadeOutMs`; `chamberCount` not 1–6; a `chamber` not 1–`chamberCount` (not 1–6 when `chamberCount` is itself out of range). | The number: `media.durationMs`, `flows[i].startMs`, `flows[i].endMs`, `flows[i].concentration`, `boosters[i].intensity`, `boosters[i].fadeInMs`, `layout.chamberCount`, `layout.chambers[i].chamber`, and so on. |
| `FADE_TOO_LONG` | `fadeInMs + fadeOutMs` is greater than `endMs - startMs`. Judged only when `endMs > startMs`; a negative fade counts as 0. | The span: `boosters[i]`, `layout.boosters[i]`. |
| `OVERLAP` | Two spans of one lane overlap (section 4.1); in `layout`, also a fading booster span that overlaps a span of the same booster in any chamber (section 9.2). | `<array>[i].startMs` of the later span. |
| `NOT_MERGED` | Two touching spans of one lane can be written as one (section 4.1). Never reported inside `layout`. | `flows[i].startMs`, `boosters[i].startMs` of the later span. |
| `NOT_SORTED` | An array is not in its order (sections 4 and 9). | `<array>[i]` of the first item out of order. |
| `UNKNOWN_KEY` | A reference to a key that is not in `aromas`. | `flows[i].aroma`, `layout.chambers[i].aroma`. |
| `DUPLICATE_KEY` | A `key` already used by an earlier item of `aromas`. | `aromas[i].key` of the later item. |
| `DUPLICATE_AROMA` | An `id` already used (ignoring case) by an earlier item of `aromas`. Only judged for a well-formed `id`. | `aromas[i].id` of the later item. |
| `DUPLICATE_CHAMBER` | A `chamber` already used by an earlier item of `layout.chambers`. | `layout.chambers[i].chamber` of the later item. |
| `UNMAPPED_CHAMBER` | A `layout.flows` item uses a chamber (within range) that has no item in `layout.chambers`. | `layout.flows[i].chamber`. |
| `INVALID_VALUE` | A string does not have its form: a `meta` string longer than 200 code points, `createdAt` or `language` not in its form; `key`; `id` not a UUID or all zero; a `name` language tag not in its form or a name longer than 200 code points; a `booster` name or a fade curve (`fadeInCurve`, `fadeOutCurve`) the reader does not know (section 6). | `meta.<field>`, `aromas[i].key`, `aromas[i].id`, `aromas[i].name.<tag>` (the tag as written), `boosters[i].booster`, `boosters[i].fadeInCurve`, `layout.boosters[i].booster`, `layout.boosters[i].fadeOutCurve`, and so on. |
| `TOO_MANY` | More than 64 items in `aromas`; more than 10000 items in `flows` and `boosters` together; more than 5000 items in `layout.flows` and `layout.boosters` together. When any of these is reported, nothing else is checked. | `aromas`, `flows`, `layout.flows` respectively. |
| `LAYOUT_MISMATCH` | The projection of `layout` (section 9.3) differs from the top-level `flows` and `boosters`. | `layout`, once. |

### 5.3 Reporting order

Validators MUST report violations in this order:

1. If any `TOO_MANY` applies, the list is exactly those `TOO_MANY` violations, in the order `aromas`, `flows`,
   `layout.flows`.
2. Otherwise the sections in the order `meta`, `media`, `aromas`, `flows`, `boosters`, `layout`; each array in index
   order, all violations of one item before those of the next.
3. Within one place, in this order:
   - `meta`: `title`, `author`, `tool`, `license`, `createdAt`, `language`.
   - `aromas[i]`: `key` `INVALID_VALUE`, `key` `DUPLICATE_KEY`, then `id` (`INVALID_VALUE`, or else `DUPLICATE_AROMA`),
     then each `name` entry in the order written.
   - `flows[i]`: `aroma` `UNKNOWN_KEY`, `startMs`, `endMs`, `concentration`, then `OVERLAP` or `NOT_MERGED`, then
     `NOT_SORTED`.
   - `boosters[i]`: `booster` `INVALID_VALUE`, `startMs`, `endMs`, `intensity`, `fadeInMs`, `fadeOutMs`,
     `FADE_TOO_LONG`, `fadeInCurve`, `fadeOutCurve`, then `OVERLAP` or `NOT_MERGED`, then `NOT_SORTED`.
   - `layout`: `chamberCount`; then `chambers[i]`: `chamber` `OUT_OF_RANGE`, `chamber` `DUPLICATE_CHAMBER`, `aroma`
     `UNKNOWN_KEY`, `NOT_SORTED`; then `flows[i]`: `chamber` (`OUT_OF_RANGE`, or else `UNMAPPED_CHAMBER`), `startMs`,
     `endMs`, `concentration`, `OVERLAP`, `NOT_SORTED`; then `boosters[i]`: `chamber`, `booster`, `startMs`, `endMs`,
     `intensity`, `fadeInMs`, `fadeOutMs`, `FADE_TOO_LONG`, `fadeInCurve`, `fadeOutCurve`, `OVERLAP`, `NOT_SORTED`;
     then `LAYOUT_MISMATCH`.

Examples of range and reference violations:

Invalid: `OUT_OF_RANGE` at `flows[0].endMs`.
<!-- asmf:invalid OUT_OF_RANGE flows[0].endMs -->
```json
{"asmf": "1.0", "media": {"durationMs": 1000},
 "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}],
 "flows": [{"aroma": "a1", "startMs": 0, "endMs": 1001, "concentration": 50}],
 "boosters": []}
```

Invalid: `OUT_OF_RANGE` at `flows[0].startMs`.
<!-- asmf:invalid OUT_OF_RANGE flows[0].startMs -->
```json
{"asmf": "1.0", "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}],
 "flows": [{"aroma": "a1", "startMs": 4294967296, "endMs": 4294967297, "concentration": 50}],
 "boosters": []}
```

Invalid: `OUT_OF_RANGE` at `boosters[0].intensity`.
<!-- asmf:invalid OUT_OF_RANGE boosters[0].intensity -->
```json
{"asmf": "1.0", "aromas": [], "flows": [],
 "boosters": [{"booster": "inner", "startMs": 0, "endMs": 1000, "intensity": 0}]}
```

The largest time is allowed:

Valid.
<!-- asmf:valid -->
```json
{"asmf": "1.0", "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}],
 "flows": [{"aroma": "a1", "startMs": 4294967294, "endMs": 4294967295, "concentration": 100}],
 "boosters": []}
```

Invalid: `UNKNOWN_KEY` at `flows[0].aroma`.
<!-- asmf:invalid UNKNOWN_KEY flows[0].aroma -->
```json
{"asmf": "1.0", "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}],
 "flows": [{"aroma": "a9", "startMs": 0, "endMs": 1000, "concentration": 50}],
 "boosters": []}
```

Invalid: `DUPLICATE_KEY` at `aromas[1].key`.
<!-- asmf:invalid DUPLICATE_KEY aromas[1].key -->
```json
{"asmf": "1.0",
 "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}, {"key": "a1", "id": "b81d4e2a-07c3-4f5e-9d16-4a2c6e8f0b13"}],
 "flows": [], "boosters": []}
```

Invalid: `DUPLICATE_AROMA` at `aromas[1].id`.
<!-- asmf:invalid DUPLICATE_AROMA aromas[1].id -->
```json
{"asmf": "1.0",
 "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}, {"key": "a2", "id": "3F2B8C1E-9A47-4D0B-8E6F-1C5A7B9D2E40"}],
 "flows": [], "boosters": []}
```

Invalid: `INVALID_VALUE` at `aromas[0].id`.
<!-- asmf:invalid INVALID_VALUE aromas[0].id -->
```json
{"asmf": "1.0", "aromas": [{"key": "a1", "id": "00000000-0000-0000-0000-000000000000"}], "flows": [], "boosters": []}
```

Invalid: `INVALID_VALUE` at `aromas[0].key`.
<!-- asmf:invalid INVALID_VALUE aromas[0].key -->
```json
{"asmf": "1.0", "aromas": [{"key": "Pine", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}], "flows": [], "boosters": []}
```

Invalid: `INVALID_VALUE` at `aromas[0].name.e`.
<!-- asmf:invalid INVALID_VALUE aromas[0].name.e -->
```json
{"asmf": "1.0", "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40", "name": {"e": "Pine"}}],
 "flows": [], "boosters": []}
```

Invalid: `INVALID_VALUE` at `meta.createdAt`.
<!-- asmf:invalid INVALID_VALUE meta.createdAt -->
```json
{"asmf": "1.0", "meta": {"createdAt": "2026-02-30T09:00:00Z"}, "aromas": [], "flows": [], "boosters": []}
```

An identifier in capitals is the same identifier, and an aroma no span uses is allowed:

Valid.
<!-- asmf:valid -->
```json
{"asmf": "1.0", "meta": {"language": "en-GB", "createdAt": "2026-11-05T18:00:00.250+09:00"},
 "aromas": [{"key": "pine_1", "id": "3F2B8C1E-9A47-4D0B-8E6F-1C5A7B9D2E40", "name": {"en": "Pine", "zh-Hant": "松"}}],
 "flows": [], "boosters": []}
```

## 6. Versioning and extension

The meaning of the top-level `flows` and `boosters` is fixed for all versions: they are always the result of playing
the document on one device. More detailed representations (the author's chamber arrangement in `layout`, and later a
spatial channel layout) are added as separate members, and combining them by a defined rule MUST give the top-level
lines. A reader that does not understand such a member skips it and plays the top-level lines, in the way mono radios
kept working when stereo was added to FM broadcasting.

1. **Major version.** A reader MUST reject a document whose major version it does not implement
   (`UNSUPPORTED_VERSION`).
2. **Minor version.** A reader reads a document whose minor version is higher than its own. A minor version MAY only add
   optional members, and only members that a reader can ignore without changing what is emitted (or that combine into the
   top-level lines by the principle above).
3. **`requires`.** An addition that would change what is emitted when ignored (for example a new intensity effect, fades
   on aroma spans, or keyframed curves) MUST be listed by its feature name in `requires`. A reader MUST reject a document
   whose `requires` contains a name it does not know (`UNSUPPORTED_FEATURE`). Versions 1.0 and 1.1 define no feature
   names, so a 1.1 reader rejects every non-empty `requires`. A fade curve (section 7.2) is not such an addition: it
   changes only the shape of a fade, not its length or its levels at either end, and a reader that ignores it plays the
   same fade as a straight line.
4. **New booster names.** A minor version MAY add `booster` names (for devices with more air outputs). A booster span
   whose name the reader does not know is:
   - in a document whose minor version is higher than the reader's: skipped by every check (range checks including
     `chamber`, fade, overlap, merge and order checks, the projection and the `LAYOUT_MISMATCH` comparison); it still
     counts toward the span limits of `TOO_MANY`;
   - otherwise: `INVALID_VALUE` at `…booster`. The span's own checks still apply: `OUT_OF_RANGE` for its `chamber`
     (in `layout`), `startMs`, `endMs`, `intensity`, `fadeInMs` and `fadeOutMs`, and `FADE_TOO_LONG`, in the order of
     section 5.3. It takes no part in the overlap, merge and order checks (it neither gets nor causes `OVERLAP`,
     `NOT_MERGED` or `NOT_SORTED`), nor in the projection or the `LAYOUT_MISMATCH` comparison.

   A player emits nothing for such a span (section 10), which is what a device without that output does anyway.
5. **Unknown members.** A member whose name begins with `x-` is ignored in every object; such members are for
   tool-specific extensions and MUST NOT affect what is emitted. Any other unknown member is ignored when the document's
   minor version is higher than the reader's, and is `UNKNOWN_FIELD` otherwise, so that a misspelt field does not pass
   silently. The member names inside `aromas[].name` are data, not fields, and are not subject to this rule.

A 1.1 reader accepts this 1.2 document: it ignores the unknown member and skips the span of the unknown booster.

Valid.
<!-- asmf:valid -->
```json
{"asmf": "1.2", "colour": "green", "aromas": [], "flows": [],
 "boosters": [{"booster": "side", "startMs": 0, "endMs": 1000, "intensity": 50, "sweep": 3},
              {"booster": "inner", "startMs": 0, "endMs": 1000, "intensity": 60}]}
```

The same in a 1.0 document is an error:

Invalid: `UNKNOWN_FIELD` at `colour`.
<!-- asmf:invalid UNKNOWN_FIELD colour -->
```json
{"asmf": "1.0", "colour": "green", "aromas": [], "flows": [], "boosters": []}
```

Invalid: `INVALID_VALUE` at `boosters[0].booster`.
<!-- asmf:invalid INVALID_VALUE boosters[0].booster -->
```json
{"asmf": "1.0", "aromas": [], "flows": [],
 "boosters": [{"booster": "side", "startMs": 0, "endMs": 1000, "intensity": 50}]}
```

`x-` members are ignored everywhere:

Valid.
<!-- asmf:valid -->
```json
{"asmf": "1.0", "x-editor": {"zoom": 2}, "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40", "x-colour": "#2a7"}],
 "flows": [], "boosters": []}
```

## 7. Boosters and intensity effects

### 7.1 Inner and outer

`booster` names the air output of the device that a booster span drives. Version 1.0 defines two:

- `inner`: the booster that carries the released aroma out of the device. **The inner booster is required to deliver an
  aroma**: while an aroma span is active and the inner booster is off or weak, the aroma does not come out properly.
  A document either drives the inner booster itself, with `inner` spans, or has none and leaves it to the player (the
  automatic inner booster, section 7.5). When the document drives it, a weak inner booster is an authoring advisory
  (section 8), not an error, because the strength needed differs between devices.
- `outer`: a second air output (on the Aroma Shooter, present on the third hardware generation).

The two lanes are independent: both may be on at the same time, with different starts, ends and intensities. An editor
that binds the outer booster to the inner one still writes two spans at the same times.

### 7.2 Intensity effects

An intensity effect changes the level of a booster span over time, inside the span. Every effect keeps three promises:

1. It does not reach outside the span, so the overlap rules hold unchanged when effects are present.
2. It does not exceed `intensity`: `intensity` is the strongest level of the span.
3. The **reference level** at every millisecond is given by an integer formula, so that implementations agree;
   the shared vectors (section 12) fix it.

Version 1.0 defines two effects: the **fade-in** (`fadeInMs`) and the **fade-out** (`fadeOutMs`). The level rises in a
straight line from 0 to `intensity` during `[startMs, startMs + fadeInMs)` and falls in a straight line from
`intensity` to 0 during `[endMs - fadeOutMs, endMs)`; between them it is `intensity`. Aroma spans have no effects in
version 1.0.

Version 1.1 adds a **curve** to each fade: `fadeInCurve` and `fadeOutCurve` choose its shape — `linear` (the default),
`ease-in`, `ease-out` or `ease-in-out`. A curve applies only where its fade is present, keeps the three promises above,
and a reader of an earlier minor ignores the member and reads the fade as a straight line.

### 7.3 Reference level

The reference level of a booster span at millisecond `t` is:

1. 0 when `t < startMs` or `t >= endMs`.
2. Otherwise, when `fadeInMs > 0` and `t - startMs < fadeInMs`: the **fade level** of length `fadeInMs` at offset
   `t - startMs` with curve `fadeInCurve`.
3. Otherwise, when `fadeOutMs > 0` and `endMs - t <= fadeOutMs`: the **fade level** of length `fadeOutMs` at offset
   `endMs - t` with curve `fadeOutCurve`.
4. Otherwise `intensity`.

The **fade level** of length `d > 0` at offset `p` in `[0, d]` with curve `c` is `floor(intensity × E)` clamped to
`[0, intensity]`, where `E` is one integer fraction:

| `c` | fade level |
|---|---|
| `linear` (the default) | `intensity × p / d` |
| `ease-in` | `intensity × p² / d²` |
| `ease-out` | `intensity × (2 × d × p − p²) / d²` |
| `ease-in-out` | `intensity × p² × (3 × d − 2 × p) / d³` |

A curve a reader does not know — possible only in a higher-minor document — is read as `linear`. A level of 0 means
off. Because `fadeInMs + fadeOutMs <= endMs - startMs`, steps 2 and 3 never both apply to a valid span; for an invalid
span the reference implementation takes the smaller of the two values. For valid values every product fits in a signed
128-bit integer, so 128-bit integer arithmetic is exact; an implementation saturates rather than overflowing, so an
out-of-range span never traps.

Example: for `{"booster": "inner", "startMs": 1000, "endMs": 4000, "intensity": 30, "fadeInMs": 500}` the reference
level is 0 at 1000, 15 at 1250, 29 at 1499 and 30 from 1500 to 3999.

Fragment.
<!-- asmf:skip -->
```json
{"booster": "inner", "startMs": 1000, "endMs": 4000, "intensity": 30, "fadeInMs": 500}
```

### 7.4 Writing fades

A fade passes through low levels. Authors SHOULD therefore place fades of the inner booster outside the aroma spans
(raise it before the aroma starts and lower it after the aroma ends) and use the outer booster for changes of strength
while an aroma is released.

New effects (for example pulsing) will be added as new optional members listed in `requires` (section 6). As long as
they keep the three promises, no other rule changes. The names `fadeInMs` and `fadeOutMs` are reserved inside
`flows[]` items with the same meaning, for a later version (section 14).

Valid.
<!-- asmf:valid -->
```json
{"asmf": "1.0", "aromas": [], "flows": [],
 "boosters": [{"booster": "outer", "startMs": 0, "endMs": 1000, "intensity": 40, "fadeInMs": 400, "fadeOutMs": 600}]}
```

Invalid: `FADE_TOO_LONG` at `boosters[0]`.
<!-- asmf:invalid FADE_TOO_LONG boosters[0] -->
```json
{"asmf": "1.0", "aromas": [], "flows": [],
 "boosters": [{"booster": "outer", "startMs": 0, "endMs": 1000, "intensity": 40, "fadeInMs": 400, "fadeOutMs": 601}]}
```

Invalid: `OUT_OF_RANGE` at `boosters[0].fadeInMs`.
<!-- asmf:invalid OUT_OF_RANGE boosters[0].fadeInMs -->
```json
{"asmf": "1.0", "aromas": [], "flows": [],
 "boosters": [{"booster": "inner", "startMs": 0, "endMs": 1000, "intensity": 60, "fadeInMs": -1}]}
```

Invalid: `UNKNOWN_FIELD` at `flows[0].fadeInMs`.
<!-- asmf:invalid UNKNOWN_FIELD flows[0].fadeInMs -->
```json
{"asmf": "1.0", "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}],
 "flows": [{"aroma": "a1", "startMs": 0, "endMs": 1000, "concentration": 50, "fadeInMs": 100}],
 "boosters": []}
```

### 7.5 Automatic inner booster

A document whose top-level `boosters` has no `inner` span leaves the inner booster to the player. This is the
**automatic inner booster**. It lets a document deliver its aromas on a device that needs an inner booster even when it
was written for a device that has none, or by an author who does not know the device.

- With the automatic inner booster, a player whose device has an inner booster drives it during the aroma spans it
  emits (substitutes included, section 10) and leaves it off at other times. The inner lane it plays is the union of
  those spans, with spans that overlap or touch joined into one, at the device's **delivery level**, without fades.
- The delivery level is a property of the device, like the recommended minimum of section 8. For the Aroma Shooter
  (`aroma-shooter-3`) it is **100**.
- A device without an inner booster has nothing to do.
- `outer` spans are played as written either way; they do not turn the automatic inner booster off.
- A document with at least one `inner` span drives the inner lane completely, including the times when it leaves the
  inner booster off. The advisory of section 8 finds its weak spots.

The shared vectors (section 12, section `automaticInner`) fix the lane for given aroma spans and a given level.

This document has no `inner` span. On an Aroma Shooter that holds both aromas, the inner booster runs at 100 from 1 s
to 4 s and from 5 s to 6 s, and the outer booster runs as written:

Valid.
<!-- asmf:valid -->
```json
{"asmf": "1.0",
 "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}, {"key": "a2", "id": "b81d4e2a-07c3-4f5e-9d16-4a2c6e8f0b13"}],
 "flows": [{"aroma": "a1", "startMs": 1000, "endMs": 3000, "concentration": 80},
           {"aroma": "a2", "startMs": 2500, "endMs": 4000, "concentration": 60},
           {"aroma": "a1", "startMs": 5000, "endMs": 6000, "concentration": 80}],
 "boosters": [{"booster": "outer", "startMs": 1000, "endMs": 4000, "intensity": 30}]}
```

## 8. Authoring advisories

An advisory is unrelated to the validity of a document. It is a warning that an authoring tool shows to the author; a
player emits a document as written whatever its advisories. Advisories are reported in a list of the same
`{"path": …, "code": …}` shape as violations, but never in the violation list.

| Code | Meaning | Path |
|---|---|---|
| `WEAK_INNER_BOOSTER` | The document has at least one `inner` span, and while an aroma span is active there is a millisecond at which the reference level of the inner lane is below the recommended minimum inner intensity. This includes the inner booster being off, a low `intensity`, and a fade. | `flows[i]`, once per aroma span. |

The reference level of the inner lane at `t` is the reference level (section 7.3) of the inner span that contains `t`,
or 0 when none does. Only spans with `endMs > startMs` are considered. A document with no `inner` span gets no
advisory: the player drives the inner booster itself (section 7.5).

The recommended minimum inner intensity is a property of the device, not a constant of the format; an advisory check
takes it as a parameter. For the Aroma Shooter 3 (`aroma-shooter-3`) it is **50**. A minimum of 0 or less gives no
advisories. The check is skipped (gives no advisories) for a document with more than 10000 spans in `flows` and
`boosters` together, which is not valid anyway. The outer booster has no minimum.

Valid; advisory `WEAK_INNER_BOOSTER` at `flows[0]`.
<!-- asmf:advisory WEAK_INNER_BOOSTER flows[0] -->
```json
{"asmf": "1.0", "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}],
 "flows": [{"aroma": "a1", "startMs": 1000, "endMs": 3000, "concentration": 50}],
 "boosters": [{"booster": "inner", "startMs": 500, "endMs": 3500, "intensity": 30}]}
```

## 9. Layout and projection

`layout` holds, complete, how the signal was arranged on the author's device. Players MAY ignore it. It lets an editor
restore the author's chamber arrangement.

### 9.1 Fields

| Field | Required | Type | Meaning |
|---|---|---|---|
| `device` | yes | string | The kind of device. Version 1.0 defines `"aroma-shooter-3"`: the Aroma Shooter 3, with six chambers, an inner booster and an outer booster. |
| `chamberCount` | yes | integer 1–6 | Number of chambers used. |
| `chambers[]` | yes | array | Which aroma is in which chamber: `chamber` (1–`chamberCount`, unique) and `aroma` (a `key` of `aromas`). The same aroma may be in several chambers. |
| `flows[]` | yes | array | Aroma spans per chamber: `chamber`, `startMs`, `endMs`, `concentration`. The chamber MUST have an item in `chambers`. |
| `boosters[]` | yes | array | Booster spans per chamber: `chamber` (1–`chamberCount`), `booster`, `startMs`, `endMs`, `intensity`, optional `fadeInMs`, `fadeOutMs`, `fadeInCurve` and `fadeOutCurve`. The chamber need not have an item in `chambers`. |

The fields other than `device` are required only for a device the reader knows. **A reader neither reads nor checks
the `layout` of a device it does not know**: only `device` (a string) is read, and the rest of the object is not
looked at. When `chamberCount` is out of range, chambers are checked against 1–6.

### 9.2 Rules

1. Times, levels and fades as in section 4 (including `media.durationMs`); chambers 1–`chamberCount`.
2. Within one chamber, `flows` MUST NOT overlap. Touching spans are allowed even with equal `concentration`.
3. Within one chamber and one `booster`, `boosters` MUST NOT overlap.
4. **A booster span with a fade (`fadeInMs > 0` or `fadeOutMs > 0`) MUST NOT overlap any other span of the same
   `booster`, in any chamber**: overlapping fades cannot be combined into one line. Such an overlap is reported as
   `OVERLAP` once, on the `startMs` of the span that is later in the `layout.boosters` array.
5. `NOT_MERGED` is never reported inside `layout`.
6. Order: `chambers` ascending by `chamber`; `flows` by (`chamber`, `startMs`); `boosters` by (`chamber`, `startMs`,
   booster order), `inner` before `outer`.
7. `layout.flows` and `layout.boosters` together have at most 5000 items.
8. The projection of the layout (section 9.3) MUST equal the top-level `flows` and `boosters`: the projected aroma
   spans and the top-level `flows` are equal item by item, in order, and so are the projected booster spans and the
   top-level `boosters`. Otherwise
   `LAYOUT_MISMATCH` is reported, once, at path `layout`. It is reported only when neither `aromas` nor `layout` has any
   violation, since a projection of broken input means nothing. The comparison leaves out booster spans whose name the
   reader does not know, on both sides; an absent fade equals a fade of 0, and a fade's curve is compared as it plays:
   a curve beside no fade, an absent curve and one the reader does not know (of a higher minor version) all count as
   `linear`.

For the overlap rules 2 and 3, the procedure of section 4.1 is applied to the lanes of one chamber, with the spans that
have a fade left to rule 4.

### 9.3 Projection

The projection computes the top-level lines from a layout.

**Lane cleaning** turns a set of possibly overlapping spans into one line:

1. Leave out spans with `endMs <= startMs`, and count negative fades as 0. (Neither occurs in a valid layout.)
2. Cut the timeline at every `startMs` and `endMs` of the spans.
3. For each piece between two consecutive cuts, the level is the **maximum** level of the spans active during the
   piece, the same way the device combines boosters. Drop pieces where no span is active.
4. A piece inside a span that has a fade takes that span's `fadeInMs` and `fadeOutMs`, with their curves. In a valid layout such a span
   overlaps no other span of its lane, so it is the only active span and becomes one whole piece with its fades. Every
   other piece has no fades. (In an invalid layout, a fading span that overlaps another one counts as having no fades.)
5. In time order, merge a piece into the one before it when they touch, have the same level and there is no fade at the
   joint (the earlier piece's `fadeOutMs` and the later piece's `fadeInMs` are both 0). The merged piece keeps the
   earlier piece's `fadeInMs` and the later piece's `fadeOutMs`, each with its curve.

The result has no overlaps, cannot be merged further, is sorted by `startMs`, and is unique: it has the form section 4
requires.

**Projection:**

1. Find the aroma key of each chamber from `chambers`.
2. For each item of `aromas`, in order, whose `key` is a valid key and not the key of an earlier item: its lane is the
   `layout.flows` spans of every chamber whose item names that key. Clean the lane; each piece becomes an aroma span with
   that `aroma` and `concentration` equal to the piece's level. Aromas whose key is not a valid key are skipped, and so
   are spans in a chamber without an item.
3. For `inner` and for `outer`: the lane is the `layout.boosters` spans of that `booster` in every chamber. Clean the lane;
   each piece becomes a booster span with that `booster`, `intensity` equal to the piece's level, and the piece's fades
   with their curves.
   Booster names the reader does not know are skipped.
4. Sort the aroma spans by (`startMs`, order in `aromas`) and the booster spans by (`startMs`, `inner` before
   `outer`).

On the top level overlaps are forbidden; the maximum rule of step 3 of lane cleaning resolves the two cases that a layout
allows: booster spans of different chambers that overlap, and the same aroma released from two chambers at
once. For a layout that uses one chamber per aroma and has no overlapping boosters, the projection is a plain copy.

In this layout one aroma is in chambers 1 and 3, and the inner booster spans of chambers 1 and 2 overlap. Aroma `a1`
becomes 60 from 0 to 1 s and then the maximum, 80, until 3 s; the inner booster becomes 70 until 1.5 s and then 50:

Valid.
<!-- asmf:valid -->
```json
{
  "asmf": "1.1",
  "aromas": [
    {"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"},
    {"key": "a2", "id": "b81d4e2a-07c3-4f5e-9d16-4a2c6e8f0b13"}
  ],
  "flows": [
    {"aroma": "a1", "startMs": 0, "endMs": 1000, "concentration": 60},
    {"aroma": "a2", "startMs": 500, "endMs": 1500, "concentration": 100},
    {"aroma": "a1", "startMs": 1000, "endMs": 3000, "concentration": 80}
  ],
  "boosters": [
    {"booster": "inner", "startMs": 0, "endMs": 1500, "intensity": 70},
    {"booster": "outer", "startMs": 0, "endMs": 3000, "intensity": 40, "fadeInMs": 1000, "fadeOutMs": 1000},
    {"booster": "inner", "startMs": 1500, "endMs": 3000, "intensity": 50}
  ],
  "layout": {
    "device": "aroma-shooter-3",
    "chamberCount": 3,
    "chambers": [{"chamber": 1, "aroma": "a1"}, {"chamber": 2, "aroma": "a2"}, {"chamber": 3, "aroma": "a1"}],
    "flows": [
      {"chamber": 1, "startMs": 0, "endMs": 2000, "concentration": 60},
      {"chamber": 2, "startMs": 500, "endMs": 1500, "concentration": 100},
      {"chamber": 3, "startMs": 1000, "endMs": 3000, "concentration": 80}
    ],
    "boosters": [
      {"chamber": 1, "booster": "inner", "startMs": 0, "endMs": 1500, "intensity": 70},
      {"chamber": 1, "booster": "outer", "startMs": 0, "endMs": 3000, "intensity": 40, "fadeInMs": 1000, "fadeOutMs": 1000},
      {"chamber": 2, "booster": "inner", "startMs": 1000, "endMs": 3000, "intensity": 50}
    ]
  }
}
```

When the top-level lines do not match the projection:

Invalid: `LAYOUT_MISMATCH` at `layout`.
<!-- asmf:invalid LAYOUT_MISMATCH layout -->
```json
{"asmf": "1.1", "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}],
 "flows": [{"aroma": "a1", "startMs": 0, "endMs": 1000, "concentration": 70}],
 "boosters": [],
 "layout": {"device": "aroma-shooter-3", "chamberCount": 1,
   "chambers": [{"chamber": 1, "aroma": "a1"}],
   "flows": [{"chamber": 1, "startMs": 0, "endMs": 1000, "concentration": 60}],
   "boosters": []}}
```

A fading booster span overlapping a span of the same booster in another chamber; the span later in the array is reported,
although it starts earlier:

Invalid: `OVERLAP` at `layout.boosters[1].startMs`.
<!-- asmf:invalid OVERLAP layout.boosters[1].startMs -->
```json
{"asmf": "1.1", "aromas": [], "flows": [], "boosters": [],
 "layout": {"device": "aroma-shooter-3", "chamberCount": 2, "chambers": [], "flows": [],
   "boosters": [{"chamber": 1, "booster": "inner", "startMs": 1000, "endMs": 2000, "intensity": 50, "fadeInMs": 200},
                {"chamber": 2, "booster": "inner", "startMs": 0, "endMs": 1500, "intensity": 50}]}}
```

Invalid: `UNMAPPED_CHAMBER` at `layout.flows[0].chamber`.
<!-- asmf:invalid UNMAPPED_CHAMBER layout.flows[0].chamber -->
```json
{"asmf": "1.1", "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}],
 "flows": [], "boosters": [],
 "layout": {"device": "aroma-shooter-3", "chamberCount": 2,
   "chambers": [{"chamber": 1, "aroma": "a1"}],
   "flows": [{"chamber": 2, "startMs": 0, "endMs": 1000, "concentration": 60}],
   "boosters": []}}
```

Invalid: `DUPLICATE_CHAMBER` at `layout.chambers[1].chamber`.
<!-- asmf:invalid DUPLICATE_CHAMBER layout.chambers[1].chamber -->
```json
{"asmf": "1.1", "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}],
 "flows": [], "boosters": [],
 "layout": {"device": "aroma-shooter-3", "chamberCount": 2,
   "chambers": [{"chamber": 1, "aroma": "a1"}, {"chamber": 1, "aroma": "a1"}],
   "flows": [], "boosters": []}}
```

Invalid: `OUT_OF_RANGE` at `layout.chambers[0].chamber`.
<!-- asmf:invalid OUT_OF_RANGE layout.chambers[0].chamber -->
```json
{"asmf": "1.1", "aromas": [{"key": "a1", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40"}],
 "flows": [], "boosters": [],
 "layout": {"device": "aroma-shooter-3", "chamberCount": 2,
   "chambers": [{"chamber": 3, "aroma": "a1"}],
   "flows": [], "boosters": []}}
```

The layout of a device the reader does not know is not looked at:

Valid.
<!-- asmf:valid -->
```json
{"asmf": "1.0", "aromas": [], "flows": [], "boosters": [],
 "layout": {"device": "future-shooter-12", "chamberCount": 12, "grid": [[1, 2], [3, 4]]}}
```

## 10. Playback semantics

A player has its device's assignment of chambers to aroma identifiers (set up by the user). The top-level `flows` and
`boosters` are what it plays; it MAY ignore `layout`.

1. A player SHOULD NOT play a document that has a structural error or a rule violation; such a document has no defined
   meaning.
2. For each aroma span, the player looks up the aroma's `id` (ignoring case) in its assignment. If a chamber holds it, the
   player releases it there at `concentration`; if several chambers hold it, the lowest-numbered chamber. A player that uses
   an Aroma ID Registry MAY first replace an identifier whose status there is `merged` by the identifier it was merged
   into; the registrant has declared them the same aroma, so this is not substitution.
3. If no chamber holds the aroma, by default the player does **not** emit that span. A player MAY tell the viewer before
   playback how many of the document's aromas it holds ("M of N aromas").
4. **Substitution** is a player feature behind an On/Off switch, and the switch is **Off** by default. With it Off,
   nothing is emitted in place of a missing aroma. With it On, the player MAY emit something similar from the aromas it
   holds (including several aromas at once) for a span whose aroma it does not hold; an aroma whose identifier matches is
   still emitted as itself. How a substitute is chosen is outside this format. A player that substitutes SHOULD make
   that visible to the viewer.
5. Booster spans drive the output named by `booster`. A device without that output skips the span; in particular a
   player MUST NOT emit an `outer` span on the inner booster. Spans of booster names the player does not know are
   skipped. When the document has no `inner` span, the player plays the automatic inner booster (section 7.5) on the
   inner output.
6. Intensity effects are approximated in steps at the device's resolution. A player SHOULD send the reference level
   (section 7.3) of the current moment again at intervals of 100 ms or less. (The Aroma Shooter sets intensity in steps
   of 1 % and time in steps of 100 ms.)
7. On pause, every output stops. After a seek, playback continues from the new position with the spans active there.
8. A player MUST limit the levels and times of a document it does not trust to its device's limits.
9. A player MUST NOT raise levels on its own. The one exception is the automatic inner booster of a document with no
   `inner` span (section 7.5). A document with a weak inner booster is emitted as written; catching a weak inner booster
   is the job of the authoring advisory (section 8).

## 11. Canonical form

A valid document need not be in canonical form (key names and the order of `aromas` are free). The canonical form is
the one representation used to compare or hash documents.

The canonical form is defined for valid documents. It says nothing about validity: a document MUST be validated as
written, and have no structural error and no rule violation, before its canonical form is relied on. (For an invalid
document the procedure below still gives a result, and the rules for references in step 2 keep a dangling reference
dangling, but two different invalid documents can have the same canonical form, and the canonical form of an invalid
document can lack some of its violations, for example a duplicate key.)

The canonical form also depends on the reader that computes it: members that reader does not understand are left out
(step 6), so a reader of a higher minor version can give a longer canonical form of the same text. Likewise any 1.0
tool that rewrites a document, canonical or not, drops what it does not understand: `x-` members, unknown members of a
document of a higher minor version, and a `layout` whose `device` it does not know.

It is computed as follows:

1. Sort `aromas` ascending by `id` with ASCII letters lowered to lower case, comparing bytes; keep the input order of
   equal ids. Write each `id` in lower case (ASCII letters only).
2. Rename the keys in that order to `a1`, `a2`, …, `aN`, and rewrite every reference (`flows[].aroma`,
   `layout.chambers[].aroma`). When two items of `aromas` share a key, the reference goes to the first of them in the
   input order. A reference to a key that no item of `aromas` has becomes the empty string `""`, which is never a key:
   it cannot become a reference to one of the new keys.
3. Sort the members of each `name` by language tag, comparing bytes.
4. Sort `flows` by (`startMs`, order of the aroma in the sorted `aromas`; a reference to no aroma sorts after every
   aroma); `boosters` by (`startMs`, booster order);
   `layout.chambers` by `chamber`; `layout.flows` by (`chamber`, `startMs`); `layout.boosters` by (`chamber`, `startMs`,
   booster order). The booster order is `inner`, `outer`, then other names in byte order. Every sort keeps the input
   order of items with equal keys.
5. Sort `requires` in byte order and remove duplicates.
6. Leave out: `fadeInMs` and `fadeOutMs` when 0; `fadeInCurve` and `fadeOutCurve` when `linear` or when their fade is 0; `requires` when empty; `meta` when it has no members; `media` when it
   has no `durationMs`; `name` when it has no members; every `x-` member and every unknown member.
7. Leave out a `layout` whose `device` the reader does not know, entirely: its body was not read, and a member of only
   `device` would be `MALFORMED` for a reader that knows that device.
8. Keep the version `asmf`, but raise its minor version to at least 1 when the document keeps a fade curve (step 6),
   which version 1.1 added. A document without one keeps its version.
9. Serialise:
   - members in the order of the field tables of this document: `asmf`, `requires`, `meta` (`title`, `author`,
     `createdAt`, `tool`, `language`, `license`), `media` (`durationMs`), `aromas` (`key`, `id`, `name`), `flows`
     (`aroma`, `startMs`, `endMs`, `concentration`), `boosters` (`booster`, `startMs`, `endMs`, `intensity`,
     `fadeInMs`, `fadeOutMs`, `fadeInCurve`, `fadeOutCurve`), `layout` (`device`, `chamberCount`, `chambers` (`chamber`,
     `aroma`), `flows` (`chamber`, `startMs`, `endMs`, `concentration`), `boosters` (`chamber`, `booster`, `startMs`,
     `endMs`, `intensity`, `fadeInMs`, `fadeOutMs`, `fadeInCurve`, `fadeOutCurve`));
   - no whitespace outside strings;
   - `asmf` as the two version numbers in decimal without leading zeros;
   - integers in decimal, without leading zeros or `+`;
   - strings with minimal escaping: `"` as `\"`, `\` as `\\`, the control characters U+0008, U+0009, U+000A, U+000C and
     U+000D as `\b`, `\t`, `\n`, `\f`, `\r`, the other characters below U+0020 as `\u00XX` with lower-case hexadecimal
     digits, and every other character as itself (UTF-8).

Writers SHOULD write documents in canonical form. Indentation for human readers is allowed; documents are compared by
serialising them again in canonical form.

This document is valid but not canonical:

Valid.
<!-- asmf:valid -->
```json
{
  "asmf": "1.0",
  "meta": {},
  "x-editor": {"zoom": 2},
  "aromas": [
    {"key": "rose", "id": "B81D4E2A-07C3-4F5E-9D16-4A2C6E8F0B13", "name": {"fr": "Rose", "en": "Rose"}},
    {"key": "pine", "id": "3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40", "name": {"en": "Pine"}}
  ],
  "flows": [
    {"aroma": "rose", "startMs": 0, "endMs": 1000, "concentration": 60},
    {"aroma": "pine", "startMs": 0, "endMs": 500, "concentration": 40}
  ],
  "boosters": [
    {"booster": "inner", "startMs": 0, "endMs": 1000, "intensity": 60, "fadeInMs": 0}
  ]
}
```

Its canonical form:

Valid; the canonical form of the example above.
<!-- asmf:canonical -->
```json
{"asmf":"1.0","aromas":[{"key":"a1","id":"3f2b8c1e-9a47-4d0b-8e6f-1c5a7b9d2e40","name":{"en":"Pine"}},{"key":"a2","id":"b81d4e2a-07c3-4f5e-9d16-4a2c6e8f0b13","name":{"en":"Rose","fr":"Rose"}}],"flows":[{"aroma":"a1","startMs":0,"endMs":500,"concentration":40},{"aroma":"a2","startMs":0,"endMs":1000,"concentration":60}],"boosters":[{"booster":"inner","startMs":0,"endMs":1000,"intensity":60}]}
```

The empty `meta`, the `x-` member and the zero `fadeInMs` are gone; the aromas are in identifier order with new keys,
the flows follow them, and the names are in language-tag order.

## 12. Conformance

- A **valid document** has no structural error and no rule violation for a reader of its major version.
- A **conforming validator** reports, for every input, the same structural error (code and path) as this specification,
  or, when there is none, the same violation list in the same order (section 5.3).
- A **conforming writer** writes valid documents and SHOULD write them in canonical form.
- A **conforming player** follows section 10.

The shared test vectors in [`vectors/asmf-validator-cases.json`](../vectors/asmf-validator-cases.json) check an implementation. The file is
one JSON object; each section is an array of named cases:

| Section | Each case | An implementation passes when |
|---|---|---|
| `structural` | `text` (raw document text), or `generate` (`oversize`: 4 MiB + 1 bytes; `deep`: 33 nesting levels; `deep32`: 32 levels), and `expected` | parsing gives `expected`: `null` for success, else `{"code", "path"}` exactly. |
| `projection` | `aromas`, `layout`, `flows`, `boosters` | the projection of `layout` equals `flows` and `boosters`. |
| `envelope` | `booster` and `samples` of `[t, level]` | the reference level at each `t` is `level`. |
| `validation` | `document` (an object, or a string holding the exact document text) and `expected` | parsing and validating `document` (an object is serialised first; a string is parsed as it is) gives exactly the ordered list `expected`. |
| `advisories` | `minInnerIntensity`, `document`, `expected` | the advisory check with that minimum gives exactly `expected`. |
| `automaticInner` | `level`, `spans` (aroma spans as `[startMs, endMs]`, in any order), `expected` | the automatic inner lane (section 7.5) for those spans at that delivery level is exactly `expected`. |
| `canonical` | `a`, `b` (each an object, or a string holding the exact document text), `canonical` | the canonical JSON of both `a` and `b` is exactly the string `canonical`. |

Some `validation` documents use generators, which a runner expands before serialising: `{"list": name, "count": N,
"item": {…}, "stepMs": S}` becomes N copies of `item` with `startMs` and `endMs` of copy i shifted by i × S (for
`list` = `aromas`, N aromas with distinct keys and UUIDs), and `{"repeat": s, "count": N}` becomes the string s repeated
N times.

A document given as an object has no significant member order, because many JSON libraries do not keep it. Where
member order matters (for example the order of the entries of `name`, which is the reporting order of section 5.3
and is sorted by the canonical form), a case gives the document as a string holding its exact text.

The reference implementation is the Rust crate in `crates/aroma-asmf`. It runs the vectors in its test
`tests/vectors.rs` and checks every example in this document in `tests/spec_examples.rs`.

## 13. Aroma identifiers

An aroma identifier is an opaque value that names a scent. It is not issued by any registry: anyone can create one for
their own aroma.

- Writers MUST use random UUIDs (version 4, RFC 9562) for new aromas. An identifier MUST NOT be derived from a name, a
  product code or any other information (for example by a name-based UUID), so that nothing can be learned from it.
  Validation checks only the `8-4-4-4-12` hexadecimal form and that it is not all zero.
- The format has no field for a manufacturer, a supplier, a raw material or a product code. `x-` extension members
  SHOULD NOT carry such information either.
- Which physical materials make up an aroma with a given identifier is kept, outside the format, by whoever makes the
  cartridges.
- Players emit only the aroma whose identifier is exactly the same (ignoring letter case), unless substitution is
  switched on or a registry declares the identifier merged into that one (both in section 10).
- `name` gives human-readable names, so that a player that does not know an identifier can still show what it is.

### 13.1 Passing a document on

An identifier need not be registered anywhere: an aroma that only its maker uses plays on the maker's own devices like
any other. When a document is passed on to other people, only the aromas whose identifiers are published in an Aroma
ID Registry (`spec/aroma-registry.md`) can be expected to play for them.

- A player emits the aromas of the document that its device holds and, by default, nothing for the others (section 10,
  rules 3 and 4). An aroma that is not registered is therefore not replaced by another one, and the rest of the
  document plays as written.
- A writer, or a service that passes documents on, SHOULD tell the author, before a document leaves, which of its
  aromas are not registered and that those will not be emitted elsewhere. It MAY refuse to pass the document on until
  they are registered.
- A player that uses a registry MAY tell the viewer which aromas of a document are not registered there.
- Registering an aroma does not change its identifier (Aroma ID Registry, section 3), so a document made before the
  registration needs no change after it.

## 14. Reserved names and future channel layouts

A spatial channel layout (for example several devices placed left and right of the viewer) is planned for a later
version. These names are reserved for it:

- at the top level and inside items of `flows` and `boosters`: `outputs`, `channels`, `spatial`, `output`, `channel`,
  `position`;
- inside items of `flows`: `fadeInMs`, `fadeOutMs`, `fadeInCurve`, `fadeOutCurve` (for fades on aroma spans, with the
  meaning they have on booster spans).

A document MUST NOT use these names; by the rule for unknown members (section 6) a reader reports them as
`UNKNOWN_FIELD` in a document of its own minor version or a lower one. Tool extensions MUST use the `x-` prefix. The channel layout will be added as a
separate member that combines into the top-level lines (section 6), so that 1.0 documents and 1.0 readers keep working.

Invalid: `UNKNOWN_FIELD` at `outputs`.
<!-- asmf:invalid UNKNOWN_FIELD outputs -->
```json
{"asmf": "1.0", "outputs": [], "aromas": [], "flows": [], "boosters": []}
```

Invalid: `UNKNOWN_FIELD` at `boosters[0].channel`.
<!-- asmf:invalid UNKNOWN_FIELD boosters[0].channel -->
```json
{"asmf": "1.0", "aromas": [], "flows": [],
 "boosters": [{"booster": "inner", "startMs": 0, "endMs": 1000, "intensity": 60, "channel": 1}]}
```

## 15. Media type and file extension

- Media type: `application/vnd.aromajoin.asmf+json`.
- File extension: `.asmf`.
- Encoding: UTF-8, without a byte order mark.

A document can sit next to its media file as a sidecar with the same base name (`video.mp4` and `video.asmf`,
`song.mp3` and `song.asmf`).

## 16. Security considerations

- **Size and depth.** Readers MUST reject a text larger than 4 MiB (4194304 bytes) and nesting deeper than 32 levels as
  `MALFORMED`. The limits are enforced while the text is read (the size before parsing starts, the depth as each level
  is entered), and a document over either limit is rejected as a whole, so that a hostile document cannot exhaust
  memory or the stack.
- **Duplicate member names.** A member name that appears twice in one object is `MALFORMED`. A reader MUST NOT let the
  last (or the first) value win silently, since two readers could then see two different documents.
- **Numbers.** Whether a number in a member the reader reads is an integer is decided by its JSON token, not by its
  value (`-0` is not an integer); numbers inside ignored members (section 3.7) are not examined, but they still count
  toward the size and depth limits and MUST be valid JSON. As an exception, a number token too large in magnitude for a
  finite IEEE 754 double makes the whole document `MALFORMED` wherever it appears, ignored members included, so that
  readers built on common JSON libraries, which reject such numbers, agree. Range checks MUST NOT overflow: values up
  to the signed 64-bit range reach validation, and differences and sums of two of them need wider arithmetic (the
  reference implementation uses 128-bit integers for fades and the reference level).
- **Identifiers and keys** are checked as ASCII only: full-width digits or letters outside ASCII do not match the forms
  of `key` or `id`, and comparison ignoring case lowers ASCII letters only.
- **Untrusted values.** Even a valid document can ask for the strongest level for a long time. A player MUST limit the
  levels and times of a document it does not trust to its device's limits (section 10).
- **Counts.** The limits of `TOO_MANY` (64 aromas, 10000 spans, 5000 layout spans) bound the work of validation and
  projection; when one applies, nothing else is checked.
- **No active content.** A document contains no code, links or references to other resources. `meta` and `name` are
  plain text and MUST be shown as text, not interpreted as markup.
- **Error reports.** The paths and codes of structural errors, rule violations and advisories can embed member names
  and language tags taken from the document (`flows[0].<unknown member>`, `aromas[0].name.<tag>`), of any length and
  unescaped. An implementation that logs or displays them MUST treat them as untrusted text (escape them, and limit
  their length where that matters).
- **Privacy.** Aroma identifiers are random and the format has no field for supplier or product information
  (section 13).

## 17. Change log

| Version | Date | Changes |
|---|---|---|
| 1.0 | 2026-11-05 | First version. |
| 1.0 (draft revision) | 2026-11-19 | Automatic inner booster: a document with no `inner` span leaves the inner booster to the player (sections 7.1, 7.5, 8, 10, 12). |
| 1.0 (draft revision) | 2026-11-19 | Merged identifiers from an Aroma ID Registry (sections 10, 13). |
| 1.1 | 2026-11-20 | Fade curves: `fadeInCurve` and `fadeOutCurve` (sections 3.6, 7.2, 7.3, 9, 11). |
| 1.1 (draft revision) | 2026-11-20 | Wording: the media can be a video or an audio recording, with an audio sidecar example; "viewer" defined (sections 1, 2, 15). No rule changes. |
| 1.1 (draft revision) | 2026-11-24 | Passing a document on: only registered aromas can be expected to play for others; the others are not emitted and not replaced, and the author is told (section 13.1). No change to what a valid document is. |
