OrigoSound.component
README.md
OrigoSound — the party's voice
Attached by the scene entrypoint to the Sound anchor when play begins. It
shows nothing on screen and owns no state: it is a pure reaction to what the
match announces on the game.rules bus.
It starts the looping candy music bed once at start(), and plays one clip per
beat thereafter. Each effect gets its own short-lived temporary entity under
the Sound anchor so two of the same sound can overlap, and despawns itself
after six seconds.
What plays when
| Bus event | Clip | Note |
|---|---|---|
| (start) | game.audio.party_loop | looping music bed on the music channel |
roll | game.audio.dice_roll | the die leaving the hand |
moveStep | game.audio.hop | once per tile walked, pitch varied |
resolve | game.audio.coin_gain / coin_loss | by the sign of the coin CHANGE, not the total |
starBought | game.audio.star_buy | the star fanfare; the coin-loss cue is suppressed on that beat |
shop | game.audio.shop_chime | the shop opening |
showdownStart | game.audio.countdown | COIN CLASH opening |
showdownScore | game.audio.grab | rate-limited to one per 0.09 s |
matchEnd | game.audio.win / lose | win when P1 takes the match, shared wins included |
Two details of the bus worth knowing
resolvecarriescoinsandstarsas the player's totals after the effect. The coin cue is picked from the difference against the total this component last saw for that seat, so a red tile plays the loss however rich the player is. The totals are re-baselined onroundStart,turnStartandshowdownEnd, because the showdown bonus is paid outside a resolve.matchEndcarrieswinneras a ranking row andwinnerSeatbeside it, not a seat number.
Mixing
The clips came back from the generator at very different levels — peak from
0.09 (coin_gain) to 1.0 (coin_loss) — and a source's volume is clamped to
1.0 by the mixer, so the loud ones are trimmed down rather than the quiet ones
pushed up. Each clip's figure in TRIM is the peak it contributes to the mix:
0.09 to 0.50, against a bed that peaks at 0.14. Every effect therefore lands
at or above the bed's loudest transient, and the master stays well under
clipping when a loud cue lands on the music.
hop was regenerated: its first generation peaked at 0.003, about 51 dB below
every other effect, and nothing the mixer accepts could make it audible.
Needs
- A
game.rulesmodule in the world (require("game.rules")). - An
AudioListenersomewhere in the scene; the camera inscenes/main.scene/build.luaucarries one. - The eleven clips under
game/audio/.