Files
Quadrapassel/docs/AUDIO_VALIDATION.md
Brian Holman a07c41555a Fix target joystick calibration arguments and scene transitions
Avoid a demonstrated CMOC -O2 removed-index-reload error with independent calibration and position pointers. Keep established joystick readiness across menus, stabilize shared fire/keyboard scans, and protect input sampling from IRQ interference.

Ship pristine QUADPSL04.DSK. Native right-port emulated analog/button checks pass for both directions, four lasting T-piece turns, and steering after keyboard resume. Host input/store/rules/video regressions and unchanged memory guards pass. Preserve personal score disks and record physical/128 KB/audio limits.
2026-11-11 14:26:06 -07:00

141 lines
8.1 KiB
Markdown

# Audio routing correction — November 10, 2026
Brian reported constant noise during keyboard play, including while idle. That
is outside the specification: sound should consist of brief event effects with
silence between them. His earlier pacing feedback remains keyboard evidence;
physical joystick testing is still pending.
## Correction
The old code initialized CardGame audio once at startup, then continuously called
`readJoystickPositions`. The public CMOC documentation explicitly states that
analog sound routing shares hardware with joystick measurements. The permitted
CardGame example's initSound.c selects the DAC and enables sound; beep.c does not
close that path on return. This leaves audio routing unmanaged between events.
The game now calls the documented `Player_disableSound()` helper before joystick
sampling and at startup. Each enabled effect calls `initSound()` immediately
before `beep()` and `Player_disableSound()` immediately afterward. This keeps the
speaker path closed while idle and while the joystick selector is being changed.
The implementation uses standard CardGame and bsound APIs only. It installs no
Player IRQ, supplies no custom interrupt/sound driver, and adds no direct hardware
access. The quiet movement volume and existing event pitches/durations are kept.
The half-frequency constants are the same values the previous code obtained by
integer division; gameplay timing, scoring and save format are unchanged.
Public references read through the installed MCP manual:
- `programming-in-c/api.html#api-player-disablesound`: analog-path enable/disable
shares hardware with joystick measurements; link bsound.
- `programming-in-c/api.html#api-beep` and public cardgame.h: initialization,
positive period/duration and bounded volume.
- Public Player.h: standalone enable/disable helpers; Player_init/shutdown are
associated with the optional player/IRQ service, which this game does not use.
- Pierre Sarrazin's local CardGame 0.1.15 initSound.c/beep.c (public-domain
examples) were read for reference. No assembly or register code was copied.
## Actual MCP captures
Official VCC Plus 3.5.5 (48), disposable CoCo 3 / 512 KB workers, stock fast mode.
Each WAV captures 120 emulated fields directly, at 44,100 Hz, PCM16 stereo,
88,651 or 88,652 sample frames. Both channels were checked.
| Context | Result |
| --- | --- |
| MC6809 title idle | Every sample zero |
| MC6809 gameplay idle | Every sample zero in the captured no-event window |
| MC6809 right-move action window | Short effect, peak 1,792 in each channel; 10 changing edges; last 500 ms exactly zero |
| MC6809 idle after movement | Every sample zero |
| MC6809 hard-drop/lock window | Short effect, peak 5,120 in each channel; 10 changing edges; last 500 ms exactly zero |
| MC6809 pause menu idle | Every sample zero |
| MC6809 Sound OFF, following a left-key action | Every sample zero; OFF was also verified on the guest settings screen |
| MC6809 Sound OFF idle | Every sample zero |
| HD6309 gameplay idle, reset emulation mode | Every sample zero |
| HD6309 right-move action window | Short effect, peak 1,792 in each channel; 10 changing edges; last 500 ms exactly zero |
The movement peak is lower than the landing peak, preserving relative volume.
Positive effect captures establish that silent windows are not simply a globally
muted capture endpoint. Captures start after bounded input, so a silent post-key
window alone does not establish whether an earlier very short effect played.
The unchanged baseline disk was also captured. Its sampled idle and post-movement
windows were zero. **The reported continuous noise was not reproduced in the
isolated worker.** The routing defect was corrected from the public contracts
and source usage; confirmation that Brian's actual-app idle noise is gone still
requires retesting that environment. These are direct guest PCM checks, not a
claim of human listening, Mac output-device qualification or a 128 KB pass.
`tools/check_audio.py` checks all PCM channels for exact digital silence, or for
a nonconstant effect with a silent final 500 ms. Example:
```sh
python3 tools/check_audio.py test-output/audio/after-idle-game.wav --expect silent
python3 tools/check_audio.py test-output/audio/after-lock-effect.wav --expect effect
```
Raw WAVs and full receipts remain in ignored test-output/audio/. The MCP baseline
used a freshly built disposable disk. The pre-update local writable image also
contained QPSAVE0.DAT/QPSAVE1.DAT; that original is preserved under ignored
local-media-backups/. A second private copy there replaces only QUAD.BIN with
the corrected executable. Every other file and the DOS boot track were verified
byte-identical. These personal save files are excluded from Git and MCP inputs.
The personal emulator session was not operated or reset.
## Build identity
- Project revision 16, Release, build `CFC0A2F2-9247-4B1C-9CF8-8CC1AFE896B6`.
- Artifact `261716EE-81C8-487D-A7BF-E5C9F51BC044`.
- Binary: 26,370 bytes, SHA-256
`5c9f3be05fde79e09a5a583740e676f2fb06eddc136dd9d419f62f12da6bebfe`.
- Pristine Quadrapassel.DSK: 161,280 bytes, SHA-256
`d23bc2a1aa60970becaf7ff8be064efc8ea47a5043adf9661d9a6c22bcedfd9b`.
- Code/constants end $7AE8; static data end $1318; existing memory checks passed.
- MC6809 run `0B67B031-7CEE-4CD7-98CA-649B295FECB3`.
- HD6309 run `356B3452-D3AA-4EBA-8111-1D41EC9F9277`.
- All owned runs are stopped. No implementation commit or push was requested.
## November 11 — normal-window buzz still reported
Brian confirmed the font candidate buzzes on its title screen before Start,
including after quitting/reopening VCC Plus. The real 512 KB CoCo 3 does not
buzz. During the authorized desktop check, pausing VCC Plus stopped the noise;
Run was then restored without resetting the game or replacing mounted media.
This establishes a normal-window playback symptom, not its cause.
The visible normal setup is MC6809/512 KB at 1x, with an FD-502/floppy controller,
Speech/Sound Cartridge, Orchestra-90 and a stopped Hello World cassette. App
sound is enabled at 50%. Those peripherals differ from the supported disposable
worker; their presence alone does not establish that any cartridge causes the
buzz. The public MCP audio tool captures only the disposable worker, not the
normal window or microphone. No claim of hearing the actual speaker is made.
The new standard candidate reasserts Player_disableSound after joystick button/
position sampling as well as before it. This is a defensive public-library
change, not a demonstrated cure. It adds no custom audio code or hardware access.
Official build 51, project revision 2, run
`0174149F-48E6-4EB6-8D96-BC1BF0BF4C87`: title and gameplay idle captures are
zero in both channels; movement peak 1792 in both channels, nine changing edges,
last 500 ms zero. Each direct stereo capture covers 120 fields; the effect
capture contains 88,651 frames, idle captures 88,652 at 44,100 Hz. Checks pass.
Owned runs are stopped. The normal-window buzz remains unconfirmed fixed and
needs the new candidate retested in that same environment. Full final identity
and preserved-score disk are in TITLE_AND_SCORING_UPDATE.md.
Build 02 changes keyboard/joystick logical handling, not sound APIs. Official
build-53 MC6809/512 KB idle capture remains zero; the positive movement capture
has both-channel peak 7936, ten changing edges and silent final 500 ms. These
120-field captures pass the existing checker. The user-reported normal-window
buzz was still present on build 01 and remains open pending build-02 retest;
the differing emulator versions prevent treating effect peak changes as a
controlled game-volume comparison. See JOYSTICK_FIX.md for the current artifact.
Build 03, official build 53 / revision 3 / MC6809 / 512 KB: title and gameplay
idle are exactly zero in both channels. Movement peak 7936 in each channel,
21 changing edges, final 500 ms zero; 120-field captures pass the checker.
This remains isolated-worker evidence and does not close the normal-window buzz.
Build04 changes only argument addressing after the build03 checks; its final
native analog checks did not recapture audio. Do not label build03's exact PCM
numbers as measured build04 results. The normal-window speaker buzz stays open.