Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

native: default system_volume=200% on SOF, allow keys to reach 400%

granite-bary-branch confirmed audio works but too quiet — SOF cards
have no Master mixer (so system_volume defaulted to 100), and the
DSP pipeline reserves several dB of headroom. Default to 200% (4×)
for a normal listening level, and let volume-up reach 400% (16×)
for very quiet Chromebook speakers. soft_clip prevents harsh
distortion at high gain.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+21 -12
+21 -12
fedac/native/src/audio.c
··· 1478 1478 } 1479 1479 } 1480 1480 1481 - // Apply system volume (software gain — hardware mixer may not attenuate) 1481 + // Apply system volume (software gain). system_volume can go 1482 + // above 100 on SOF cards where the DSP pipeline has -6dB+ 1483 + // headroom and the amp needs boosting to reach normal levels. 1484 + // -1 means no Master mixer found — treat as 100% baseline. 1482 1485 { 1483 1486 int sv = audio->system_volume; 1484 - // -1 means no Master mixer found (SOF cards) — treat as 100% 1485 1487 if (sv < 0) sv = 100; 1486 - double vol = sv * 0.01; // 0-100 → 0.0-1.0 1487 - // Use squared curve for more natural volume perception 1488 - vol = vol * vol; 1488 + double vol = sv * 0.01; // 0..4 (up to 400% → 16× linear) 1489 + vol = vol * vol; // squared curve 1489 1490 mix_l *= vol; 1490 1491 mix_r *= vol; 1491 1492 } ··· 2478 2479 fprintf(stderr, "[audio] Cannot open mixer\n"); 2479 2480 } 2480 2481 2481 - // Read initial system volume 2482 - audio->system_volume = read_system_volume_card(card_idx); 2483 - fprintf(stderr, "[audio] System volume: %d%%\n", audio->system_volume); 2482 + // Read initial system volume. On SOF cards there's no Master mixer 2483 + // and read_system_volume_card returns -1 — default to 200% so the 2484 + // speaker amp (which has -6dB headroom in the DSP pipeline) has 2485 + // enough gain to be audible at normal listening levels. 2486 + int hw_vol = read_system_volume_card(card_idx); 2487 + audio->system_volume = (hw_vol >= 0) ? hw_vol : 200; 2488 + fprintf(stderr, "[audio] System volume: %d%% (hw=%d)\n", 2489 + audio->system_volume, hw_vol); 2484 2490 2485 2491 // HDMI audio disabled — opening HDMI PCM streams on the same HDA controller 2486 2492 // can exhaust controller streams and cause EIO on capture. ··· 3468 3474 if (hw_vol >= 0) { 3469 3475 audio->system_volume = hw_vol; 3470 3476 } else { 3471 - // No Master mixer — software gain mode 3477 + // No Master mixer — software gain mode (0..400%). 3478 + // 200% is the default boot volume on SOF cards; allow 3479 + // keys to step up to 400 (16× linear) for quiet speakers. 3472 3480 int sv = audio->system_volume; 3473 - if (sv < 0) sv = 100; // first call: default 100% 3474 - if (delta > 0) sv = (sv + 5 > 100) ? 100 : sv + 5; 3475 - else if (delta < 0) sv = (sv - 5 < 0) ? 0 : sv - 5; 3481 + if (sv < 0) sv = 200; 3482 + int step = 10; 3483 + if (delta > 0) sv = (sv + step > 400) ? 400 : sv + step; 3484 + else if (delta < 0) sv = (sv - step < 0) ? 0 : sv - step; 3476 3485 audio->system_volume = sv; 3477 3486 ac_log("[audio] Software volume: %d%%\n", sv); 3478 3487 }