Add API for mods to change volume/radius of sound effects

Suggestions that have been added to the game.

Moderator: ickputzdirwech

Post Reply
Sachertorte
Inserter
Inserter
Posts: 21
Joined: Wed Sep 06, 2017 2:53 pm
Contact:

Add API for mods to change volume/radius of sound effects

Post by Sachertorte »

TL;DR
Add API for mods to change the volume and radius of sound effects.

What?
The volume of sound effects can currently be changed manually by the user by replacing game files with louder versions of those game files. Mods can also replace sound files.
What mods cannot do is adjust the volume of those sounds in-game, or adjust the radius from which they can be heard.
Why?
Sounds can be heard from different distances - for example, inserters can be heard from a few tiles away, whereas belts can only be heard if you're very close to them - after all, you wouldn't want your eardrums pierced every time you crossed your main bus.

However, I'm not happy with the distribution of sound volumes and sound radii in-game. Take trains for example. When riding a train, I struggle to hear the thrum of the engine, and yet the clack-clack of traversing the track is very loud. I would like to increase the volume of the train engine, and also increase the radius from which the train can be heard - I want to be able to hear these massive engines even when they're off screen!

Currently, mods offer no way to do this, hence my suggestion.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Add API for mods to change volume/radius of sound effects

Post by Rseding91 »

All of that is defined through the prototypes for a given sound :)

The fast transport belt for example has this defined:

Code: Select all

    working_sound =
    {
      sound =
      {
        filename = "__base__/sound/fast-transport-belt.ogg",
        volume = 0.4
      },
      max_sounds_per_type = 3
    },
Additionally the working_sound property supports the following settings:
  • float: apparent_volume
  • uint8: max_sounds_per_type
  • bool: match_progress_to_activity
  • bool: match_volume_to_activity
  • bool: match_speed_to_activity
  • double: audible_distance_modifier
If you want to get ahold of me I'm almost always on Discord.

Bilka
Factorio Staff
Factorio Staff
Posts: 3129
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Add API for mods to change volume/radius of sound effects

Post by Bilka »

Rseding91 wrote: Additionally the working_sound property supports the following settings:
  • float: apparent_volume
  • uint8: max_sounds_per_type
  • bool: match_progress_to_activity
  • bool: match_volume_to_activity
  • bool: match_speed_to_activity
  • double: audible_distance_modifier
What about probability and idle_sound? And are those properties only possible for the working_sound, or also for other sounds, such as vehicle_impact_sound?

To me it seems like there is a "generic" sound that can be defined, like his:

Code: Select all

vehicle_impact_sound =  { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
--or
sound = { filename = "__base__/sound/substation.ogg" },
--or
sound =
{
 filename = "__base__/sound/accumulator-working.ogg",
  volume = 1
},
idle_sound = {
  filename = "__base__/sound/accumulator-idle.ogg",
  volume = 0.4
},
Working_sound uses that "generic" sound, and other properties can only be defined there, right? Or can I use filename directly inside working_sound?

And what volume does this use?

Code: Select all

   
 working_sound =
    {
      sound =
      {
        filename = "__base__/sound/electric-furnace.ogg",
        volume = 0.7
      },
      apparent_volume = 1.5
    },
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Sachertorte
Inserter
Inserter
Posts: 21
Joined: Wed Sep 06, 2017 2:53 pm
Contact:

Re: Add API for mods to change volume/radius of sound effects

Post by Sachertorte »

Apologies for taking so long to reply, I was trying to work out how to exit Vim.

I've just created a mod that adjusts the audible_distance_modifier for locomotives. I set it to 8 just to see what that sounded like, but upon booting the game (0.18.24), I was informed that the audible_distance_modifier can only be used to reduce distances and therefore cannot be set to a value above 1.

That's particularly disappointing for this application, as the end goal of my mod is to increase that distance and that's pretty much it. Just increasing the volume of the working_sound is not good - I don't want to deafen myself, and the sound still appears and fades away almost instantly as a train goes past.

I found a simple sound-based mod (Uranium Geiger by ikornaselur) that plays a sound even at distances by playing the sound from the player. I'd really like to avoid this, if possible - I want the train to feel like it's making the noise.

Weirdly enough, Googling "factorio audible_distance_modifier" leads only to API documentation, FFF341 where Val was playing with pipe attenuation, and this very thread. So it doesn't look like this has been a problem for anyone else. It's entirely possible that the scope of this property has changed since I made this thread three years ago, but is there some way for me to overcome it? If not, may I ask why this hard restriction is in place?

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Add API for mods to change volume/radius of sound effects

Post by Rseding91 »

It works that way because the way sounds work in the game: every frame the game looks around your player for sounds to play. Then using the properties I mentioned before it plays the sound(s) it finds.

Since the area it searches is limited, you can't say "search outside that area" by increasing the range modifier > 1. Every tile increase in that area it has to search is quadratic in the total area it has to search.
If you want to get ahold of me I'm almost always on Discord.

Sachertorte
Inserter
Inserter
Posts: 21
Joined: Wed Sep 06, 2017 2:53 pm
Contact:

Re: Add API for mods to change volume/radius of sound effects

Post by Sachertorte »

That makes sense. Thank you for your response.

I suppose the next best option would be to attempt to duplicate the train's sound. I have a few ideas but they're beyond the scope of a feature request (which it looks like I originally posted in the wrong subforum anyway).

Phil
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sun May 17, 2020 3:38 am
Contact:

Lots of noise

Post by Phil »

I just recently read the Friday Facts where you said that the game had a 15 active sound cap and when you raised it you found it very noisy. I think you should put an option in the settings to allow the game to play every sound within range of your character, or just let you set your own limit if you want the sounds but your computer can't run all of them well, because there's a fascination with how an industrial environment, even light industry, is a cacophony of sounds that dull the senses or become so familiar that you can start to recognize regular sounds within that cacophony. Needless to say, it'd be a fun effect to be able to turn on at will if you want to get a real grasp of the scale of the moving parts around tightly packed factories since the game generally doesn't give players the experience of that sort of audible bombardment you'd get in an actual industrial environment. Just something fun to throw at the senses.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Add API for mods to change volume/radius of sound effects

Post by ssilk »

moved to nearly similar topic - ssilk

See also answer from rseding: there are restrictions.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Lots of noise

Post by Klonan »

Phil wrote:
Sun May 17, 2020 3:52 am
I just recently read the Friday Facts where you said that the game had a 15 active sound cap and when you raised it you found it very noisy. I think you should put an option in the settings to allow the game to play every sound within range of your character, or just let you set your own limit if you want the sounds but your computer can't run all of them well, because there's a fascination with how an industrial environment, even light industry, is a cacophony of sounds that dull the senses or become so familiar that you can start to recognize regular sounds within that cacophony. Needless to say, it'd be a fun effect to be able to turn on at will if you want to get a real grasp of the scale of the moving parts around tightly packed factories since the game generally doesn't give players the experience of that sort of audible bombardment you'd get in an actual industrial environment. Just something fun to throw at the senses.
Its already an option, you can change it in the config files

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Add API for mods to change volume/radius of sound effects

Post by ssilk »

Nice. So I think we can call this implemented, because I think this is no option, that only should be available to more experienced users.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Post Reply

Return to “Implemented Suggestions”