{"name":"Arma 3: Sound: cfgSoundShaders","title":"Arma 3: Sound: cfgSoundShaders","type":"topic","url":"https://community.bistudio.com/wiki/Arma_3:_Sound:_cfgSoundShaders","revid":364298,"updated":"2024-05-06T09:38:39Z","aliases":["Arma 3 Sound: cfgSoundShaders"],"markdown":"### SoundShader\n\nThe **SoundShader** within the class *cfgSoundShaders* is the most basic sound entity in the Arma 3 sound engine. Let's look at an example and the parameters.\n\n```cpp\nclass cfgSoundShaders\n{\n    class MX_Closure_SoundShader\n    {\n        samples[] =\n        {\n            { \"pathToYourSound1\", 1 },\n            { \"pathToYourSound2\", 1 },\n            { \"pathToYourSound3\", 1 }\n        };\n        volume = 0.5;\n        frequency = 1;\n        range = 10;\n        rangeCurve[] =\n        {\n            { 0, 1 },\n            { 5, 0.7 },\n            { 10, 0 }\n        };\n        limitation = 0;\n    };\n};\n```\n\n#### samples\n\n| Parameter | Unit/values | Default | Description |\n|---|---|---|---|\n| samples | { [\"path/sound\", p], ... } | none | array containing sound file name with paths and probability values (p) |\n\nHere you define the path to your sound. The number after the path is used in the random sample selection. When a SoundShader with multiple sounds is called one sound is chosen randomly.\nThe bigger the number behind the sound, the higher the chance of the sound being picked. So `{ \"pathToYourSound1\", 10 }` is a lot more likely to be picked than `{ \"pathToYourSound2\", 1 }`.\n\nAlso noteworthy here is that in previous Arma sound configuration we had to make sure that all the probability numbers add up to 1.\nSo if we had two sounds their probabilities had to be 0.5. With the new configuration this is no longer needed.\n\n```cpp\n{ \"pathToYourSound1\", 10 }\n{ \"pathToYourSound2\", 10 }\n```\n\nis the same as\n\n```cpp\n{ \"pathToYourSound1\", 1 }\n{ \"pathToYourSound1\", 1 }\n```\n\nBoth sounds have the same chance of being picked.\n\n#### volume\n\n| Parameter | Unit/values | Default | Description |\n|---|---|---|---|\n| volume | float (0-5) | 1 | basic volume value |\n\nVolume defines how loud the sample is played in relation to 0dBFS - the highest volume value in the digital world. A value of 1 means 100% means 0dbFS. A value of 0.5 means 50% means -6dBFS.\nIf you want to calculate what values to enter here depending on dB, you can use [this calculator](https://www.noisemeters.com/apps/db-calculator/).\n\nAny other percentage to dB calculator will work. Careful though, as you can see on [this site](https://lightmachinery.com/optical-design-center/more-optical-design-tools/percentage-to-db/) signal dB is not equal power dB!\nAlways be sure to calculate with the right dB! To ensure you work with the right dB test this in your calculator: -6dB = 50%, always.\n\n#### frequency\n\n| Parameter | Unit/values | Default | Description |\n|---|---|---|---|\n| frequency | float | 1 | basic pitch value, 1 = no change = normal pitch. Parameter ignored if more than 1 *SoundShaders* in *SoundSet* |\n\nPlayback speed/pitch of the sound. Low number = low pitch, high number = high pitch.\nThis parameter is **ignored** when the *SoundShader* is used together with other *SoundShaders* in a *SoundSet* (which can consist of multiple SoundShaders, more on that later).\n\n#### range\n\n| Parameter | Unit/values | Default | Description |\n|---|---|---|---|\n| range | distance in meters | 0 | radius of circle around sound source where the sound will be played |\n\nThe sound will be played in this radius around the sound source.\nThere is no volume falloff configured yet so without any additional configuration the sound would start playing at full volume as soon as you are within this radius.\n\n#### rangeCurve\n\n| Parameter | Unit/values | Default | Description |\n|---|---|---|---|\n| rangeCurve | {d0,v0}, {d1,v1} | none | array of points or class name defined in **cfgSoundCurves** |\n\nHere you can define the volume falloff depending on distance. The values are given in X,Y pairs. X being the distance, Y being the volume value.\nIn the example the sound will be played at full volume at 0m distance. Note that here relative values (from 0 being o and 1 being 100%) are used.\nAt 5m distance the volume will be 0.7 (70%, -3dB) and at 10m the sound will be silent. You can use hundreds of points to make really smooth curves.\nYou can either use distance values within the range (in the example from 0m to 10m) OR use *relative* range values, 1 being maximum range. So the above example would also work with:\n\n```cpp\nrangeCurve[] =\n{\n    { 0, 1 },\n    { 0.5, 0.7 },\n    { 1, 0 }\n};\n\nrangeCurve = myRangeCurve_001;\n```\n\n**Attention!** In this case `{ 0.5, 0.7 }` means \"at half *range* volume will be 0.7\" and `{ 1, 0 }` means \"at maximum *range* volume will be 0\".\nIn the 2nd example *myRangeCurve_001* has been predefined in cfgSoundCurves which is why we only need to enter a class name here.\n\n**rangeCurve** is pretty awesome because you can combine multiple *SoundShaders* with different *rangeCurves* within one *SoundSet* and play different sounds depending on distance. Imagine you have two SoundShaders:\n\n```cpp\n        // first SoundShader (close sounds)\n        range = 50;\n        rangeCurve[] =\n        {\n            { 0, 1 },\n            { 25, 0.7 },\n            { 50, 0 }\n        };\n\n        // second SoundShader (distant sounds)\n        range = 1800;\n        rangeCurve[] =\n        {\n            { 0, 0.2 },\n            { 25, 0.7 },\n            { 50, 1 },\n            { 1800, 1 }\n        };\n```\n\nThe close sound will start to become quieter over distance and at 50m it will be completely silent.\nThe distant sound starts off quietly and slowly becomes more loud until max volume at 50m. Max volume factor is kept within the SoundShader until 1800m (max distance of second SoundShader).\n\n#### limitation\n\n| Parameter | Unit/values | Default | Description |\n|---|---|---|---|\n| limitation | bool | false | if true -> adds SoundShader to group of SoundShaders which will be limited within the SoundSet |\n\nIf enabled this adds the *SoundShader* to a group of *SoundShaders* which will be limited within the *SoundSet*, explanation of that will be found when we go over *SoundSets*.","sections":[{"heading":"SoundShader","level":3,"markdown":"The **SoundShader** within the class *cfgSoundShaders* is the most basic sound entity in the Arma 3 sound engine. Let's look at an example and the parameters.\n\n```cpp\nclass cfgSoundShaders\n{\n    class MX_Closure_SoundShader\n    {\n        samples[] =\n        {\n            { \"pathToYourSound1\", 1 },\n            { \"pathToYourSound2\", 1 },\n            { \"pathToYourSound3\", 1 }\n        };\n        volume = 0.5;\n        frequency = 1;\n        range = 10;\n        rangeCurve[] =\n        {\n            { 0, 1 },\n            { 5, 0.7 },\n            { 10, 0 }\n        };\n        limitation = 0;\n    };\n};\n```"},{"heading":"samples","level":4,"markdown":"| Parameter | Unit/values | Default | Description |\n|---|---|---|---|\n| samples | { [\"path/sound\", p], ... } | none | array containing sound file name with paths and probability values (p) |\n\nHere you define the path to your sound. The number after the path is used in the random sample selection. When a SoundShader with multiple sounds is called one sound is chosen randomly.\nThe bigger the number behind the sound, the higher the chance of the sound being picked. So `{ \"pathToYourSound1\", 10 }` is a lot more likely to be picked than `{ \"pathToYourSound2\", 1 }`.\n\nAlso noteworthy here is that in previous Arma sound configuration we had to make sure that all the probability numbers add up to 1.\nSo if we had two sounds their probabilities had to be 0.5. With the new configuration this is no longer needed.\n\n```cpp\n{ \"pathToYourSound1\", 10 }\n{ \"pathToYourSound2\", 10 }\n```\n\nis the same as\n\n```cpp\n{ \"pathToYourSound1\", 1 }\n{ \"pathToYourSound1\", 1 }\n```\n\nBoth sounds have the same chance of being picked."},{"heading":"volume","level":4,"markdown":"| Parameter | Unit/values | Default | Description |\n|---|---|---|---|\n| volume | float (0-5) | 1 | basic volume value |\n\nVolume defines how loud the sample is played in relation to 0dBFS - the highest volume value in the digital world. A value of 1 means 100% means 0dbFS. A value of 0.5 means 50% means -6dBFS.\nIf you want to calculate what values to enter here depending on dB, you can use [this calculator](https://www.noisemeters.com/apps/db-calculator/).\n\nAny other percentage to dB calculator will work. Careful though, as you can see on [this site](https://lightmachinery.com/optical-design-center/more-optical-design-tools/percentage-to-db/) signal dB is not equal power dB!\nAlways be sure to calculate with the right dB! To ensure you work with the right dB test this in your calculator: -6dB = 50%, always."},{"heading":"frequency","level":4,"markdown":"| Parameter | Unit/values | Default | Description |\n|---|---|---|---|\n| frequency | float | 1 | basic pitch value, 1 = no change = normal pitch. Parameter ignored if more than 1 *SoundShaders* in *SoundSet* |\n\nPlayback speed/pitch of the sound. Low number = low pitch, high number = high pitch.\nThis parameter is **ignored** when the *SoundShader* is used together with other *SoundShaders* in a *SoundSet* (which can consist of multiple SoundShaders, more on that later)."},{"heading":"range","level":4,"markdown":"| Parameter | Unit/values | Default | Description |\n|---|---|---|---|\n| range | distance in meters | 0 | radius of circle around sound source where the sound will be played |\n\nThe sound will be played in this radius around the sound source.\nThere is no volume falloff configured yet so without any additional configuration the sound would start playing at full volume as soon as you are within this radius."},{"heading":"rangeCurve","level":4,"markdown":"| Parameter | Unit/values | Default | Description |\n|---|---|---|---|\n| rangeCurve | {d0,v0}, {d1,v1} | none | array of points or class name defined in **cfgSoundCurves** |\n\nHere you can define the volume falloff depending on distance. The values are given in X,Y pairs. X being the distance, Y being the volume value.\nIn the example the sound will be played at full volume at 0m distance. Note that here relative values (from 0 being o and 1 being 100%) are used.\nAt 5m distance the volume will be 0.7 (70%, -3dB) and at 10m the sound will be silent. You can use hundreds of points to make really smooth curves.\nYou can either use distance values within the range (in the example from 0m to 10m) OR use *relative* range values, 1 being maximum range. So the above example would also work with:\n\n```cpp\nrangeCurve[] =\n{\n    { 0, 1 },\n    { 0.5, 0.7 },\n    { 1, 0 }\n};\n\nrangeCurve = myRangeCurve_001;\n```\n\n**Attention!** In this case `{ 0.5, 0.7 }` means \"at half *range* volume will be 0.7\" and `{ 1, 0 }` means \"at maximum *range* volume will be 0\".\nIn the 2nd example *myRangeCurve_001* has been predefined in cfgSoundCurves which is why we only need to enter a class name here.\n\n**rangeCurve** is pretty awesome because you can combine multiple *SoundShaders* with different *rangeCurves* within one *SoundSet* and play different sounds depending on distance. Imagine you have two SoundShaders:\n\n```cpp\n        // first SoundShader (close sounds)\n        range = 50;\n        rangeCurve[] =\n        {\n            { 0, 1 },\n            { 25, 0.7 },\n            { 50, 0 }\n        };\n\n        // second SoundShader (distant sounds)\n        range = 1800;\n        rangeCurve[] =\n        {\n            { 0, 0.2 },\n            { 25, 0.7 },\n            { 50, 1 },\n            { 1800, 1 }\n        };\n```\n\nThe close sound will start to become quieter over distance and at 50m it will be completely silent.\nThe distant sound starts off quietly and slowly becomes more loud until max volume at 50m. Max volume factor is kept within the SoundShader until 1800m (max distance of second SoundShader)."},{"heading":"limitation","level":4,"markdown":"| Parameter | Unit/values | Default | Description |\n|---|---|---|---|\n| limitation | bool | false | if true -> adds SoundShader to group of SoundShaders which will be limited within the SoundSet |\n\nIf enabled this adds the *SoundShader* to a group of *SoundShaders* which will be limited within the *SoundSet*, explanation of that will be found when we go over *SoundSets*."}],"categories":["Arma 3: Sound"],"groups":["Configuration"]}