Skip to main content

WAI Extension: Crowd Sound

Mirrored from the canonical text at commit 498e6b88 ().

Status: Draft. Registers the record wai.live.crowd: a remote audience’s sound returned to a show, to its venues and to the rest of the audience as an aggregate, never as any person’s voice. The room authority signs a crowd policy, WYP1: the window over which the crowd is counted, the floor below which a window states too few rather than a level, the crowd sound kinds the room takes (applause, cheer, singing along), and the gains its rendering uses. A member whose grant carries the crowd attribute sends, at most a bounded number of times in each window, a crowd input, WYI1: for each kind, a level from 0 to 15 of what it is doing, which its page measured from its own microphone or its buttons and never sends as sound. Per window, a room key signs a crowd aggregate, WYA1: how many members reported, a crowd level, and per kind how many did it and how loudly, with a commitment to the inputs it counted, which anyone holding the room recomputes; a window with fewer reports than the floor states too few, never silence. A venue’s local mix (spaces §9) plays the aggregates through one integer rendering rule, so every venue makes the same samples from the same aggregates. Inputs ride in the room’s events, so the room’s moderation decides on them as on any event. No new transport. The reference implementation is the crowd_sound module of wai-rs (feature crowd_sound); the corpus is live-conformance/crowd/, and its second implementation is live-conformance/crowd_sound_verify.py. Keywords MUST, MUST NOT, SHOULD, MAY are RFC 2119/8174.

Texts read for this revision: the live family this extension builds on, as merged (live-events with its reactions and decisions, live-rooms, live-compose §6, live-moderation §4, co-performance §7, spaces), and telemetry-aggregation with the Prio3 measures it runs; RFC 8032 and FIPS 180-4. No outside text is pinned. What the field has, as gathered on 2026-11-14: a remote audience’s sound returned to a venue exists only for sport, as phone soundboards that play recorded cheers through a stadium’s speakers; no show returns its remote crowd’s own sound; and crowds in shared worlds are split into instances of a few hundred that do not hear one another (decision D126).

1. Scope

In scope: the crowd policy, its signature and the policy in effect at each instant (§3); how this extension’s statements ride in a room’s events, who may sign each, and the grant attribute it reads (§4); crowd inputs, their windows, their rules and their moderation (§5); a member’s contribution, scopes, the values of an aggregate and the floor (§6); the aggregate statement (§7); the crowd voice, the rendering rule (§8); why the crowd is aggregated this way (§9); where each rule is enforced (§10); and verification (§11).

Out of scope: a transport; how a page measures its member’s applause, cheering or singing, or offers buttons for them; what a member’s page plays of the crowd; the crowd’s sound in a shared world, which an extension that defines a world’s parts names by a scope (§6.2); and a crowd statistic published after the show, which telemetry-aggregation can run as a task of its own.

Relationship to the core spec: wai.live.crowd is a record (SPEC §5): signed records a WAI tool emits and verifies. It names no payload format and is not dispatchable.

Relationship to live-events: this extension changes nothing in it. Its statements are payloads of the meta kind (live-events §4.2), so every input is signed by its member, chained, stamped with the room clock and rate-bounded by the member’s policy (live-events §5, §6). A reaction of type applause (live-events §4.5) is a gesture aimed at an event; a crowd input is a measure of a sound, counted with every other member’s, and the two are independent.

Relationship to live-rooms: the descriptor’s and the grant’s layouts are unchanged. A room states its crowd policy in a record of its own, WYP1 (§3), chained as co-watch’s policy is. The crowd attribute is a grant attribute (§4.4), which live-rooms §4.4 signs with the grant and leaves to the extensions that read it.

Relationship to co-performance: an audience input there is material a performer may select and play, credited; a crowd input here is never selected, played or credited, only counted. A window’s aggregate commits to the inputs it counted as a co-performance commitment does (co-performance §7.5), and an input is restricted as there (co-performance §7.4).

Relationship to spaces: a space’s local mix plays the crowd voice (§8) of the room’s crowd at the space’s crowd gain (spaces §9.1). A room with crowd sound and no spaces renders the crowd voice wherever its sinks choose to play it.

Relationship to telemetry-aggregation: that extension’s Prio3 measures are not used here; §9 says why.

2. Terms

Integers are little-endian; a signed integer is two’s complement. A digest is SHA-256 (FIPS 180-4), 32 bytes. Ed25519 is RFC 8032’s, verified strictly (SPEC §7 Signatures): a key that fails step 1 or 2 is bad_key, and a signature that fails a later step is bad_signature. ⌊a / b⌋, for b above 0, rounds toward negative infinity.

3. The crowd policy

3.1 Layout

fieldsizemeaning
magic4WYP1 (ASCII)
version11 in this revision
room32the room id (live-rooms §3.2)
prev32the digest of the policy this one replaces (§3.4); 32 zero bytes for the first
effective8u64: the room-clock instant from which this policy applies; 0 for the first, and a multiple of window_ms × 1000
window_ms4u32: the length of a window (§5.2), 100 to 60 000
min_inputs4u32: the floor: the fewest members reporting for which a window states a level (§6.4), above 0
lag_ms4u32: how long after a window’s end its crowd voice starts (§8.3), at most 60 000
kinds1the kinds the room takes: bit k − 1 for kind k; not 0, and no bit above bit 2
gains6three u16, Q12, 0 to 16 384: the crowd voice’s gain for applause, cheer and singing along (§8.3)
sig64§3.2

3.2 Digest and signature

The digest of a policy is SHA-256 over its record from magic through gains. The signature is Ed25519 by the room descriptor’s authority over the 17 bytes wai:crowd-policy (ASCII) and 0x01, followed by the bytes the digest covers.

3.3 Reading and rules

A reader reads exactly the bytes it is given as one policy, in the order of §3.1, and refuses at the first of these that holds:

  1. Fewer than 4 bytes: truncated. A magic other than WYP1: malformed. No byte after the magic: truncated. A version other than 1: unknown_version.
  2. The bytes end before a field the layout requires: truncated.
  3. Bytes after sig: malformed.

It then holds the policy to the rules of §3.1’s table, and refuses one that breaks any of them as crowd_policy_malformed: window_ms is 100 to 60 000; effective is a multiple of window_ms × 1000; min_inputs is above 0; lag_ms is at most 60 000; kinds is not 0 and sets no bit above bit 2; and each gain is at most 16 384. Then its room is the room id (wrong_room), its signature verifies (bad_key, bad_signature), and its link holds (§3.4, crowd_policy_unlinked).

3.4 The policy in effect

A verifier is given a room’s policies in a list. The first has prev zero and effective 0. Each later one has as prev the digest of the one before it in the list, and an effective above that one’s that is a multiple of that one’s window_ms × 1000 as well as of its own, so that no window of either holds the instant one replaces the other. A policy that breaks this is refused crowd_policy_unlinked. The policy in effect at room-clock instant t is the last of the list whose effective is at or below t. A policy is replaced, never amended.

4. Statements

4.1 Carriage

magicstatementsectionwho signs it
WYI1crowd input§5.1a member (§4.4)
WYA1crowd aggregate§7.1a room key

Each statement is the payload of a meta event: its magic, a version byte of 1, and the fields its section lists. A meta payload whose first four bytes are neither magic is not this extension’s, and a sink that does not implement it shows neither: they are timed metadata for its application (live-events §4.2).

4.2 Reading

A statement that ends before a field, that holds bytes after its last field, whose version is not 1, or whose field holds a value its section does not allow, is crowd_statement_malformed.

4.3 Who signs

A crowd input by a principal that is not a member at its event’s t (§4.4), a room key among them, is crowd_not_permitted, and so is a crowd aggregate by any principal but a room key. Since a statement is a meta event, the room verifier has already held it to its author’s grant: a principal whose policy does not permit meta cannot send one (live-rooms §9.2 step 4, kind_not_permitted).

4.4 The crowd attribute

This extension reads one grant attribute (live-rooms §4.4):

keyvaluemeaning
crowdone of the digits 1 to 8the principal is a member of the crowd, and may send at most this many inputs in one window (§5.3)

A grant whose crowd is not one of those digits is refused crowd_attr_malformed. A grant without it gives no part in the crowd. The authority gives the attribute to the audience whose sound returns, and takes it away by a grant exchange (live-rooms §4.6), which is also how a member is removed from the crowd (§5.5).

4.5 The policy a statement is read under

A statement is read under the policy in effect at its event’s t. A statement at an instant with no policy in effect is refused crowd_no_policy.

5. Inputs

5.1 The crowd input

fieldsizemeaning
magic, version5WYI1, 1
scope32the crowd it reports to (§6.2)
levels3three u8, 0 to 15: the member’s level of applause, cheer and singing along over the window, 0 for none

An input whose level is above 15, or above 0 for a kind the policy in effect does not take, is crowd_statement_malformed. An input with every level 0 is a report of a quiet member, and is counted as one (§6.3).

5.2 Windows

The windows of a policy are the stretches of the room clock from j × W up to, but not including, (j + 1) × W, with W its window_ms × 1000 and j a whole number, that lie wholly within the stretch over which it is in effect (§3.4). Since a policy’s effective is a multiple of its own window and of the window of the policy it replaces, every instant of the room clock lies in exactly one window, which holds one policy. An input belongs to the window that holds its event’s t.

5.3 Rules

An input is checked, in this order:

  1. its author is a member at its event’s t: otherwise crowd_not_permitted (§4.3);
  2. counting it, its author has sent at most its crowd value of inputs in its window, the inputs counted in the order of the author’s chain: otherwise crowd_over_limit.

A relay MUST NOT forward an input these checks refuse, nor one of a window and scope whose aggregate (§7) it has forwarded: the aggregate fixed the window’s inputs, and an input the room holds of that window is one it counts (§7.2). A relay holds an input to these rules with the grant its author’s session proved (live-rooms §10.5) and counts an author’s inputs in the order of its chain, as co-performance §7.3 has a relay count audience inputs; it withholds an input it refuses, never replaced, so its author’s chain shows the gap.

5.4 What a page sends

A member’s page that takes part in the crowd SHOULD send one input near the end of every window while its member takes part, an input of every level 0 when its member is quiet, so that a quiet crowd is counted as quiet and not as absent (§6.4). It measures its member’s sound where it is: its member’s microphone, decoded, never leaves it, and an input states only levels. How a page maps loudness or a button to a level is its own; a level is the member’s share of the crowd, and 15 is the most any member counts for.

5.5 Moderation

Live-moderation applies to inputs as to any meta event (its §4): a review policy may hold them, and a moderator decides on them. An input is restricted at an instant when, of the decision events the room accepted before that instant whose target is its digest, the last denies or redacts it (live-events §4.11; live-moderation §4.5 keeps that decision the standing one of its line), as co-performance §7.4 has it. A restricted input is not counted (§6.1). A member whose part in the crowd is ended is given a grant without the attribute (§4.4); its inputs before the exchange are counted as they stood.

6. Aggregation

6.1 A member’s contribution

An input is eligible for an aggregate when the room accepted it, it belongs to the aggregate’s window, and it is not restricted at the aggregate’s event. A member’s contribution to a window is its last eligible input of the window in the merged order. A member reports to a scope in a window when its contribution names that scope. A member so reports to one scope in a window at most, and counts once in it, whatever number of inputs it sent.

6.2 Scopes

A scope is 32 bytes. 32 zero bytes is the room: the whole crowd of the room. Another scope is a part of the crowd that another extension names, a part of a shared world among them, and says which members may report to it; this extension counts the members that report to a scope, of any value, and leaves to that extension whether each was entitled to. Every input and every aggregate names its scope, so the aggregate of any part of a room’s crowd has one form.

6.3 The values

For a window w and a scope s, over the members reporting to s in w, each with its contribution’s levels l1, l2 and l3:

The crowd level of the window is ⌊4096 × level_sum / (15 × reporting)⌋, and the level of kind k ⌊4096 × sumk / (15 × reporting)⌋, each Q12 from 0 to 4096: a crowd all at its loudest is 4096, and a crowd all quiet 0. They are means over the members who reported, so no member moves a level by more than its own share, and a crowd that grows is not louder for growing.

6.4 Too few

A window whose reporting is below the floor (min_inputs of the policy in effect) is too few: its aggregate states so, with level_sum and every count and sum 0, and no crowd level and no level of kind. A window too few is not a quiet window: a quiet window has at least the floor of members reporting, at levels of 0. A window with no aggregate is unstated. Neither too few nor unstated is a level of 0; a sink that shows the crowd shows each for what it is.

7. The aggregate statement

7.1 Layout

fieldsizemeaning
magic, version5WYA1, 1
scope32the scope (§6.2)
from, to8 eachu64: the window (§5.2)
state11 stated, 2 too few (§6.4)
reporting4u32
root32the commitment to the inputs counted (§6.3)
level_sum4u32
kinds24for applause, cheer and singing along in that order: count (u32) and sum (u32)

An aggregate whose state is not 1 or 2, whose from is not below its to, or whose to is above its event’s t, is crowd_statement_malformed: an aggregate counts a window that has ended.

7.2 Rules

An aggregate is checked, in this order:

  1. its author is a room key: otherwise crowd_not_permitted (§4.3);
  2. from and to are a window of the policy in effect at from (§5.2): otherwise crowd_window_mismatch;
  3. it is the first aggregate of its scope and window in the merged order: otherwise crowd_aggregate_repeated;
  4. its state, reporting, root, level_sum and kinds are those of §6.3 and §6.4, over the inputs the room holds: otherwise crowd_aggregate_mismatch. An aggregate that states a level for a window below the floor, or too few for one at it, or that counts a restricted input, is so refused.

Since the merged order is by t (live-rooms §9.2), and an aggregate’s t is at or after its window’s end, every input of the window precedes it there: an aggregate counts every input the room holds of its window, and a relay that forwarded it forwards no later input of that window (§5.3).

8. The crowd voice

8.1 What is rendered

The crowd voice of a scope is a mono voice of signed 16-bit samples at a sample rate R (the composition descriptor’s, live-compose §3.1, where a space’s local mix plays it), made from the scope’s accepted aggregates by this section alone. Window w, from from to to, gives a block of n = ⌊window_ms × R / 1000⌋ samples, played from the instant to + lag_ms × 1000, sample j at that instant plus ⌊j × 10^6 / R⌋ µs. Every renderer given the same aggregates gives every block the same samples.

8.2 Targets

The target of kind k for window w is its level of kind (§6.3) when w’s aggregate is stated with reporting above 0, and 0 when it is too few or unstated. The previous target is the target of kind k for the window that ends at w’s from under w’s policy, from from − window_ms × 1000, and 0 when there is none. A crowd that falls to too few, or whose aggregate is missing, fades to silence over one window: the voice never fills a window it has no count for.

8.3 One block

For each kind k the policy takes:

  1. The seed is the first 8 bytes, as a u64, of SHA-256 over the 16 bytes wai:crowd-noise (ASCII) and 0x01, the room id, the scope, from (u64) and k (u8); a seed of 0 is taken as 1.
  2. The noise. A state x, set to the seed, steps by x ← x ⊕ (x ≪ 13), x ← x ⊕ (x ≫ 7), x ← x ⊕ (x ≪ 17), each shift in 64 bits with the bits shifted out lost; after step j + 1, the top 16 bits of x, read as a signed 16-bit integer, are the noise vj of sample j.
  3. The shape. Applause is the noise itself: sj = vj. Cheer and singing along are the noise through a one-pole low-pass filter that starts at 0 in every block: yj = yj−1 + ⌊(vj − yj−1) / 2^m⌋, y−1 = 0, with m 2 for cheer and 4 for singing along, and sj = yj. Applause is broad and bright, cheer lower, singing along a low murmur.
  4. The level of sample j is ℓj = p + ⌊(q − p) × j / n⌋, with p the previous target and q the target: a ramp from one window’s level to the next, with no step.
  5. The term of sample j is ⌊(sj × ℓj × g + 2^23) / 2^24⌋, with g the kind’s gain (§3.1).

Sample j of the block is the sum of the terms of the kinds the policy takes, saturated once to −32 768 … 32 767. Each term is at most 2^41 in magnitude before its shift, and every product and sum is exact in 64 bits.

8.4 What a sink renders

A space’s local mix plays the room’s crowd voice (scope 32 zero bytes) as spaces §9.1 says. A sink MUST NOT render a too-few window as a crowd, nor an aggregate that live-moderation restricts (its §6.4); a sink that shows the crowd’s levels shows a too-few window as too few and an unstated one as unknown, never as 0. A crowd voice is synthesized sound, made by a rule from counts, and a sink that labels synthesized media labels it so (synthesis §8).

9. Why the crowd is aggregated this way

A crowd’s sound reaches a venue as counts, never as voices: a thousand open microphones mixed into a hall’s speakers is feedback, every room’s noise and every person’s words, and no room can moderate it. Counts are a few bytes a member a window; the venue makes the sound from them, the same in every venue, and no member’s voice leaves its page.

The inputs are signed events of the room, which anyone holding the room reads, and the aggregate is recomputed from them. Private aggregation by Prio3 under DAP, as telemetry-aggregation runs it, was considered and is not used:

A member that needs its reports unlinkable across rooms uses a key per room, as live-events §11 has every principal do.

10. Where each rule is enforced

After the fact, a verifier (§11) checks every one of these against the room: an input over its member’s bound, an input from a principal outside the crowd, an aggregate that does not recompute, counts a restricted input, or states a level below the floor, are each found out.

11. Verification

11.1 Inputs

A crowd verifier is given what a room verifier is given (live-rooms §9.1: a descriptor, grants, a key-log head or none, and the chains), and:

11.2 Steps

It runs these steps and stops at the first refusal, which it reports with the reason and where:

  1. The room (live-rooms §9): a refusal, at room with the room verifier’s own place. A gap is not a refusal; the steps go on, and an aggregate’s step 4 (§7.2), which recomputes from the room, is not made.
  2. The policies, in the list’s order (§3.3, §3.4): at the policy’s index.
  3. The grants’ attributes (§4.4), in the grants’ order: at the grant’s index.
  4. The statements, in the merged order: each meta event the room accepted whose payload begins with a magic of §4.1: §4.5 (crowd_no_policy), then §4.2, then the rules of its section (§5.3, §7.2), in the order each gives. At the record.
  5. The outcome (§11.3).

11.3 Outcomes and what a verification states

With accept or gap, the verifier states:

12. Reasons

The codes this extension adds, each with where it is raised:

reasonraised at
crowd_policy_malformed§3.3
crowd_policy_unlinked§3.4
crowd_attr_malformed§4.4, §11.2 step 3
crowd_statement_malformed§4.2, §5.1, §7.1
crowd_no_policy§4.5
crowd_not_permitted§4.3, §5.3 step 1, §7.2 step 1
crowd_over_limit§5.3 step 2
crowd_window_mismatch§7.2 step 2
crowd_aggregate_repeated§7.2 step 3
crowd_aggregate_mismatch§7.2 step 4

A crowd verifier also raises every code a room verifier raises (live-rooms §11 and the live-events codes it lists), at room; truncated, malformed and unknown_version for a policy that does not read; wrong_room, bad_key and bad_signature for a policy of another room or whose signature fails; and delivery_gap for a gap, which is not a refusal.

13. Conformance

live-conformance/crowd/ holds the corpus, in one file, vectors.json, written from fixed seeds by wai_crowd_sound_vectors gen. It has rooms, each a room (descriptor, grants, key-log head or none, chains) and its policies, and the outcome §11.3 gives them with everything it states; and renders.

A conforming verifier gives every room the outcome, the reason, the place, and everything else the corpus states, and every render its samples. wai_crowd_sound_vectors verify and the test tests/crowd_sound.rs check that the file regenerates byte for byte, that wai-rs gives every room its outcome and every render its samples, that every reason of §12 appears, and that §12 lists exactly the reference’s codes. live-conformance/crowd_sound_verify.py is the second implementation, written from this text: it shares no code with wai-rs; it verifies each room with the live-rooms corpus’s second implementation (live_rooms_verify.py) and every signature with WAI’s strict rule (claim-conformance/_ed25519.py); it renders every block itself; and it mutates copies of the corpus and requires every copy to fail, and drops each of its own checks in turn and requires the corpus to catch the weakened verifier.

14. Security and privacy considerations