Log inGet started
Package

sunfall.package

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

SunfallAudio

The whole soundscape of Sunfall Ridge as one component. Put it on any one entity of the scene and it does the rest: it reads the run's shared state (sunfall.game, written every frame by the Run component) and the course (sunfall.course) and plays everything the player hears, from the clips in sunfall.package/sounds/. It needs no sibling component and no other setup.

local audioEntity = entity.spawn("audio")
audioEntity.component.add("SunfallAudio", {})

What it plays

LayerWhenHow
Score: music_titletitle, cinematicwarm pads and felt piano, 72 s seamless loop; lifts while the cinematic's title card is up
Title-card swell: sting_swell4.6 s into the cinematicone-shot over the bed
Score: music_flightflightlighter flowing guitar and strings, 126 s loop; thins out as light falls below 0.25
Score: music_duskflight, light < 0.22low drone and slow pulse, 74 s loop; full by light 0.12
High mountain wind: wind_mountaintitle, cinematic, resultsoft breeze bed
Evening ambience: ambience_evening + rare distant birdtitle, cinematic, resultvery sparse
Wind over the wing: wind_body + wind_air_l/wind_air_rflightquiet hiss at 10 m/s to a full roar at 30 m/s; the bright layer rises and brightens with speed (gain and pitch), slow gusting, leans left/right with bank
Variometer: vario_beepflight, climb from +0.2 m/s500 Hz at 2 beeps/s (+0.3 m/s) up to 1200 Hz at 7 beeps/s (+5 m/s); silent between -2.5 and +0.2
Sink tone: vario_sinkflight, sink below -3 m/ssoft low hum, held until the sink eases past -2.5
Thermal: thermal_swellinThermal turns trueone-shot
Raptors: bird_eagle_1, bird_hawk_2, bird_buzzard_3flight, within ~520 m of a thermalspatial, from an emitter circling each thermal at about the pilot's height; calls every 7-15 s, every 3-7 s while circling in that thermal
Endingsstate.result changeslanded: touchdown + sting_landed (sting_landed_best for 3 feathers); outlanding: touchdown + sting_outlanding; crash: crash; dark: sting_dark
UI click: ui_clickevery request eventsoft one-shot

Every bed fades toward its target over 1-2 s, starts from its head when it rises out of silence and stops once faded out, so beds nobody hears cost nothing.

Fields

  • master, music, wind, vario, ambience, effects: levels, 0..1. They multiply each layer's own mix level, and they are read every frame, so a settings slider is heard as it moves. effects covers the touchdown, crash and UI click.
  • listener (default true): when no AudioListener is active, it puts one on the play camera (layers.active.camera.entity) so the birds are placed, and takes it off again when the component goes. A scene that places its own listener keeps it.

Methods

  • report() returns what it is doing now: each bed's gain, target, volume, pitch and the mixer's own report of its voice, the vario's smoothed reading and last beep, and the one-shots played most recently. Tests read it.
  • simulate(state) drives it from a table shaped like Game.state instead of the run's state, and simulate(nil) hands it back. The test bench scenes/audio_test.scene uses it to walk every phase while a real run plays beside it.

The clips

They live in sunfall.package/sounds/, and scenes/audio_test.scene/bake_sounds.luau documents how each was made. The music, stings, wind textures, ambience, birds, thermal swell, touchdown, crash and click were generated with @builtin::services.audio_gen (ElevenLabs), then trimmed, levelled and, for the loops, made seamless with an equal-power tail-into-head crossfade. The vario beep, the sink tone and the crash's low thud were synthesized. Loops are Opus at 160 kbps, the click and vario clips are PCM, and every loop reads seamless on clip:loopSeam().

Glide kit's Glider plays a wind loop of its own. Turn it off (sound = false) where this component is used, so only one wind is heard.