I use mods that add music to the game soundtrack, and one problem is that most music is mixed for a much higher average volume than the vanilla tracks so come through quite loud. Rather than re-encode from a lossy source file (and suffer a generational quality loss) to reduce the volume it would be very helpful to have a "gain" property for the "ambient-sound" data type that ranges from 0.0 to 1.0. On playback the game can simply mix the track in at the specified gain.
This would also be helpful for mods that distribute music that is licensed such that distribution is allowed but modification is not.
Also, please forgive me if this already exists. I could hardly find any documentation on this data type in the API docs.
Thanks!
Gain Property for Music Tracks
Moderator: ickputzdirwech
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
Re: Gain Property for Music Tracks
There's a `volume` property in prototypes, for example this from __base__/prototypes/ambient_sounds.lua:
I've not investigated how the mods add additional music, but if they have a prototype file defining the tracks, then you should be able to add in the volume property to tweak loudness. If you do, it would be worth requesting the mod authors adopt your settings to help normalise the sound volumes.
Code: Select all
{
type = "ambient-sound",
name = "world-ambience-4",
track_type = "interlude",
sound =
{
filename = "__base__/sound/ambient/world-ambience-4.ogg",
volume = 1.2
}
},
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Re: Gain Property for Music Tracks
Thanks! I'll give that a try and report.