Files
OpenFrontIO/tests/client/sound
Evan bb5e7dc954 Apply perceptual curve to volume sliders (#4272)
## Problem

Players reported having to turn the volume slider down to ~20% before
noticing any change in loudness.

The sliders fed their linear 0–1 position straight to Howler's
`volume()`, which is linear amplitude gain. Human loudness perception is
roughly logarithmic, so the top ~80% of the slider all sounds nearly
identical — the classic linear-fader problem.

## Fix

Square the slider position into a perceptual (audio-taper) gain inside
`SoundManager`. The stored setting and the displayed `%` remain the
intuitive linear slider position; only the gain handed to Howler is
curved.

| Slider | Old gain (linear) | New gain (x²) |
|--------|-------------------|---------------|
| 100%   | 1.00              | 1.00          |
| 90%    | 0.90              | 0.81          |
| 80%    | 0.80              | 0.64          |
| 50%    | 0.50              | 0.25          |
| 20%    | 0.20              | 0.04          |

Lowering the slider from 100→80 now produces an audible drop instead of
nothing until ~20%.

## Notes

- Quadratic (x²) was chosen as a balanced, conservative taper. Cubic
(x³) would make the top-end drop-off even more immediate if preferred.
- Existing saved settings are unaffected; the same slider position will
simply sound slightly quieter, which is the intended correction.

## Tests

Updated `SoundManager.test.ts` to assert the curved gain and added a
dedicated test locking in the top-of-range behavior. All 18 tests pass.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14 09:12:26 -07:00
..