Prototype/Sound: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Created page with "== Basics == Prototype type: '''sound''' Specifies a sound that can be used with https://lua-api.factorio.com/latest/Concepts.html#SoundPath during runtime. == Mandatory pro...")
 
m (typo)
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Basics ==
{{Prototype parent}}
Prototype type: '''sound'''
Specifies a sound that can be used with https://lua-api.factorio.com/latest/Concepts.html#SoundPath during runtime.


Specifies a sound that can be used with https://lua-api.factorio.com/latest/Concepts.html#SoundPath during runtime.
{{Prototype TOC|sound}}


== Mandatory properties ==
== Mandatory properties ==


=== type ===
{{Prototype property|type|[[Types/string|string]]}}
'''Type''': [[Types/string]]
 
Must be "sound".
Must be "sound".


=== name ===
{{Prototype property|name|[[Types/string|string]]}}
'''Type''': [[Types/string]]
Name of the sound. Must be unique. Used as a https://lua-api.factorio.com/latest/Concepts.html#SoundPath.
 
Name of the sound. Must be unique. Used in https://lua-api.factorio.com/latest/Concepts.html#SoundPath.


== Optional properties ==
== Optional properties ==


=== category ===
{{Prototype property|category|[[Types/string|string]]|"game-effect"|optional=true}}
'''Type''': [[Types/string]]
One of "game-effect", "gui-effect", "ambient", "environment", "walking", "alert" and "wind".


'''Default''': "game-effect"
This defines which slider in the sound settings affects the volume of this sound. Furthermore, some sound types are mixed differently than others, e.g. zoom level effects are applied.[https://forums.factorio.com/viewtopic.php?p=527778#p527778]  
 
One of "game-effect", "gui-effect", "environment", "walking" and "alert".
 
=== aggregation ===
'''Type''': [[Types/table]]


{{Prototype property|aggregation|[[Types/table|table]]|optional=true}}
Table with the following members:
Table with the following members:
* max_count - [[Types/uint32]] - Mandatory.
* max_count - [[Types/uint32|uint32]] - Mandatory.
* progress_threshold - [[Types/float]] - Optional. - Default: 1.0 - If count already playing is true, this will determine maximum progress when instance is counted toward playing sounds.
* progress_threshold - [[Types/float|float]] - Optional. - Default: 1.0 - If count already playing is true, this will determine maximum progress when instance is counted toward playing sounds.
* remove - [[Types/bool]] - Mandatory.
* remove - [[Types/bool|bool]] - Mandatory.
* count_already_playing - [[Types/bool]] - Optional. - Default: false - If true already playing sounds are taken into account when checking maxCount.
* count_already_playing - [[Types/bool|bool]] - Optional. - Default: false - If true already playing sounds are taken into account when checking maxCount.


=== audible_distance_modifier ===
{{Prototype property|allow_random_repeat|[[Types/bool|bool]]|false|optional=true}}
'''Type''': [[Types/double]]


'''Default''': 1.0
{{Prototype property|audible_distance_modifier|[[Types/double|double]]|1.0|optional=true}}
 
=== variations ===
'''Type''': [[Types/table]] of [[Types/table]]s


{{Prototype property|variations|[[Types/table|table]] (array) of [[Types/table|table]]s|optional=true}}
Array of tables with the following members:
Array of tables with the following members:
* filename - [[Types/FileName]] - Mandatory.
* filename - [[Types/FileName|FileName]] - Mandatory. Supported sound file formats are <code>.ogg</code>, <code>.wav</code> and <code>.voc</code>.
* volume - [[Types/float]] - Optional. - Default: 1.0
* volume - [[Types/float|float]] - Optional. - Default: 1.0
* preload - [[Types/bool]] - Optional.
* preload - [[Types/bool|bool]] - Optional.
 
* speed - [[Types/float|float]] - Optional. - Default: 1.0 - Speed must be >= 1 / 64. This sets both min and max speed.
=== filename ===
* min_speed - [[Types/float|float]] - Optional. Not loaded if speed is present. - Default: 1.0 - Speed must be >= 1 / 64.
'''Type''': [[Types/FileName]]
* max_speed - [[Types/float|float]] - Mandatory if min_speed is present, otherwise not loaded. - Default: 1.0 - Must be >= min_speed.


{{Prototype property|filename|[[Types/FileName|FileName]]|optional=true}}
Mandatory if <code>variations</code> is not given.
Mandatory if <code>variations</code> is not given.


=== volume ===
Support sound file formats are <code>.ogg</code>, <code>.wav</code> and <code>.voc</code>.
'''Type''': [[Types/float]]


'''Default''': 1.0
{{Prototype property|volume|[[Types/float|float]]|1.0|optional=true}}
Only loaded if <code>variations</code> is not given.


{{Prototype property|preload|[[Types/bool|bool]]|optional=true}}
Only loaded if <code>variations</code> is not given.
Only loaded if <code>variations</code> is not given.


=== preload ===
{{Prototype property|speed|[[Types/float|float]]|1.0|optional=true}}
'''Type''': [[Types/bool]]
Only loaded if <code>variations</code> is not given. Speed must be >= 1 / 64. This sets both min and max speed.


Only loaded if <code>variations</code> is not given.
{{Prototype property|min_speed|[[Types/float|float]]|1.0|optional=true}}
Only loaded if <code>variations</code> is not given. Not loaded if speed is present. Speed must be >= 1 / 64.
 
{{Prototype property|max_speed|[[Types/float|float]]|1.0|optional=true}}
Only loaded if <code>variations</code> is not given. Mandatory if min_speed is present, otherwise not loaded. Must be >= min_speed.

Revision as of 19:06, 20 October 2021

Prototype definitions » Prototype/Sound


Specifies a sound that can be used with https://lua-api.factorio.com/latest/Concepts.html#SoundPath during runtime.


Prototype/Sound — sound
name::string
type::string
aggregation::table (optional)
allow_random_repeat::bool (optional)
audible_distance_modifier::double (optional)
category::string (optional)
filename::FileName (optional)
max_speed::float (optional)
min_speed::float (optional)
preload::bool (optional)
speed::float (optional)
variations::table (array) of tables (optional)
volume::float (optional)

Mandatory properties

type

Type: string
Must be "sound".

name

Type: string
Name of the sound. Must be unique. Used as a https://lua-api.factorio.com/latest/Concepts.html#SoundPath.

Optional properties

category

Type: string
Default: "game-effect"
One of "game-effect", "gui-effect", "ambient", "environment", "walking", "alert" and "wind".

This defines which slider in the sound settings affects the volume of this sound. Furthermore, some sound types are mixed differently than others, e.g. zoom level effects are applied.[1]

aggregation

Type: table
Table with the following members:

  • max_count - uint32 - Mandatory.
  • progress_threshold - float - Optional. - Default: 1.0 - If count already playing is true, this will determine maximum progress when instance is counted toward playing sounds.
  • remove - bool - Mandatory.
  • count_already_playing - bool - Optional. - Default: false - If true already playing sounds are taken into account when checking maxCount.

allow_random_repeat

Type: bool
Default: false

audible_distance_modifier

Type: double
Default: 1.0

variations

Type: table (array) of tables
Array of tables with the following members:

  • filename - FileName - Mandatory. Supported sound file formats are .ogg, .wav and .voc.
  • volume - float - Optional. - Default: 1.0
  • preload - bool - Optional.
  • speed - float - Optional. - Default: 1.0 - Speed must be >= 1 / 64. This sets both min and max speed.
  • min_speed - float - Optional. Not loaded if speed is present. - Default: 1.0 - Speed must be >= 1 / 64.
  • max_speed - float - Mandatory if min_speed is present, otherwise not loaded. - Default: 1.0 - Must be >= min_speed.

filename

Type: FileName
Mandatory if variations is not given.

Support sound file formats are .ogg, .wav and .voc.

volume

Type: float
Default: 1.0
Only loaded if variations is not given.

preload

Type: bool
Only loaded if variations is not given.

speed

Type: float
Default: 1.0
Only loaded if variations is not given. Speed must be >= 1 / 64. This sets both min and max speed.

min_speed

Type: float
Default: 1.0
Only loaded if variations is not given. Not loaded if speed is present. Speed must be >= 1 / 64.

max_speed

Type: float
Default: 1.0
Only loaded if variations is not given. Mandatory if min_speed is present, otherwise not loaded. Must be >= min_speed.