Question about music volume and normalization
See original GitHub issueIs your feature request related to a problem? Please describe. YouTube videos can have audio of varying volumes, as it depends on the person that mixed the audio into the video. This also makes that often, when playing music from YouTube, volume will vary greatly; some songs will be silent and others will suddenly be loud. This results in having to tweak the volume of the music bot often or have each user update the local volume when a new song starts.
Volume normalization such as ReplayGain exists, but, at least that case, is usually performed on existing files and saved into tags, which are then parsed by an audio player. ffmpeg also appears to have some options for normalization, but they appear to be intended mostly as a separate operation as well.
Mumble itself supposedly already supports amplifying the microphone volume of speakers (you can tweak the maximum volume adjustment in the advanced settings), so I’m wondering if there is some kind of solution here, e.g. by letting Mumble somehow automatically amplify the bot’s volume or, alternatively, let botamusique normalize the audio sending it?
Describe the solution you’d like Some sort of normalization for the audio sent by the bot so volume differences from input sources are roughly equalized.
Describe alternatives you’ve considered
Don’t normalize at all, and let the user tweak the bot’s volume via the !volume
command or by setting the local volume.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Actually, I don’t really think mumble does any kind of normalization. I have some experience with the audio core of mumble and I haven’t seen such normalization in the code base of mumble.
We do have an on-the-fly audio level adjustment when sending an audio stream into mumble, which is simply multiplying the audio signal with the volume factor set by
!v
command. But if you want to normalize audio files, we need to analyze the volume peak and the average volume of that file, that is the difficult and time-consuming part.A possible option is we read and analyzing the file while playing it, and gather the volume parameters for the next time this file being played so we know the normalization factor we need. Or we can simply run an analyzing thread in the background to calculate these factors.
You are not the first person asking for this feature, so now I think I should take this idea seriously.
I see what you mean. Normalizing the actual data is indeed an action that can change the original music data. This is also an advantage of the approach ReplayGain takes: analyze the music once, store the needed average dB increase/decrease somewhere (usually in tags), and automatically change the output volume rather than the music itself.
I’m not sure if the Mumble protocol allows changing your own input volume though; the way the Mumble client seems to do this is by having an input amplification that is applied as needed on the microphone input, which I think happens before transmission and by manipulating the input data itself, though I could be wrong.