Page 1 of 1

Gain Property for Music Tracks

Posted: Tue Sep 06, 2016 10:37 pm
by MrGrim
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!

Re: Gain Property for Music Tracks

Posted: Wed Sep 07, 2016 12:14 am
by aubergine18
There's a `volume` property in prototypes, for example this from __base__/prototypes/ambient_sounds.lua:

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
    }
  },
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.

Re: Gain Property for Music Tracks

Posted: Wed Sep 07, 2016 3:01 am
by MrGrim
Thanks! I'll give that a try and report.