diff --git a/session-logs/2026-03-20-session.md b/session-logs/2026-03-20-session.md index 60e1fe8..5eeb12d 100644 --- a/session-logs/2026-03-20-session.md +++ b/session-logs/2026-03-20-session.md @@ -638,3 +638,224 @@ Tested GrepAI with three semantic searches — all returned relevant results wit 3. **GrepAI re-index** — After major file moves, GrepAI watcher should pick up changes automatically, but verify with `grepai status` 4. **Remaining root docs** — Could further organize CATALOG_*.md, CREDENTIAL_*.md, etc. if desired 5. **scripts/README.md** — May need update since many scripts moved out + +--- + +## Update: 19:30 — Lenovo Legion Pro 7 Sound Quality Fix (CachyOS/Linux) + +### Session Summary + +Diagnosed and partially fixed terrible speaker sound quality on Lenovo Legion Pro 7 16IAX10H (acg-guru-5070) running CachyOS Linux. Root cause: kernel using legacy HDA driver instead of Intel SOF (Sound Open Firmware), leaving the Awinic AW88399 smart amplifier speakers running without DSP processing. On Windows, Dolby Atmos / Nahimic provides this processing. Created modprobe config to force SOF driver, rebuilt initramfs — pending reboot to test. + +### Hardware Details + +- **Laptop:** Lenovo Legion Pro 7 16IAX10H (ASUS, DMI product: 83F5) +- **Audio Controller:** Intel Corporation 800 Series ACE (Audio Context Engine) rev 10 + - PCI: `80:1f.3` + - PCI Subsystem: Lenovo `3d6c` +- **Audio Codec:** Realtek ALC287 + - Codec Subsystem ID: `0x17aa3906` + - Outputs: 0x14 (Speaker), 0x17 (Bass Speaker), 0x21 (Headphone) + - Inputs: 0x12 (Internal Mic), 0x19 (External Mic) +- **Smart Amplifier:** Awinic AW88399 (kernel module `snd_soc_aw88399` loaded but NOT active) + - Library module: `snd_soc_aw88395_lib` + - These are DSP-driven speakers designed to be tuned by firmware — running "raw" without DSP sounds flat/terrible +- **NVIDIA Audio:** GB205 High Definition Audio Controller (HDMI audio, card 0) +- **Webcam:** Integrated Camera (V4L2) + +### Problem Statement + +Sound quality on built-in speakers is significantly worse on Linux compared to Windows. Thin, flat, no bass, lacking clarity. On Windows, Dolby Atmos / Nahimic / Lenovo Vantage provides DSP processing through the AW88399 smart amp firmware. On Linux, none of this exists. + +### Diagnosis — Step by Step + +#### 1. PipeWire/EasyEffects Configuration (from lost previous session) + +EasyEffects 8.1.6 was already installed (from a previous session that was lost due to unsaved `/save` before reboot). Previous session had: +- Installed EasyEffects: `pacman -S --noconfirm easyeffects` (snapshot 40, 18:35:09) +- Installed LV2 plugins: `pacman -S --noconfirm lsp-plugins-lv2 calf zam-plugins-lv2 mda.lv2` (snapshot 42-43, 18:35:21-24) +- Created "Legion-Speakers" preset with bass enhancer, 10-band EQ, loudness, limiter +- Configured autostart: `~/.config/autostart/com.github.wwmm.easyeffects.desktop` + +#### 2. Audio Routing Was Broken + +**Finding:** EasyEffects was running (PID 34011) and its virtual sink existed (node 68), but audio was NOT routing through it. + +``` +Default Sink: 800 Series ACE (Audio Context Engine) Analog Stereo (node 50) ← WRONG +Easy Effects Sink: node 68 ← existed but unused +``` + +All apps were sending audio directly to hardware, completely bypassing EasyEffects. + +**Fix:** `wpctl set-default 68` — set EasyEffects Sink as default output. + +**Persistence:** WirePlumber automatically saved to `~/.local/state/wireplumber/default-nodes`: +``` +[default-nodes] +default.configured.audio.sink=easyeffects_sink +``` + +#### 3. EasyEffects Preset Was Too Conservative + +Original "Legion-Speakers" preset: +- Boosted 30Hz (+6dB), 60Hz (+5dB) — **completely wasted** since laptop speakers can't reproduce anything below ~150-200Hz +- Modest boosts at 120Hz (+3), 250Hz (+1), 8kHz (+2), 16kHz (+3) +- Loudness compensation at -14dB +- Limiter at -1dB threshold + +**Created "Legion-Speakers-v2" preset** at `~/.local/share/easyeffects/output/Legion-Speakers-v2.json` with: +- **High-pass filter at 60Hz** (x2 slope) — stops wasting energy on inaudible frequencies +- **15-band EQ** targeting frequencies the speakers CAN reproduce: + - 150Hz +4dB, 250Hz +6dB, 400Hz +3dB (perceived bass/warmth) + - 800Hz -1dB (reduce boxiness) + - 1.5kHz +2dB, 3.5kHz +3dB, 5kHz +4dB, 7kHz +3dB (clarity/presence) + - 10kHz +5dB, 14kHz +4dB hi-shelf (air/sparkle) + - 2.5kHz -2dB narrow Q (reduce harshness/tinny quality) +- **Bass Enhancer:** amount=12, floor=120Hz, scope=200Hz (generates harmonics that speakers CAN play) +- **Exciter:** amount=6, scope=4kHz (high frequency harmonic generation) +- **Crossfeed:** fcut=700, feed=4.5 (subtle stereo blending for closely-spaced laptop speakers) +- **Loudness compensation:** ISO226:2003, volume=-20dB (more aggressive) +- **4-band multiband compressor:** + - Band 0 (<250Hz): ratio 3:1, threshold -16dB, makeup +4dB + - Band 1 (250-1500Hz): ratio 2.5:1, threshold -14dB, makeup +2dB + - Band 2 (1.5-5kHz): ratio 2:1, threshold -12dB, makeup +3dB + - Band 3 (5kHz+): ratio 2:1, threshold -12dB, makeup +4dB + - Output gain: +6dB +- **Limiter:** ALR enabled, x2 oversampling, threshold -1dB + +**User reported only "slight" difference** — confirmed EasyEffects alone can't compensate for missing DSP firmware. + +#### 4. Root Cause: Wrong Audio Driver + +**Critical finding:** The kernel was using `snd_hda_intel` (legacy HDA driver) instead of `snd_sof_pci_intel_mtl` (Sound Open Firmware). + +Evidence: +``` +# Driver in use +/sys/bus/pci/devices/0000:80:1f.3/driver -> snd_hda_intel + +# DSP driver selection: 0 = auto, chose legacy +/sys/module/snd_intel_dspcfg/parameters/dsp_driver = 0 + +# Both modules available +Kernel modules: snd_sof_pci_intel_mtl, snd_hda_intel +``` + +**Why this matters:** +- Without SOF, the Intel ACE DSP hardware sits idle +- The AW88399 smart amplifier module is loaded (`snd_soc_aw88399`) but NOT active — zero kernel messages about it +- The ALC287 codec picked a generic fallback fixup: `picked fixup for PCI SSID 17aa:0000` (should be `17aa:3906`) +- The speakers run in "dumb" analog mode without any DSP tuning + +#### 5. SOF Firmware Status + +- **Package:** `sof-firmware 2025.12.2-1` — already installed +- **Firmware files available:** + - `/lib/firmware/intel/sof-ipc4/arl/sof-arl.ri` (Arrow Lake) + - `/lib/firmware/intel/sof-ipc4/arl-s/sof-arl-s.ri` (Arrow Lake-S) + - HDA-generic topologies: `sof-hda-generic-ace1-*.tplg` (ACE1 = Arrow Lake) +- **AW88399 topology:** No specific AW88399 topology file found — may use generic HDA topology + +### Fix Applied (Pending Reboot) + +#### Force SOF Driver + +Created `/etc/modprobe.d/sof-force.conf`: +``` +options snd_intel_dspcfg dsp_driver=3 +``` + +Parameter values: 0=auto, 1=legacy, 2=SST, 3=SOF, 4=AVS + +#### Rebuilt Initramfs + +```bash +sudo mkinitcpio -P +``` + +Both kernels rebuilt: +- `linux-cachyos` (6.19.9-1-cachyos) +- `linux-cachyos-lts` (6.18.19-1-cachyos-lts) + +Limine boot entries updated automatically. + +#### Rollback Plan + +If SOF driver breaks audio after reboot: +1. Boot into LTS kernel from Limine menu +2. Or boot a btrfs snapshot (8 snapshots available in Limine) +3. Remove the config: `sudo rm /etc/modprobe.d/sof-force.conf && sudo mkinitcpio -P` + +### ALSA Mixer State (Reference) + +All levels verified at maximum before EasyEffects testing: +``` +Master Playback Volume: 87/87 (0dB) +Speaker Playback Volume: 87/87 (0dB) — unmuted +Bass Speaker Playback Switch: on,on +PCM Playback Volume: 255/255 (0dB) +``` + +### Audio Pipeline (Current — PipeWire) + +``` +Server: PipeWire 1.6.2 (PulseAudio compat 15.0.0) +Sample: float32le 2ch 48000Hz + +Devices: + Card 0: HDA NVidia (GB205, HDMI audio) + Card 1: HDA Intel PCH (800 Series ACE, ALC287) + +Sinks: + 50: 800 Series ACE Analog Stereo (hardware) + 68: Easy Effects Sink (virtual, set as default) + +Audio chain: App → EasyEffects Sink (68) → bass_enhancer → exciter → equalizer → + crossfeed → loudness → multiband_compressor → limiter → Hardware (50) +``` + +### Key Technical Details for Forum Post + +1. **Laptop:** Lenovo Legion Pro 7 16IAX10H (DMI: 83F5) +2. **Audio hardware:** Intel 800 Series ACE + Realtek ALC287 + Awinic AW88399 smart amp +3. **OS:** CachyOS (Arch-based), kernel 6.19.9-1-cachyos +4. **Bootloader:** Limine 10.8.5 +5. **Problem:** `snd_intel_dspcfg` auto-detection (dsp_driver=0) selects legacy `snd_hda_intel` instead of `snd_sof_pci_intel_mtl` +6. **AW88399 driver loaded but inactive** — no DSP processing for smart amp speakers +7. **ALC287 fixup wrong:** Kernel matches `17aa:0000` (generic) instead of proper SSID `17aa:3906` +8. **Fix:** Force SOF via modprobe: `options snd_intel_dspcfg dsp_driver=3` +9. **EasyEffects** can partially compensate but cannot replace hardware DSP processing +10. **SOF firmware package:** `sof-firmware 2025.12.2-1` has ARL firmware and ACE1 topologies + +### Files Created/Modified + +- `/etc/modprobe.d/sof-force.conf` — force SOF driver (created) +- `/home/guru/.local/share/easyeffects/output/Legion-Speakers-v2.json` — aggressive EQ preset (created) +- `/home/guru/.local/state/wireplumber/default-nodes` — default sink set to easyeffects_sink (modified by wpctl) +- `/boot/*/initramfs-linux-cachyos` — rebuilt with SOF config +- `/boot/*/initramfs-linux-cachyos-lts` — rebuilt with SOF config +- `/boot/limine.conf` — updated by mkinitcpio (auto) + +### Packages Already Installed (from lost session) + +- `easyeffects` 8.1.6-1.1 +- `lsp-plugins-lv2` (LV2 audio plugins) +- `calf` (Calf Studio Gear audio plugins) +- `zam-plugins-lv2` (ZamAudio LV2 plugins) +- `mda.lv2` (MDA LV2 plugins) +- `sof-firmware` 2025.12.2-1 (was already installed) + +### Pending/Incomplete + +1. **REBOOT REQUIRED** — SOF driver change won't take effect until reboot +2. **Post-reboot verification:** + - Check `cat /sys/module/snd_intel_dspcfg/parameters/dsp_driver` = 3 + - Check `lspci -v -s 80:1f.3` shows `Kernel driver in use: snd_sof_pci_intel_mtl` + - Check `journalctl -k | grep -i "sof\|aw88"` for firmware loading + - Check `wpctl status` for new device names + - Test actual sound quality +3. **If SOF works but AW88399 still inactive** — may need Option B: load amp calibration data, check for missing topology +4. **If SOF breaks audio** — rollback via snapshot or remove `/etc/modprobe.d/sof-force.conf` +5. **Forum post** — document full fix once verified working, post to community.azcomputerguru.com +6. **EasyEffects may need reconfiguration** after SOF switch — device names/IDs will change