Gain Property for Music Tracks

Suggestions that have been added to the game.

Moderator: ickputzdirwech

User avatar
MrGrim
Fast Inserter
Fast Inserter
Posts: 244
Joined: Sat Apr 09, 2016 7:58 pm
Contact:

Gain Property for Music Tracks

Post 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!
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Gain Property for Music Tracks

Post 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.
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.
User avatar
MrGrim
Fast Inserter
Fast Inserter
Posts: 244
Joined: Sat Apr 09, 2016 7:58 pm
Contact:

Re: Gain Property for Music Tracks

Post by MrGrim »

Thanks! I'll give that a try and report.
Post Reply

Return to “Implemented Suggestions”