# The menu BGM loop, measured from the running game.
#
# 2026-08-30. 240 s parked on the main menu, log-verified: the XMA probe shows
# BGM_103's two waves (3 876 864 / 3 930 112 B) decoding, and NO ADV context
# appears afterwards, so the attract loop never took over.
#
# Capture: --gpu=null --apu=alsa --mute=false, ALSA file tee -> paced pulse
# slave. 265.4 s, 6ch f32 48 kHz, 0.08 % all-channel silence (the recipe
# page's own clean run is 0.31 %).
#
# REFERENCE: BGM_103's two waves dumped from sound.pak and decoded, then
# summed -- they play together (bgm-two-stems.md). Each is 87.744 s.
#
# INSTRUMENT: locate a 30 s slice of the capture inside the wave by envelope
# cross-correlation. CONTROL -- slices cut from the wave itself at 10/45/70 s
# are found at 10.00/45.00/70.00 s.
#
# RESULT 1 -- there is NO SEAM. Zero runs >= 0.3 s below (median - 18 dB) in
# 232 s of menu audio. The 3.4 s near-silence the port measured on its own
# authored loop does not occur in the game.
#
# RESULT 2 -- the game does NOT loop at the wave length.
#   autocorrelation r at lag 87.750 s = -0.009  (four independent windows:
#   -0.0090 / -0.0061 / -0.0067 / -0.0055)
#   autocorrelation top lag = 61.909 s, r = +0.533, harmonic at 123.819 s
#
# RESULT 3 -- offset tracking gives the same number independently, and the
# playback is exactly 1:1.
#
# capture_t   wave_offset   score   step
     40.0        14.07   +0.500  
     45.0        19.07   +0.499    +5.00
     50.0        24.07   +0.497    +5.00
     55.0        29.07   +0.454    +5.00
     60.0        34.07   +0.408    +5.00
     65.0        39.08   +0.420    +5.01
     70.0        44.08   +0.414    +5.00
     75.0        49.08   +0.356    +5.00
     80.0        54.09   +0.347    +5.01
     85.0        28.13   +0.266   -25.96   <- LOW SCORE: slice straddles the wrap, mis-locked
     90.0         2.16   +0.378   -25.97
     95.0         7.16   +0.469    +5.00
    100.0        12.16   +0.486    +5.00
    105.0        17.16   +0.470    +5.00
    110.0        22.16   +0.485    +5.00
    115.0        27.16   +0.433    +5.00
    120.0        32.17   +0.401    +5.01
    125.0        37.17   +0.398    +5.00
    130.0        42.17   +0.425    +5.00
    135.0        47.17   +0.367    +5.00
    140.0        52.18   +0.334    +5.01
    145.0        57.18   +0.331    +5.00
    150.0         0.25   +0.337   -56.93
    155.0         5.25   +0.413    +5.00
    160.0        10.25   +0.453    +5.00
    165.0        15.25   +0.450    +5.00
    170.0        20.25   +0.453    +5.00
    175.0        25.25   +0.439    +5.00
    180.0        30.26   +0.411    +5.01
    185.0        35.26   +0.423    +5.00
    190.0        40.26   +0.427    +5.00
    195.0        45.26   +0.380    +5.00
    200.0        50.27   +0.337    +5.01
    205.0        55.27   +0.368    +5.00
    210.0        29.31   +0.272   -25.96   <- LOW SCORE: slice straddles the wrap, mis-locked
    215.0         3.35   +0.359   -25.96
    220.0         8.35   +0.463    +5.00
    225.0        13.35   +0.437    +5.00
    230.0        18.35   +0.442    +5.00
    235.0        23.35   +0.435    +5.00

# Playback is exactly +5.00 s per 5 s of wall clock -- 1:1, no resampling.
# The wraps, taken across the two low-score straddle points:
#   t=80  54.09  ->  t=90   2.16   : 54.09 + 10 - 61.93 = 2.16
#   t=145 57.18  ->  t=150  0.25   : 57.18 +  5 - 61.93 = 0.25
#   t=205 55.27  ->  t=215  3.35   : 55.27 + 10 - 61.93 = 3.34
# => LOOP LENGTH 61.93 s, three independent wraps, agreeing with the
#    autocorrelation's 61.909 s from a different instrument.
#
# Offsets span 0.25 .. 57.18 s of an 87.744 s wave, so the loop region is
# [~0, 61.93) and the final ~25.8 s of the wave is NEVER PLAYED -- which is
# where bgm-two-stems.md found the fade-out and trailing silence. The game
# loops before the fade, which is why there is no seam.
