Skip to content

Add exponential volume curve with configurable dB range#231

Open
W-Floyd wants to merge 3 commits into
CarlosDerSeher:developfrom
W-Floyd:feat/volume-curve
Open

Add exponential volume curve with configurable dB range#231
W-Floyd wants to merge 3 commits into
CarlosDerSeher:developfrom
W-Floyd:feat/volume-curve

Conversation

@W-Floyd

@W-Floyd W-Floyd commented Jun 5, 2026

Copy link
Copy Markdown

Used https://www.dr-lex.be/info-stuff/volumecontrols.html for reference. For my cheap passive speakers I find a value of 40dB to be good.


  • Adds an exponential volume curve to the software volume mixer so the slider feels perceptually linear (instead of very quiet for the start of the range and loud until the top)
  • The dB range is configurable at runtime (0–90 dB) via a slider in the DSP settings web UI and persisted to NVS

@CarlosDerSeher CarlosDerSeher changed the base branch from master to develop June 5, 2026 21:47
@W-Floyd W-Floyd marked this pull request as draft June 5, 2026 23:15
@W-Floyd

W-Floyd commented Jun 5, 2026

Copy link
Copy Markdown
Author

Tests failed, my bad. I'll review and update.

W-Floyd and others added 3 commits June 5, 2026 20:25
Maps slider position [0,1] to amplitude using y = a·exp(b·x) where
a = 10^(-dB_range/20), giving perceptually linear loudness. Default
range is 60 dB (SNAPCLIENT_VOLUME_CURVE_DB_RANGE in menuconfig).

When db_range = 0 the curve is bypassed entirely (linear passthrough,
y = x). Above zero a linear roll-off to ROLLOFF_THRESHOLD (0.1)
ensures true silence at slider = 0% with a smooth join.

The dB range is persisted in NVS via dsp_processor_settings and
exposed through the JSON settings API. dsp_processor carries no
dependency on dsp_processor_settings — persistence is the
settings layer's responsibility (in dsp_settings_set_from_json).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a Volume Curve slider (0–90 dB) to the DSP settings page and
wires it end-to-end: getter on dsp_processor, always-present field in
the capabilities JSON, URL_t key buffer grown to 32 bytes to fit the
param name, and a queue handler in http_server_task that routes the
value through dsp_settings_set_from_json for apply + NVS persistence.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CONFIG_SNAPCLIENT_VOLUME_CURVE_DB_RANGE depends on USE_DSP_PROCESSOR in
Kconfig, so it is undefined in the default build. Gate the log message that
references it behind CONFIG_SNAPCLIENT_USE_SOFT_VOL, matching the pattern
already used in dsp_processor.c.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@W-Floyd W-Floyd force-pushed the feat/volume-curve branch from 75e2002 to c6cb985 Compare June 6, 2026 01:26
@W-Floyd W-Floyd marked this pull request as ready for review June 6, 2026 01:26
@W-Floyd

W-Floyd commented Jun 8, 2026

Copy link
Copy Markdown
Author
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant