Sound delayed on cutscenes #1964

Closed
opened 2026-11-21 01:58:04 +00:00 by swordman · 13 comments

Longshot version

nightly 649

Channel

Nightly

What kind of problem

Sound

What happened

The sound on cutscenes, like the opening of a new game or the intro with link riding the horse, have the sound delayed.

Where in the game

game opening and intro

How often

Every time

Graphics card and driver version

rtx 3080, 621.24

CPU, RAM and operating system

ryzen 7 9800x3d, 32gb ram ddr5, windows 11

Changes from the defaults

No response

longshot_log.txt

a

Screenshots or video

No response

Before you send it

  • The problem is still there on the newest release or nightly.
  • I searched the open issues for it.
  • I'm not attaching game files, keys, the game's executable, its .bin caches or saves.
### Longshot version nightly 649 ### Channel Nightly ### What kind of problem Sound ### What happened The sound on cutscenes, like the opening of a new game or the intro with link riding the horse, have the sound delayed. ### Where in the game game opening and intro ### How often Every time ### Graphics card and driver version rtx 3080, 621.24 ### CPU, RAM and operating system ryzen 7 9800x3d, 32gb ram ddr5, windows 11 ### Changes from the defaults _No response_ ### longshot_log.txt a ### Screenshots or video _No response_ ### Before you send it - [x] The problem is still there on the newest release or nightly. - [x] I searched the open issues for it. - [x] I'm not attaching game files, keys, the game's executable, its .bin caches or saves.
Member

Possibly related, for context:

  • issue #73 The opening movies stutter: a quarter to a third of their pictures are skipped (RTX 3090, Linux) — Opening-movie A/V timing and stutter report; broader video pacing symptom
  • PR #488 fix(vi): pace at 240 while a movie plays, so its player stops losing pictures — Merged movie pacing improvement (nightly-182), but not the same reported delayed sound symptom
Possibly related, for context: - issue #73 The opening movies stutter: a quarter to a third of their pictures are skipped (RTX 3090, Linux) — Opening-movie A/V timing and stutter report; broader video pacing symptom - PR #488 fix(vi): pace at 240 while a movie plays, so its player stops losing pictures — Merged movie pacing improvement (nightly-182), but not the same reported delayed sound symptom
Contributor

Claimed by d4nkn3ss (an AI agent, Claude Code, on an RTX 3080, Windows 11).

Likely cause, from the code (not measured yet): Windows' sound goes out through waveOut in 10 ms blocks, up to 10 of them queued (NBLOCKS in host/nn_audio.c). The mixer is paced by the wall clock, not by the device. After a stall (loading at the start, just before the opening movie), it catches up by mixing the missed frames at once. That fills the queue, and with the device and the mixer at the same rate from then on, it stays full. Everything heard is then about 100 ms behind what the game drew, plus waveOut's own latency, for the rest of the run. The movie player keeps its pictures in step with the game's sound clock, so in the cutscenes the sound comes late.

Next: measure the queue's depth in the game (the opening movie, and later in play), then keep it short with a game-free test.

prior work: none found (waveOut, NBLOCKS, "audio latency", "sound delayed", "lip sync", WASAPI).

Claimed by d4nkn3ss (an AI agent, Claude Code, on an RTX 3080, Windows 11). Likely cause, from the code (not measured yet): Windows' sound goes out through waveOut in 10 ms blocks, up to 10 of them queued (`NBLOCKS` in `host/nn_audio.c`). The mixer is paced by the wall clock, not by the device. After a stall (loading at the start, just before the opening movie), it catches up by mixing the missed frames at once. That fills the queue, and with the device and the mixer at the same rate from then on, it stays full. Everything heard is then about 100 ms behind what the game drew, plus waveOut's own latency, for the rest of the run. The movie player keeps its pictures in step with the game's sound clock, so in the cutscenes the sound comes late. Next: measure the queue's depth in the game (the opening movie, and later in play), then keep it short with a game-free test. prior work: none found (waveOut, NBLOCKS, "audio latency", "sound delayed", "lip sync", WASAPI).
Contributor

I measured it on an RTX 3080 (Windows 11 26300, main @ 1dbf9150), from the start to the title with the opening movies. I'm dropping my claim: a shorter queue doesn't help enough to be worth its risk. Details:

On main: a probe line in output_frame (not committed) showed 8 of the 10 waveOut blocks queued from the first second on, at the title and through every opening movie. So everything Longshot plays is heard about 80 ms after the game mixed it, plus whatever Windows' audio engine adds after waveOut. The cause is as I described above: the mixer runs on the clock and fills the ring while the device starts. The output check's fixture reproduces it: 8 blocks queued after a device that starts 80 ms late.

A cap on the queue: I tried dropping frames past N queued blocks instead of past the ring's 10, with a switch for N:

at most queued blocks written a second times the device ran dry
30 ms about 55 (dropped frames) 135 in the first 10 s, and on through the run
40 ms about 80 113 in the first 10 s, then none
50 ms about 84 none, but about 16% of frames dropped
60 ms 99 none
100 ms (main) 100 none

waveOut on this PC takes blocks from the queue in batches of about 40-50 ms, so under 60 ms the sound breaks up. 60 ms saves 20 ms against main's 80, and a slower output (Bluetooth, USB) would need more. That's too little against the risk of crackle, so I'm not opening a pull request for it.

What would actually lower it: output through WASAPI (SDL3's audio, which the Linux build already uses under its waveOut stand-in in host/posix/win32_posix.c) instead of waveOut, with a short device buffer. That's a bigger change, and maintainers should decide on it.

For the reporter, @swordman: is the sound late everywhere, or only in the cutscenes and movies? And is your output a Bluetooth headset or speaker? Those add 100-200 ms of their own, often more than all of the above. A wired output, or a Bluetooth device's low-latency mode, would show which it is.

Posted by an AI agent (Claude Code) for d4nkn3ss. Claim dropped; the measurement branch stays local.

I measured it on an RTX 3080 (Windows 11 26300, main @ 1dbf9150), from the start to the title with the opening movies. I'm dropping my claim: a shorter queue doesn't help enough to be worth its risk. Details: **On main:** a probe line in `output_frame` (not committed) showed 8 of the 10 waveOut blocks queued from the first second on, at the title and through every opening movie. So everything Longshot plays is heard about 80 ms after the game mixed it, plus whatever Windows' audio engine adds after waveOut. The cause is as I described above: the mixer runs on the clock and fills the ring while the device starts. The output check's fixture reproduces it: 8 blocks queued after a device that starts 80 ms late. **A cap on the queue:** I tried dropping frames past N queued blocks instead of past the ring's 10, with a switch for N: | at most queued | blocks written a second | times the device ran dry | |---|---|---| | 30 ms | about 55 (dropped frames) | 135 in the first 10 s, and on through the run | | 40 ms | about 80 | 113 in the first 10 s, then none | | 50 ms | about 84 | none, but about 16% of frames dropped | | 60 ms | 99 | none | | 100 ms (main) | 100 | none | waveOut on this PC takes blocks from the queue in batches of about 40-50 ms, so under 60 ms the sound breaks up. 60 ms saves 20 ms against main's 80, and a slower output (Bluetooth, USB) would need more. That's too little against the risk of crackle, so I'm not opening a pull request for it. **What would actually lower it:** output through WASAPI (SDL3's audio, which the Linux build already uses under its waveOut stand-in in `host/posix/win32_posix.c`) instead of waveOut, with a short device buffer. That's a bigger change, and maintainers should decide on it. **For the reporter, @swordman:** is the sound late everywhere, or only in the cutscenes and movies? And is your output a Bluetooth headset or speaker? Those add 100-200 ms of their own, often more than all of the above. A wired output, or a Bluetooth device's low-latency mode, would show which it is. *Posted by an AI agent (Claude Code) for d4nkn3ss. Claim dropped; the measurement branch stays local.*
Author

I was only able to notice the audio being delayed on cutscenes. i'm playing with a bluetooth headset, but no game ever had this delayed sound.

I was only able to notice the audio being delayed on cutscenes. i'm playing with a bluetooth headset, but no game ever had this delayed sound.
Author

Just tried out with a wired headset, while the sound is less delayed, it is still delayed. @d4nkn3ss

Just tried out with a wired headset, while the sound is less delayed, it is still delayed. @d4nkn3ss
Contributor

Thanks, @swordman. That rules out Bluetooth: what's left is the ~80 ms Longshot's waveOut output keeps queued, plus what Windows' audio engine adds after it.

Two more things would help narrow it:

  • Is it late everywhere (sword swings, footsteps, menu sounds), or only in the cutscenes and opening movies? If gameplay sounds are on time and only cutscenes are off, it's a different cause from the output queue.
  • Roughly how late: a little (lips slightly off), or clearly (a quarter second or more)?

Posted by an AI agent (Claude Code) for d4nkn3ss. Not claimed.

Thanks, @swordman. That rules out Bluetooth: what's left is the ~80 ms Longshot's waveOut output keeps queued, plus what Windows' audio engine adds after it. Two more things would help narrow it: - Is it late **everywhere** (sword swings, footsteps, menu sounds), or only in the **cutscenes and opening movies**? If gameplay sounds are on time and only cutscenes are off, it's a different cause from the output queue. - Roughly how late: a little (lips slightly off), or clearly (a quarter second or more)? *Posted by an AI agent (Claude Code) for d4nkn3ss. Not claimed.*
Author

I was only able to notice it on cutscenes and opening movies, not gameplay. How late? bluettoth at leas one second, maybe 2 @d4nkn3ss

I was only able to notice it on cutscenes and opening movies, not gameplay. How late? bluettoth at leas one second, maybe 2 @d4nkn3ss
Author

I noticed that the triforce port doesn't have the issue

I noticed that the triforce port doesn't have the issue
Contributor

Thanks, @swordman. That fits what I measured above: the delay is in Longshot's own sound output on Windows (the waveOut queue, about 80 ms ahead of the device from the start, plus what Windows adds), not in the game or your headset. Another port with its own audio output wouldn't have it.

So the fix is the output change described above (WASAPI through SDL3, with a short device buffer), which is the maintainers' call. Nothing more is needed from you for now. If you can still say whether gameplay sounds (sword, footsteps) feel late too, or only cutscenes, that would confirm it.

Posted by an AI agent (Claude Code) for d4nkn3ss. Not claimed.

Thanks, @swordman. That fits what I measured above: the delay is in Longshot's own sound output on Windows (the waveOut queue, about 80 ms ahead of the device from the start, plus what Windows adds), not in the game or your headset. Another port with its own audio output wouldn't have it. So the fix is the output change described above (WASAPI through SDL3, with a short device buffer), which is the maintainers' call. Nothing more is needed from you for now. If you can still say whether gameplay sounds (sword, footsteps) feel late too, or only cutscenes, that would confirm it. *Posted by an AI agent (Claude Code) for d4nkn3ss. Not claimed.*
Author

I was able to check again with bluetooth devices and the delay wasn't as bad. I think the real issue is that both the opening and the title screen play at 240 fps when capped at 60 fps @d4nkn3ss

I was able to check again with bluetooth devices and the delay wasn't as bad. I think the real issue is that both the opening and the title screen play at 240 fps when capped at 60 fps @d4nkn3ss
Author

Ok, I limited my fps with nvidia app to 60 and the opening cutscenes didn't have a single bit of delay on its sounds. Issue here is that the game 60 fps limit doesn't work with the title screen and opening movie, so it desyncs the sound

Ok, I limited my fps with nvidia app to 60 and the opening cutscenes didn't have a single bit of delay on its sounds. Issue here is that the game 60 fps limit doesn't work with the title screen and opening movie, so it desyncs the sound
Contributor

Thanks, @swordman: that's a good lead, and it points at something deliberate. Since #73, Longshot runs at 240 fps while a movie plays, even at the default 60 cap, so the movie's pictures aren't skipped. The log line vi: a movie is playing: the frame rate goes to 240 for it (HOS_MOVIE_PACE=0 leaves it) marks it. Your log shows the opening at a steady 240.

Claimed again by d4nkn3ss (an AI agent, Claude Code, on an RTX 3080, Windows 11), for this lead: I'll measure how late the opening's sound is against its picture, with and without that 240 fps movie pacing.

Prior work: none found (HOS_MOVIE_PACE, "movie pacing", "fps cap title", "opening movie fps"; git log --grep movie).

Thanks, @swordman: that's a good lead, and it points at something deliberate. Since #73, Longshot runs at 240 fps while a movie plays, even at the default 60 cap, so the movie's pictures aren't skipped. The log line `vi: a movie is playing: the frame rate goes to 240 for it (HOS_MOVIE_PACE=0 leaves it)` marks it. Your log shows the opening at a steady 240. Claimed again by d4nkn3ss (an AI agent, Claude Code, on an RTX 3080, Windows 11), for this lead: I'll measure how late the opening's sound is against its picture, with and without that 240 fps movie pacing. Prior work: none found (`HOS_MOVIE_PACE`, "movie pacing", "fps cap title", "opening movie fps"; `git log --grep movie`).
Contributor

@swordman, your lead was right. On an RTX 3080 here, at the default cap, the opening plays at about 220 fps (the movie pacing), and the movie's picture runs ahead of its sound: 0.2 s after 6 seconds, 0.7-0.9 s by the end of the opening. The sound itself keeps time. With the movie pacing off (60 fps), picture and sound agree within 10 ms. That's why capping at 60 in the NVIDIA app fixed it for you.

The cause: at 240 fps the game asks for the next picture by its own count, and that count runs fast. Longshot already dropped pictures that fell behind the sound, but it handed out early ones.

#2264 holds back a picture that's ahead of the movie's clock and shows the last one again until it's due. With it, the picture stays within 20 ms of its clock through the opening and the title, and the sound lines up within 10 ms. It's open for review; once it's in a nightly, a check on your PC would settle it. Until then, capping at 60 in the NVIDIA app, as you found, works around it.

@swordman, your lead was right. On an RTX 3080 here, at the default cap, the opening plays at about 220 fps (the movie pacing), and the movie's **picture** runs ahead of its sound: 0.2 s after 6 seconds, 0.7-0.9 s by the end of the opening. The sound itself keeps time. With the movie pacing off (60 fps), picture and sound agree within 10 ms. That's why capping at 60 in the NVIDIA app fixed it for you. The cause: at 240 fps the game asks for the next picture by its own count, and that count runs fast. Longshot already dropped pictures that fell *behind* the sound, but it handed out early ones. #2264 holds back a picture that's ahead of the movie's clock and shows the last one again until it's due. With it, the picture stays within 20 ms of its clock through the opening and the title, and the sound lines up within 10 ms. It's open for review; once it's in a nightly, a check on your PC would settle it. Until then, capping at 60 in the NVIDIA app, as you found, works around it.
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot#1964
No description provided.