feat: add RMS-based loudness normalization#262
Draft
Philosyang wants to merge 1 commit into
Draft
Conversation
Replace peak-amplitude normalization with RMS-based loudness normalization using BASS ChannelGetLevelEx with the RMS flag. When enabled, all songs are normalized to a -14 dB RMS target so perceived volume is consistent across tracks. - Add LoudnessNormalization toggle to SoundOptions (default off) - Add MeasuredRmsDb cache field to ChartSetting for persistence - Implement RMS scan in BassAudioSample and BassSimpleAudioSample - Pass cached RMS through AudioManager to skip re-measurement - Wire cache read/write in SongDetail and OnlineSongDetail Ref LingFeng-bbben#259
Owner
|
我感觉默认开启,settings不显示,然后替换之前的那个算法会比较好? |
Owner
|
可以加QQ667644338群来讨论下 |
Owner
|
另外希望RMS的部分不要在BassAudioSample以外的地方出现,且仅对谱面track生效(与之前行为一致) |
Author
ok已申请 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace peak-amplitude normalization with RMS-based loudness normalization using BASS ChannelGetLevelEx with the RMS flag. When enabled, all songs are normalized to a -14 dB RMS target so perceived volume is consistent across tracks.
Add LoudnessNormalization toggle to SoundOptions (default off)
Add MeasuredRmsDb cache field to ChartSetting for persistence
Implement RMS scan in BassAudioSample and BassSimpleAudioSample
Pass cached RMS through AudioManager to skip re-measurement
Wire cache read/write in SongDetail and OnlineSongDetail
Ref #259
Hi! 本 PR 实现了 #259 中讨论的 RMS-based loudness normalization,无新增依赖。但是在 merge 之前有几个设计问题想先确认:
1. 替换还是保留 peak normalization?
目前的实现保留了两种方式:原有的 peak normalization 仍为当前默认,RMS normalization 通过
settings.json>Audio下的"LoudnessNormalization": true控制(默认关闭)。我们是让 RMS 替代旧的 peak normalization,还是两者并存,让玩家选择?(例如在游戏内的设置界面中添加对应选项)2. 默认行为
如果两者并存,
LoudnessNormalization应该默认true还是false?3. Settings UI 可见性
目前这个 toggle 只能通过
settings.json手动修改,因为SettingManager对Audio只暴露了Volume子菜单。需要在游戏内 settings UI 中加入这个选项吗?如果需要,放在哪里合适?4. 目标响度值
当前使用 -14 dB RMS 作为 normalization target(参考主流串流平台标准)。是否需要换一个值,或者做成用户可调?
测试结果(使用同一首歌,ffmpeg 降低 10 dB 制作对照组):
开启 normalization 后两首歌的感知音量基本一致。RMS 测量结果会缓存到
ChartSetting(内存变量,不会写入文件),从选曲界面进入歌曲后会跳过重复扫描。