From 9012c7f0a85a3a4a0e783c1f841893bae9ed1af2 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 25 Dec 2025 07:55:47 +0000 Subject: [PATCH] Add option for logarithmic volume scaling Introduces a user setting to enable logarithmic (quadratic) volume scaling for more natural audio perception. --- client/components/modals/PlayerSettingsModal.vue | 11 +++++++++++ client/players/LocalAudioPlayer.js | 4 +++- client/store/user.js | 3 ++- client/strings/en-us.json | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/client/components/modals/PlayerSettingsModal.vue b/client/components/modals/PlayerSettingsModal.vue index dfac28cf..b88aa004 100644 --- a/client/components/modals/PlayerSettingsModal.vue +++ b/client/components/modals/PlayerSettingsModal.vue @@ -8,6 +8,12 @@ {{ $strings.LabelUseChapterTrack }} +
+ +
+ {{ $strings.LabelUseLogarithmicVolume }} +
+
@@ -29,6 +35,7 @@ export default { data() { return { useChapterTrack: false, + useLogarithmicVolume: true, jumpValues: [ { text: this.$getString('LabelTimeDurationXSeconds', ['10']), value: 10 }, { text: this.$getString('LabelTimeDurationXSeconds', ['15']), value: 15 }, @@ -57,6 +64,9 @@ export default { setUseChapterTrack() { this.$store.dispatch('user/updateUserSettings', { useChapterTrack: this.useChapterTrack }) }, + setUseLogarithmicVolume() { + this.$store.dispatch('user/updateUserSettings', { useLogarithmicVolume: this.useLogarithmicVolume }) + }, setJumpForwardAmount(val) { this.jumpForwardAmount = val this.$store.dispatch('user/updateUserSettings', { jumpForwardAmount: val }) @@ -71,6 +81,7 @@ export default { }, settingsUpdated() { this.useChapterTrack = this.$store.getters['user/getUserSetting']('useChapterTrack') + this.useLogarithmicVolume = this.$store.getters['user/getUserSetting']('useLogarithmicVolume') this.jumpForwardAmount = this.$store.getters['user/getUserSetting']('jumpForwardAmount') this.jumpBackwardAmount = this.$store.getters['user/getUserSetting']('jumpBackwardAmount') this.playbackRateIncrementDecrement = this.$store.getters['user/getUserSetting']('playbackRateIncrementDecrement') diff --git a/client/players/LocalAudioPlayer.js b/client/players/LocalAudioPlayer.js index 7fc17e7a..a634f6ed 100644 --- a/client/players/LocalAudioPlayer.js +++ b/client/players/LocalAudioPlayer.js @@ -290,7 +290,9 @@ export default class LocalAudioPlayer extends EventEmitter { setVolume(volume) { if (!this.player) return - this.player.volume = volume + const useLogarithmicVolume = this.ctx.$store.getters['user/getUserSetting']('useLogarithmicVolume') + // Apply quadratic curve for more natural volume perception if enabled + this.player.volume = useLogarithmicVolume ? volume * volume : volume } // Utils diff --git a/client/store/user.js b/client/store/user.js index 96e79d12..94aa83f5 100644 --- a/client/store/user.js +++ b/client/store/user.js @@ -18,7 +18,8 @@ export const state = () => ({ authorSortBy: 'name', authorSortDesc: false, jumpForwardAmount: 10, - jumpBackwardAmount: 10 + jumpBackwardAmount: 10, + useLogarithmicVolume: false } }) diff --git a/client/strings/en-us.json b/client/strings/en-us.json index fb2bcb28..2803f021 100644 --- a/client/strings/en-us.json +++ b/client/strings/en-us.json @@ -712,6 +712,7 @@ "LabelUploaderItemFetchMetadataHelp": "Automatically fetch title, author, and series", "LabelUseAdvancedOptions": "Use Advanced Options", "LabelUseChapterTrack": "Use chapter track", + "LabelUseLogarithmicVolume": "Natural volume scaling", "LabelUseFullTrack": "Use full track", "LabelUseZeroForUnlimited": "Use 0 for unlimited", "LabelUser": "User",