music
A module script.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2preseed/music.module — soundtrack playback + the Fourier-analysis query API. The director starts/stops playback and pushes its master clock in via `Music.sync(t)` every tick; parts then query the STFT analysis of the score at the demo clock — `band`/`bands`/`level`/`flux` — plus the musical grid (`beat`, `pulse`) and the composed cue track (`cues`, `nextCue`). Sampling is clock-indexed, so visual reaction is deterministic and survives seeks. Binary formats (written by preseed/bake): spectrum.bin <I4 magic "SPSP"> <I4 ver> <I4 rate> <I4 frames> <I4 bands> frames×bands f32 rows (normalized 0..1), then frames f32 flux cues.bin <I4 magic> <I4 ver> <I4 count> then count × <f t><B kind><f v>
loadData( ) → void
resolveClip( ) → void
startPlayback( ) → void
source( ) → void
The live Audio source, or nil when nothing is meant to be playing.
stopPlayback( ) → void
rearm(a: ?) → void
Restart the score from its own zero and pin that zero to the clock's current value, so `position() - armOffset` is what the clock is compared against from here on.
| arg | type | description |
|---|---|---|
| a | ? |
sync(t: ?) → void
Push the demo clock in, and keep the audible playhead on it. This is the only place the score's transport is touched while the film runs: the director hands the master clock over every tick and the score follows it. A source that has ended, that was never started, or that has walked away from the clock is put back; one that is already in step is left alone.
| arg | type | description |
|---|---|---|
| t | ? |
time( ) → void
offset( ) → void
How far the audible score sits behind the demo clock. Zero for a film played from the top, which is the only way a viewer ever sees it; non-zero after an authoring seek, because the engine's Audio source can be started but not positioned.
sampleBand(bi: ?, t: ?) → void
| arg | type | description |
|---|---|---|
| bi | ? | |
| t | ? |
band(bi: ?, at: ?) → void
band index 1..8: sub, bass, lowmid, mid, himid, presence, brilliance, air
| arg | type | description |
|---|---|---|
| bi | ? | |
| at | ? |
bands(at: ?) → void
| arg | type | description |
|---|---|---|
| at | ? |
level(at: ?) → void
broadband loudness proxy: weighted toward the musical mids
| arg | type | description |
|---|---|---|
| at | ? |
flux(at: ?) → void
| arg | type | description |
|---|---|---|
| at | ? |
beat(at: ?) → void
| arg | type | description |
|---|---|---|
| at | ? |
pulse(hl: ?, at: ?) → void
beat-locked pulse: 1.0 on each beat, exponential decay with half-life hl
| arg | type | description |
|---|---|---|
| hl | ? | |
| at | ? |
lowerBound(arr: ?, x: ?) → void
| arg | type | description |
|---|---|---|
| arr | ? | |
| x | ? |
cueRange(kind: ?, t0: ?, t1: ?, openAtStart: ?) → void
| arg | type | description |
|---|---|---|
| kind | ? | |
| t0 | ? | |
| t1 | ? | |
| openAtStart | ? |
cues(kind: ?, t0: ?, t1: ?) → void
cues of `kind` with t in [t0, t1]; returns array of { t, v }. Asking for the whole film answers with the whole film, the section hit on the first frame included.
| arg | type | description |
|---|---|---|
| kind | ? | |
| t0 | ? | |
| t1 | ? |
fired(kind: ?, dt: ?) → void
convenience for part update loops: cues that fired in the last dt window. Half-open at the start, so a cue sitting exactly on a frame boundary is handed to one frame and not to both.
| arg | type | description |
|---|---|---|
| kind | ? | |
| dt | ? |
nextCue(kind: ?, after: ?) → void
| arg | type | description |
|---|---|---|
| kind | ? | |
| after | ? |
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.