xapu answers Opus decode with silence (no sound), and the default 15.6 ms timer step starves the title's audio thread #260

Closed
opened 2026-11-26 04:17:54 +00:00 by github-bot · 5 comments
Owner

@⁠mariuslozo-boop on GitHub · 2026-11-23 22:03 UTC · original

Game and package version: retail title, <package id> 1.0.2.1

GPU and driver: NVIDIA GeForce RTX 5070 Ti (16 GB), 616.92, 32-lane waves

Windows: Windows 11 Pro 26300

XCL: release builds of main. Run with XCL_NETWORK=0. Seen on d4f17ca.

What happens

During the intro, and with the green picture reported separately, the sound is choppy and jerky instead of continuous. XCL's log at start says the console's audio processor and its mixer are taken but do not run:

acphal: ApuCreateHeap(0x1c700000, 0x226e00) – the audio processor's memory is the process's
acphal: SHAPE contexts [0, 0, 0, 0, 350] (they do not run: no audio from the console's mixer)
acphal: audio processor connected (4096 commands, 4096 messages) – commands are acknowledged, nothing runs
acphal: DSP connected (128 streams) – its commands are taken, nothing runs

I have not yet confirmed whether the missing mixer is the cause, or whether it is timing (buffer starvation, the frame clock, CPU load from pipeline builds) in the XAudio2 path the sound does go through.

Plan (claiming this)

I am working on this: find the root cause first and post it here. If it turns out to be the console mixer not running, I will propose a split into small PRs here before writing it, since that is a larger feature.

report.json and xcl.log are not attached because they hold my file paths. I can paste any part that helps. No game files are attached.

Related, not a duplicate: #156 routes chad.dll XDsp to acphal.

AI-assisted: Claude Code (Claude Opus 5.5) wrote this issue from my runs.

**@⁠mariuslozo-boop** on GitHub · 2026-11-23 22:03 UTC · [original](https://github.com/xcl-dev/xcl/issues/260) **Game and package version:** retail title, `<package id>` 1.0.2.1 **GPU and driver:** NVIDIA GeForce RTX 5070 Ti (16 GB), 616.92, 32-lane waves **Windows:** Windows 11 Pro 26300 **XCL:** release builds of main. Run with `XCL_NETWORK=0`. Seen on `d4f17ca`. ### What happens During the intro, and with the green picture reported separately, the sound is choppy and jerky instead of continuous. XCL's log at start says the console's audio processor and its mixer are taken but do not run: ``` acphal: ApuCreateHeap(0x1c700000, 0x226e00) – the audio processor's memory is the process's acphal: SHAPE contexts [0, 0, 0, 0, 350] (they do not run: no audio from the console's mixer) acphal: audio processor connected (4096 commands, 4096 messages) – commands are acknowledged, nothing runs acphal: DSP connected (128 streams) – its commands are taken, nothing runs ``` I have not yet confirmed whether the missing mixer is the cause, or whether it is timing (buffer starvation, the frame clock, CPU load from pipeline builds) in the XAudio2 path the sound does go through. ### Plan (claiming this) I am working on this: find the root cause first and post it here. If it turns out to be the console mixer not running, I will propose a split into small PRs here before writing it, since that is a larger feature. report.json and xcl.log are not attached because they hold my file paths. I can paste any part that helps. No game files are attached. Related, not a duplicate: #156 routes `chad.dll` XDsp to `acphal`. AI-assisted: Claude Code (Claude Opus 5.5) wrote this issue from my runs.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:17:54 +00:00
Author
Owner

@⁠ryosen0 on GitHub · 2026-11-23 22:21 UTC · original

Second machine on this: Ryzen 7 9800X3D, RTX 3060 Ti 8 GB (driver 32.0.16.1742), 32 GB, Windows 11, release 130a143 (main 9ab7d76 + a test-only PR), XCL_NETWORK=0, 90 s run, warm DXIL cache. The menu's audio is choppy here too.

What our run adds to the root-cause question - the sound is not going through the Windows XAudio2 path at all. report.json at the end of the run:

audio: engines 0, mastering_voices 0, source_voices 0,
       xma_voices 0, xma_buffers_decoded 0, opus_voices 0, opus_buffers_decoded 0,
       silent_voices 0, buffers_silenced 0, unsupported_formats [], dropped_flags []

So XAudio2Create is never called by this title: everything audible comes from the title's own engine, and the only XCL-side clock it can see is the acphal channel's audio-frame message (128 samples @ 48 kHz = 2.667 ms). Buffer starvation / decode load in the XAudio2 path can be ruled out for this title; the frame clock and the missing SHAPE mixer are the two suspects left, as you wrote.

One detail in the frame clock worth a look (Channel::pop, hle/acphal.rs): when a frame is late by more than 8 frames (~21 ms), next_frame is floored at now - 8*FRAME, so the clock silently drops the backlog and the title's engine sees time jump. During the menu our GPU is busy (40x "console shaders in the PSO without a translation: mesh pipelines" warnings), so pops can easily be late by that much - each such jump would sound like a skip. A counter of dropped frames / max lateness in the channel would tell whether this actually fires; happy to measure that if it helps your split.

Not claiming the issue - yours. Just a second data point and a pointer.

AI use: GPT-6.2 Astra (API model selector) wrote this comment from our run's report.json and the source; the human contributor checked the numbers.

**@⁠ryosen0** on GitHub · 2026-11-23 22:21 UTC · [original](https://github.com/xcl-dev/xcl/issues/260#issuecomment-7115647014) Second machine on this: Ryzen 7 9800X3D, RTX 3060 Ti 8 GB (driver 32.0.16.1742), 32 GB, Windows 11, release `130a143` (main `9ab7d76` + a test-only PR), `XCL_NETWORK=0`, 90 s run, warm DXIL cache. The menu's audio is choppy here too. What our run adds to the root-cause question - the sound is **not** going through the Windows XAudio2 path at all. `report.json` at the end of the run: ``` audio: engines 0, mastering_voices 0, source_voices 0, xma_voices 0, xma_buffers_decoded 0, opus_voices 0, opus_buffers_decoded 0, silent_voices 0, buffers_silenced 0, unsupported_formats [], dropped_flags [] ``` So `XAudio2Create` is never called by this title: everything audible comes from the title's own engine, and the only XCL-side clock it can see is the acphal channel's audio-frame message (128 samples @ 48 kHz = 2.667 ms). Buffer starvation / decode load in the XAudio2 path can be ruled out for this title; the frame clock and the missing SHAPE mixer are the two suspects left, as you wrote. One detail in the frame clock worth a look (`Channel::pop`, `hle/acphal.rs`): when a frame is late by more than 8 frames (~21 ms), `next_frame` is floored at `now - 8*FRAME`, so the clock silently drops the backlog and the title's engine sees time jump. During the menu our GPU is busy (40x "console shaders in the PSO without a translation: mesh pipelines" warnings), so pops can easily be late by that much - each such jump would sound like a skip. A counter of dropped frames / max lateness in the channel would tell whether this actually fires; happy to measure that if it helps your split. Not claiming the issue - yours. Just a second data point and a pointer. AI use: GPT-6.2 Astra (API model selector) wrote this comment from our run's report.json and the source; the human contributor checked the numbers.
Author
Owner

@⁠mariuslozo-boop on GitHub · 2026-11-23 22:41 UTC · original

Update with the root cause. The choppy sound I reported was not this title. XCL plays no sound at all for it. I am correcting the issue title.

Setup: RTX 5070 Ti, driver 616.92, Ryzen 7 7700X, 32 GB, Windows 11 Pro 26300, release builds of main 9ab7d76, XCL_NETWORK=0.

Measured. A meter on the Windows audio sessions of every output device, read about every 15 ms (30 ms in the last run), over six runs: five of 48 to 112 s on 9ab7d76, and a sixth of 12 s on 9ab7d76 + #283 + #244.

  • The xcl session is open, with a peak of exactly 0 in every sample.
  • A browser playing a video on the same machine at the same time shows sound in its samples (peak 0.54).
  • So what I heard as choppy was most likely that browser.

Root cause: the console's Opus decoder (xapu) is answered with silence.

  • From ~19 s on, the title sends XApuEnqueueCommand Process commands: 960 frames at 48000 Hz, with 80–320 byte inputs starting 0xf8 / 0xfc (20 ms full-band Opus packets, first mono, then stereo). There are 1358 of them in 112 s.
  • hle/acphal.rs XApuEnqueueCommand (~641–661 on 9ab7d76) zeroes the output and reports it decoded.
  • The title never creates XAudio2: report.json shows audio.engines 0, which matches ryosen0's run above. It opens the Windows output device itself and mixes in its own code.

Ruled out for this title, at this stage:

  • The SHAPE mixer. The 350 contexts are allocated and never used: one audio-processor command in 112 s, and no PopMessage / GetNumMessages call at all.
  • The Channel::pop "late by more than 8 frames" floor (the pointer in the comment above). The title never calls it.

A second defect, which will make the sound choppy once it is decoded.

  • XCL's process runs at Windows' default 15.6 ms timer step. The title's decoder thread sleeps a few milliseconds between polls, so it asks for 17.2 packets a second where real time needs 50.
  • With a 1 ms timer step (a temporary test), it asks for exactly 50.0 a second: 302 in 6.04 s.
  • XCL only asks for a fine timer for its own frame clock (d3d12x/frame.rs).

Plan. Two small, generic PRs, in this order:

  1. host: the title runs on a 1 ms timer step, asked for at start and given back at exit (~30 lines). The test measures 50 sleeps of 1 ms; at 15.6 ms a step they take ~780 ms.
  2. xapu: #294 (simnJS) decodes these packets. I will test it on Windows here, on a long run, and report on #294. I also saw stereo packets later in the run: they start 0xfc, are 320 bytes and fill 7,680-byte outputs (about 62 s in). Without item 1, the title on Windows asks for only 17.2 packets a second, so its sound would be choppy there.

No open PR covers the timer step (searched: timer resolution, timeBeginPeriod). #294 covers the decoder.

@⁠ryosen0, could you check whether the choppy menu sound you heard stays when xcl.exe is muted in the Windows volume mixer?

AI-assisted: Claude Code. Claude Fable 5.2 did the investigation and measurements; Claude Opus 5.5 wrote this comment.

**@⁠mariuslozo-boop** on GitHub · 2026-11-23 22:41 UTC · [original](https://github.com/xcl-dev/xcl/issues/260#issuecomment-7116064895) Update with the root cause. The choppy sound I reported was **not** this title. XCL plays **no sound at all** for it. I am correcting the issue title. **Setup:** RTX 5070 Ti, driver 616.92, Ryzen 7 7700X, 32 GB, Windows 11 Pro 26300, release builds of main `9ab7d76`, `XCL_NETWORK=0`. **Measured.** A meter on the Windows audio sessions of every output device, read about every 15 ms (30 ms in the last run), over six runs: five of 48 to 112 s on `9ab7d76`, and a sixth of 12 s on `9ab7d76` + #283 + #244. - The `xcl` session is open, with a peak of exactly 0 in every sample. - A browser playing a video on the same machine at the same time shows sound in its samples (peak 0.54). - So what I heard as choppy was most likely that browser. **Root cause: the console's Opus decoder (`xapu`) is answered with silence.** - From ~19 s on, the title sends `XApuEnqueueCommand` Process commands: 960 frames at 48000 Hz, with 80–320 byte inputs starting `0xf8` / `0xfc` (20 ms full-band Opus packets, first mono, then stereo). There are 1358 of them in 112 s. - `hle/acphal.rs` `XApuEnqueueCommand` (~641–661 on `9ab7d76`) zeroes the output and reports it decoded. - The title never creates XAudio2: `report.json` shows `audio.engines 0`, which matches ryosen0's run above. It opens the Windows output device itself and mixes in its own code. **Ruled out for this title, at this stage:** - **The SHAPE mixer.** The 350 contexts are allocated and never used: one audio-processor command in 112 s, and no `PopMessage` / `GetNumMessages` call at all. - **The `Channel::pop` "late by more than 8 frames" floor** (the pointer in the comment above). The title never calls it. **A second defect, which will make the sound choppy once it is decoded.** - XCL's process runs at Windows' default 15.6 ms timer step. The title's decoder thread sleeps a few milliseconds between polls, so it asks for 17.2 packets a second where real time needs 50. - With a 1 ms timer step (a temporary test), it asks for exactly 50.0 a second: 302 in 6.04 s. - XCL only asks for a fine timer for its own frame clock (`d3d12x/frame.rs`). **Plan.** Two small, generic PRs, in this order: 1. **host:** the title runs on a 1 ms timer step, asked for at start and given back at exit (~30 lines). The test measures 50 sleeps of 1 ms; at 15.6 ms a step they take ~780 ms. 2. **xapu:** #294 (simnJS) decodes these packets. I will test it on Windows here, on a long run, and report on #294. I also saw stereo packets later in the run: they start `0xfc`, are 320 bytes and fill 7,680-byte outputs (about 62 s in). Without item 1, the title on Windows asks for only 17.2 packets a second, so its sound would be choppy there. No open PR covers the timer step (searched: timer resolution, `timeBeginPeriod`). #294 covers the decoder. @⁠ryosen0, could you check whether the choppy menu sound you heard stays when `xcl.exe` is muted in the Windows volume mixer? AI-assisted: Claude Code. Claude Fable 5.2 did the investigation and measurements; Claude Opus 5.5 wrote this comment.
Author
Owner

@⁠mastrr9 on GitHub · 2026-11-23 23:12 UTC · original

Quick coordination pointer linking the two open PRs on this issue (#300 and #294):

  • #300 (kernelx::fine_timer, 0.5 ms resolution + IGNORE_TIMER_RESOLUTION opt-out) confirmed that GTA VI mixes on the CPU and outputs its final mix via Windows Spatial Audio (ISpatialAudioClient) — and two additional Windows testers (#300 and #294 comments) confirmed continuous audio with #300 applied. (Note: #300 currently says Fixes #260, which would auto-close this issue before #294 merges.)
  • #294 decodes xapu Opus packets into p.output, and also plays them directly via a separate XAudio2 console_pcm voice (added because #294 was developed on Wine, where the title's ISpatialAudioClient path wasn't observed). Once #300 + #294 are tested together on Windows, it's worth checking whether p.output already plays cleanly through ISpatialAudioClient so console_pcm doesn't double-play decoded xapu audio on Windows (and can be gated behind an opt-in flag for Wine / SHAPE-only titles).

(AI-assisted — Gemini 4 Neon; code inspection only, no game files)

**@⁠mastrr9** on GitHub · 2026-11-23 23:12 UTC · [original](https://github.com/xcl-dev/xcl/issues/260#issuecomment-7116688215) Quick coordination pointer linking the two open PRs on this issue (#300 and #294): - **#300** (`kernelx::fine_timer`, 0.5 ms resolution + `IGNORE_TIMER_RESOLUTION` opt-out) confirmed that GTA VI mixes on the CPU and outputs its final mix via **Windows Spatial Audio (`ISpatialAudioClient`)** — and two additional Windows testers (#300 and #294 comments) confirmed continuous audio with #300 applied. *(Note: #300 currently says `Fixes #260`, which would auto-close this issue before #294 merges.)* - **#294** decodes `xapu` Opus packets into `p.output`, *and* also plays them directly via a separate XAudio2 `console_pcm` voice (added because #294 was developed on Wine, where the title's `ISpatialAudioClient` path wasn't observed). Once #300 + #294 are tested together on Windows, it's worth checking whether `p.output` already plays cleanly through `ISpatialAudioClient` so `console_pcm` doesn't double-play decoded `xapu` audio on Windows (and can be gated behind an opt-in flag for Wine / SHAPE-only titles). *(AI-assisted — Gemini 4 Neon; code inspection only, no game files)*
Author
Owner

@⁠woreksami on GitHub · 2026-11-24 01:39 UTC · original

Windows test with #300, #468 and #503 together: the sound is still choppy here, and the title feeds xapu only once.

Tested

  • NVIDIA GeForce RTX 3060 8 GB, driver 610.88, 32-lane waves · Intel i9-14900K · 32 GB · Windows 11 (26200) · release build · XCL_NETWORK=0
  • The newer retail title from the README
  • main 508a0c7 + #214 (960162e) + #267 (043d1f7) + #300 (9507d05) + #503 (78f5510) + #468 (0d407cf), with XCL_PSO_WAIT_MS=150 and XCL_DXC_THREADS=4.
  • #300 is active: timer: finest resolution for the title (was 15.62 ms, now 0.50 ms).
  • Listening: the menu narration and the loading-screen music still cut out, in the menus too while they run at a steady 30 fps. The first ~1 s of the loading screen has no sound at all. Same with #300 alone, and with #300 + #468 + #503.
  • xapu is fed once per run: 1 Opus packets decoded (0 errors), 648 frames, 644 non-zero samples at ~18–28 s, and no further line in 2–6 minute runs (four runs, same result). #534 on RDNA3 shows 5,521 packets decoded for comparison, so here the title stops sending Process commands after the first packet; it is not the decoder failing.
  • Ruled out as the cause here: console-only CPU instruction traps. With a counter added locally, MONITORX / MWAITX are emulated ~262,000 times in 110 s (65,000 in the first 3 s, then ~2,400/s) and INSERTQ once; at that rate the traps cost ~1–2 % of a core.

Not tested

  • Main without the PRs on this machine with a listening test; AMD; a meter on the audio session (heard by ear only).

AI use

  • Claude Code with Claude Opus 5.5: built the branches, ran the title, read the logs and wrote this report from those runs; the listening was done by me.
**@⁠woreksami** on GitHub · 2026-11-24 01:39 UTC · [original](https://github.com/xcl-dev/xcl/issues/260#issuecomment-7119312163) Windows test with #300, #468 and #503 together: the sound is still choppy here, and the title feeds `xapu` only once. **Tested** - NVIDIA GeForce RTX 3060 8 GB, driver 610.88, 32-lane waves · Intel i9-14900K · 32 GB · Windows 11 (26200) · release build · `XCL_NETWORK=0` - The newer retail title from the README - `main` 508a0c7 + #214 (960162e) + #267 (043d1f7) + #300 (9507d05) + #503 (78f5510) + #468 (0d407cf), with `XCL_PSO_WAIT_MS=150` and `XCL_DXC_THREADS=4`. - #300 is active: `timer: finest resolution for the title (was 15.62 ms, now 0.50 ms)`. - Listening: the menu narration and the loading-screen music still cut out, in the menus too while they run at a steady 30 fps. The first ~1 s of the loading screen has no sound at all. Same with #300 alone, and with #300 + #468 + #503. - `xapu` is fed **once** per run: `1 Opus packets decoded (0 errors), 648 frames, 644 non-zero samples` at ~18–28 s, and no further line in 2–6 minute runs (four runs, same result). #534 on RDNA3 shows `5,521 packets decoded` for comparison, so here the title stops sending Process commands after the first packet; it is not the decoder failing. - Ruled out as the cause here: console-only CPU instruction traps. With a counter added locally, `MONITORX` / `MWAITX` are emulated ~262,000 times in 110 s (65,000 in the first 3 s, then ~2,400/s) and `INSERTQ` once; at that rate the traps cost ~1–2 % of a core. **Not tested** - Main without the PRs on this machine with a listening test; AMD; a meter on the audio session (heard by ear only). **AI use** - Claude Code with Claude Opus 5.5: built the branches, ran the title, read the logs and wrote this report from those runs; the listening was done by me.
Author
Owner

@⁠woreksami on GitHub · 2026-11-24 02:31 UTC · original

This was closed by the merge of #300. On my machine #300 did not make the sound continuous; #456 did.

  • NVIDIA GeForce RTX 3060 8 GB, driver 610.88 · Intel i9-14900K · 32 GB · Windows 11 (26200) · release builds · the newer retail title from the README, 1.0.2.1.
  • With #300 (9507d05), alone and together with #468 and #503: still choppy, details in my comment above.
  • Adding #456 (017515c) to that tree: the sound was continuous through the menus and the loading screen in three runs (by ear). Report: https://github.com/ivall/xcl/pull/456#issuecomment-7119946326
  • Caveat from that report: the two trees also differ by #451 and #572, and I have not tested #456 alone on main.

So for anyone still hearing choppy sound on current main: #456 is the one to try.

AI use: Claude Code with Claude Opus 5.5 wrote this from my test runs; the listening was done by me.

**@⁠woreksami** on GitHub · 2026-11-24 02:31 UTC · [original](https://github.com/xcl-dev/xcl/issues/260#issuecomment-7120234261) This was closed by the merge of #300. On my machine #300 did not make the sound continuous; #456 did. - NVIDIA GeForce RTX 3060 8 GB, driver 610.88 · Intel i9-14900K · 32 GB · Windows 11 (26200) · release builds · the newer retail title from the README, 1.0.2.1. - With #300 (9507d05), alone and together with #468 and #503: still choppy, details in my comment above. - Adding #456 (017515c) to that tree: the sound was continuous through the menus and the loading screen in three runs (by ear). Report: https://github.com/ivall/xcl/pull/456#issuecomment-7119946326 - Caveat from that report: the two trees also differ by #451 and #572, and I have not tested #456 alone on `main`. So for anyone still hearing choppy sound on current `main`: #456 is the one to try. AI use: Claude Code with Claude Opus 5.5 wrote this from my test runs; the listening was done by me.
This discussion has been locked. Commenting is limited to contributors.
No description provided.