Expand and stage boss encounter

This commit is contained in:
Loïc Wisniewski 2026-09-03 22:00:26 +02:00
commit 66b314f51a
17 changed files with 485 additions and 64 deletions

View file

@ -183,9 +183,32 @@ def explosion(seconds, sub_from, sub_to, roar_seed, debris_level, drive):
return [_saturate(v, drive) * _attack(i, 0.001) for i, v in enumerate(mixed)]
def boss_scream(seconds=1.65):
"""A huge synthetic creature waking: a rough falling throat tone with
an unstable upper rasp. Long enough to carry the reveal shake, without
borrowing a human/animal recording whose licence would need tracking."""
n = int(RATE * seconds)
throat = [0.0] * n
phase = 0.0
for i in range(n):
t = i / n
hz = 118.0 * (52.0 / 118.0) ** (t ** 0.72)
hz *= 1.0 + 0.07 * math.sin(t * math.pi * 17.0)
phase += 2.0 * math.pi * hz / RATE
envelope = min(1.0, t / 0.06) * (1.0 - t) ** 0.75
throat[i] = (math.sin(phase) * 0.75 + math.sin(phase * 2.03) * 0.32
+ math.sin(phase * 3.97) * 0.16) * envelope
rasp_noise = _noise(n, 189, lambda t: 0.34 * (1.0 - t) + 0.025)
rasp = [value * min(1.0, i / (RATE * 0.025)) * _decay(i, n, 1.15) * 0.68
for i, value in enumerate(rasp_noise)]
mixed = _mix(throat, rasp)
return [_saturate(value, 3.2) for value in mixed]
if __name__ == "__main__":
_write("sfx_shot", shot())
_write("sfx_dialog", dialog())
_write("sfx_boss_scream", boss_scream())
# A vessel coming apart: bright, fast, with real low end under it.
_write("sfx_ship_death", explosion(1.45, 260.0, 38.0, 5, 0.16, 2.6))
# A structure: longer, deeper, and it keeps coming down afterwards.