The splash stops sounding before it ends, so listen earlier

The check asked whether music was still playing four seconds in, and the
score it listens to ends its every voice on a rest - twelve ticks of
silence that hold the logo up while the voices decay. So it was measuring
exactly the quiet the score asks for and calling a perfect tune a failure.

Three seconds instead, which is still twice the second and a half the
silent path holds the logo for, and which is what the check is actually
about: that this is the tune and not the hold.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
Anachronaut
2026-09-06 13:22:56 -04:00
co-authored by Claude Opus 5
parent f351ee8844
commit 4e61158b11
+11 -6
View File
@@ -940,9 +940,14 @@ open('$BUILD/still.pad','wb').write(b'\x00' * 20000)"
--disk "$ROOT/Tests/build/disks/cosmos.img" --ram-disk 2048 \ --disk "$ROOT/Tests/build/disks/cosmos.img" --ram-disk 2048 \
"$BUILD/cosmos.bin" > "$BUILD/splash.out" 2>&1 || true "$BUILD/cosmos.bin" > "$BUILD/splash.out" 2>&1 || true
# The tune is six seconds of ticks. What is checked is that music is still playing well # What is checked is that music is still playing well after a splash that failed to load
# after a splash that failed to load would have given up: the silent path holds the logo # would have given up: the silent path holds the logo for ninety frames, a second and a
# for ninety frames, a second and a half, and then the game starts. # half, and then the game starts. So the late window is at three seconds, twice that.
#
# NOT LATER, because the tune stops sounding before it ends. Its last sequence on every
# voice is a rest, which is what holds the logo up while the voices decay - so a window
# past three and three quarter seconds is measuring the silence the score asks for and
# would fail on a tune that played perfectly.
read -r EARLY LATE <<EOT read -r EARLY LATE <<EOT
$(python3 - "$BUILD/splash.raw" <<'PY2' $(python3 - "$BUILD/splash.raw" <<'PY2'
import struct, sys import struct, sys
@@ -955,13 +960,13 @@ v = struct.unpack("<%dh" % n, d)
def rms(a, b): def rms(a, b):
w = v[a:b] w = v[a:b]
return int((sum(x*x for x in w) / len(w)) ** 0.5) if w else 0 return int((sum(x*x for x in w) / len(w)) ** 0.5) if w else 0
print("%d %d" % (rms(48000, 96000), rms(192000, 240000))) print("%d %d" % (rms(48000, 96000), rms(144000, 168000)))
PY2 PY2
) )
EOT EOT
[ "${EARLY:-0}" -gt 500 ] && [ "${LATE:-0}" -gt 500 ] \ [ "${EARLY:-0}" -gt 500 ] && [ "${LATE:-0}" -gt 500 ] \
&& result ok "a game plays its own music" "still sounding at four seconds, so it is the tune and not the silent hold" \ && result ok "a game plays its own music" "still sounding at three seconds, so it is the tune and not the silent hold" \
|| result no "a game plays its own music" "RMS was $EARLY at one second and $LATE at four" || result no "a game plays its own music" "RMS was $EARLY at one second and $LATE at three"
fi fi
echo echo