{"name":"Arma 3: Sound: Filters","title":"Arma 3: Sound: Filters","type":"topic","url":"https://community.bistudio.com/wiki/Arma_3:_Sound:_Filters","revid":338010,"updated":"2023-02-23T21:11:13Z","aliases":["Arma 3 Sound: Filters"],"markdown":"### Distance Frequency Attenuation\n\nEvery sound in the game is attenuated by a frequency Low Pass Filter, the frequency cutoff changes with distance.\n\nDefault filter is configured in **CfgSoundGlobals**, however it is possible to define a custom distance attenuation filter for each SoundSet using parameter *distanceFilter*.\n\nAll Distance Frequency Attenuation Filters must be configured in the base class **CfgDistanceFilters**.\n\n| Parameter | Unit/values | Default | Description |\n|---|---|---|---|\n| *type* | Fitler Type name | \"lowPassFilter\" | - type of filter (note: currently, there only Low Pass Filter is possible) |\n| *minCutoffFrequency* | [Hz] | 300 | - minimal cutoff frequency (see: [Cutoff Frequency](https://en.wikipedia.org/wiki/Cutoff_frequency) on Wikipedia)) |\n| *qFactor* | float (0..1) | 1 | - slope of attenuation curve in frequency spectrum (see [Q factor](https://en.wikipedia.org/wiki/Q_factor) on Wikipedia |\n| *innerRange* | [m] | 100 | - radius of sphere with sound source in its' center<br>- within innerRange distance, no filter is applied |\n| *range* | [m] | 1500 | - radius of sphere with sound source in its' center<br>- outside the range distance, cutoff frequency of filtering stops at minCutoffFrequency |\n| *powerFactor* | (0..100) | 2 | - relationship between cutoff frequency and distance<br>- higher value means faster attanuation |\n\n```cpp\nclass CfgDistanceFilters\n{\n    class defaultDistanceFreqAttenuationFilter\n    {\n        type = \"lowPassFilter\";\n        minCutoffFrequency = 150;\n        qFactor = 1;\n        innerRange = 10;\n        range = 1000;\n        powerFactor = 32;\n    };\n};\n```\n\n### Sound Effects\n\n*Sound Effects* is an older Arma 3 audio feature which handles sound filtering of a specific group of sounds, like radio protocol, underwater, or interior attenuation.\n\n#### Attenuation Effects\n\nAll attenuation effects have to be configured within class **AttenuationsEffects** (base class **CfgSoundEffects**).\n\nIt is represented by class containing predefined filter chain (*2x4 band equalizer + echo*), which is applied on specific groups of sounds witch are considered to come \"from outside\" of a vehicle or building.\n\n> [!NOTE]\n> - Configuration for vehicles is handled by parameter *attenuationEffectType* within the vehicle configuration class. It links the vehicle to a specific attenuation class ( e.g.: attenuationEffectType = \"CarAttenuation\";\n> - A special case is attenuation of sounds related to building interiors, there is no parameter that defines which attenuation class should be used, the expected class name is hard-coded instead: *HouseAttenuation*\n\n```cpp\nclass CfgSoundEffects\n{\n    class AttenuationsEffects\n    {\n        class HouseAttenuation\n        {\n            class Equalizer0\n            {\n                center[] = { 50, 600, 2000, 6000 };  // 20 - 20000Hz\n                bandwidth[] = {1, 2, 2, 2 };         // 0.1 and 2.0\n                gain[] = { db-3, db-1, db-5, db-8 }; // 0.126 - 7.94; +/- 18dB\n            };\n            class Equalizer1\n            {\n                center[] = { 60, 500, 3000, 15000 }; // 20 - 20000Hz\n                bandwidth[] = {2, 2, 2, 2 };         // 0.1 and 2.0\n                gain[] = { db0, db0, db0, db0 };     // 0.126 - 7.94; +/- 18dB\n            };\n            class Echo\n            {\n                WetDryMix = 0.1;   // 0 - 1\n                Feedback = 0.01;   // 0 - 1\n                Delay = 50;        // 1 - 2000\n            };\n        };\n    };\n};\n```\n\n#### Special Filters\n\nSpecial Filters are used to filter sounds within specific gameplay conditions like underwater or in an unconscious state.\n\nThere are three hard-coded classes that are expected by the audio engine (with different, predefined filter chains): *UnderWaterEffects*, *UnconsciousStateEffect*, *RadioFilterEffects*\n\nAll of following have to be configured in base class **CfgSoundEffects**.\n\n##### Underwater Filters\n\n```cpp\nclass CfgSoundEffects\n{\n    class UnderWaterEffects\n    {\n        class Mono\n        {\n            // 0m - unchanged sound\n            // 1m - below surface level all sounds are mixed into mono\n            distance = 1;\n        };\n        class Equalizer\n        {\n            // in range [0 - 3] equalizer pars are linearly interpolated from neutral values to set\n            distance = 3;\n            // Equalizer\n            center[] = { 100, 800, 2000, 10000 };    // frequencies\n            bandwidth[] = { 2.0, 2.0, 2.0, 2.0 };    // must be between 0.1 and 2.0\n            gain[] = { db3, db0, db-15, db-18 };    // +/- 18dB\n        };\n    };\n};\n```\n\n##### Unconscious State Effect\n\n```cpp\nclass CfgSoundEffects\n{\n    class UnconsciousStateEffect\n    {\n        // linear interpolation ... Echo0 * t + (Echo1 - Echo0), t = [0 - 1]\n        class Echo0\n        {\n            WetDryMix = 0.25;   // 0 - 1\n            Feedback = 0.15;     // 0 - 1\n            Delay = 50;        // 1 - 2000\n        };\n        class Echo1\n        {\n            WetDryMix = 0.5;    // 0 - 1\n            Feedback = 0.2;     // 0 - 1\n            Delay = 100;      // 1 - 2000\n        };\n        class Equalizer0\n        {\n            center[] = { 100, 800, 2000, 10000 }; // frequencies\n            bandwidth[] = { 1.0, 1.0, 1.0, 1.0 }; // must be between 0.1 and 2.0\n            gain[] = { db0, db-5, db-10, db-10 }; // +/- 18dB\n        };\n        class Equalizer1\n        {\n            center[] = { 100, 800, 2000, 10000 };    // frequencies\n            bandwidth[] = { 2.0, 2.0, 2.0, 2.0 }; // must be between 0.1 and 2.0\n            gain[] = { db0, db-10, db-18, db-18 }; // +/- 18dB\n        };\n    };\n};\n```\n\n##### Radio Protocol Filters\n\n```cpp\nclass CfgSoundEffects\n{\n    class RadioFilterEffects\n    {\n        class Part0\n        {\n            // Equalizer\n            center[] = { 370, 900, 6000, 10000 };    // frequencies\n            bandwidth[] = { 1, 2, 1, 1.2 };            // must be between 0.1 and 2.0\n            gain[] = { db0, db4, db4, db5 };        // +/- 18dB\n            // Limiter\n            lim_limit = 1;\n            lim_attack = 5;\n            lim_release = 50;\n            enabled[] = { true, false, true };    // equalizer, limiter, convert to 8bit\n        };\n        class Part1\n        {\n            // low pass filter\n            filter_cut_off = 650;\n            /* Filter radian frequency calculated as (2 * sin(pi * (desired filter cutoff frequency) / sampleRate)).\n            The frequency must be greater than or equal to 0 and less than or equal to XAUDIO2_MAX_FILTER_FREQUENCY\n            frequency == 11025, cuttoff > 1837 = 1 */\n            filter_one_over_Q = 0.5;\n            /* 0 - 1, Reciprocal of Q factor. Controls how quickly frequencies beyond Frequency are dampened.\n            Larger values result in quicker dampening while smaller values cause dampening to occur more gradually */\n            filter_enabled = true;\n        };\n        class Part2\n        {\n            // Equalizer\n            center[] = { 100, 250, 900, 5000 };        // 20 - 2000Hz\n            bandwidth[] = {2, 1.9, 2, 2 };            // 0.1 and 2.0\n            gain[] = { db-18, db-18, db4, db-3 };    // 0.126 - 7.94; +/- 18dB\n            // Compressor\n            comp_threshold = db0;\n            comp_ratio = 0.27;          // 1:1\n            comp_attack = 1;        // milliseconds\n            comp_relase = 100;        // milliseconds\n            // Limiter\n            lim_limit = db-18;\n            lim_attack = 1;\n            lim_release = 500;\n            enabled[] = { true, false, false };   // equalizer, compressor, limiter\n        };\n    };\n};\n```","sections":[{"heading":"Distance Frequency Attenuation","level":3,"markdown":"Every sound in the game is attenuated by a frequency Low Pass Filter, the frequency cutoff changes with distance.\n\nDefault filter is configured in **CfgSoundGlobals**, however it is possible to define a custom distance attenuation filter for each SoundSet using parameter *distanceFilter*.\n\nAll Distance Frequency Attenuation Filters must be configured in the base class **CfgDistanceFilters**.\n\n| Parameter | Unit/values | Default | Description |\n|---|---|---|---|\n| *type* | Fitler Type name | \"lowPassFilter\" | - type of filter (note: currently, there only Low Pass Filter is possible) |\n| *minCutoffFrequency* | [Hz] | 300 | - minimal cutoff frequency (see: [Cutoff Frequency](https://en.wikipedia.org/wiki/Cutoff_frequency) on Wikipedia)) |\n| *qFactor* | float (0..1) | 1 | - slope of attenuation curve in frequency spectrum (see [Q factor](https://en.wikipedia.org/wiki/Q_factor) on Wikipedia |\n| *innerRange* | [m] | 100 | - radius of sphere with sound source in its' center<br>- within innerRange distance, no filter is applied |\n| *range* | [m] | 1500 | - radius of sphere with sound source in its' center<br>- outside the range distance, cutoff frequency of filtering stops at minCutoffFrequency |\n| *powerFactor* | (0..100) | 2 | - relationship between cutoff frequency and distance<br>- higher value means faster attanuation |\n\n```cpp\nclass CfgDistanceFilters\n{\n    class defaultDistanceFreqAttenuationFilter\n    {\n        type = \"lowPassFilter\";\n        minCutoffFrequency = 150;\n        qFactor = 1;\n        innerRange = 10;\n        range = 1000;\n        powerFactor = 32;\n    };\n};\n```"},{"heading":"Sound Effects","level":3,"markdown":"*Sound Effects* is an older Arma 3 audio feature which handles sound filtering of a specific group of sounds, like radio protocol, underwater, or interior attenuation."},{"heading":"Attenuation Effects","level":4,"markdown":"All attenuation effects have to be configured within class **AttenuationsEffects** (base class **CfgSoundEffects**).\n\nIt is represented by class containing predefined filter chain (*2x4 band equalizer + echo*), which is applied on specific groups of sounds witch are considered to come \"from outside\" of a vehicle or building.\n\n> [!NOTE]\n> - Configuration for vehicles is handled by parameter *attenuationEffectType* within the vehicle configuration class. It links the vehicle to a specific attenuation class ( e.g.: attenuationEffectType = \"CarAttenuation\";\n> - A special case is attenuation of sounds related to building interiors, there is no parameter that defines which attenuation class should be used, the expected class name is hard-coded instead: *HouseAttenuation*\n\n```cpp\nclass CfgSoundEffects\n{\n    class AttenuationsEffects\n    {\n        class HouseAttenuation\n        {\n            class Equalizer0\n            {\n                center[] = { 50, 600, 2000, 6000 };  // 20 - 20000Hz\n                bandwidth[] = {1, 2, 2, 2 };         // 0.1 and 2.0\n                gain[] = { db-3, db-1, db-5, db-8 }; // 0.126 - 7.94; +/- 18dB\n            };\n            class Equalizer1\n            {\n                center[] = { 60, 500, 3000, 15000 }; // 20 - 20000Hz\n                bandwidth[] = {2, 2, 2, 2 };         // 0.1 and 2.0\n                gain[] = { db0, db0, db0, db0 };     // 0.126 - 7.94; +/- 18dB\n            };\n            class Echo\n            {\n                WetDryMix = 0.1;   // 0 - 1\n                Feedback = 0.01;   // 0 - 1\n                Delay = 50;        // 1 - 2000\n            };\n        };\n    };\n};\n```"},{"heading":"Special Filters","level":4,"markdown":"Special Filters are used to filter sounds within specific gameplay conditions like underwater or in an unconscious state.\n\nThere are three hard-coded classes that are expected by the audio engine (with different, predefined filter chains): *UnderWaterEffects*, *UnconsciousStateEffect*, *RadioFilterEffects*\n\nAll of following have to be configured in base class **CfgSoundEffects**."},{"heading":"Underwater Filters","level":5,"markdown":"```cpp\nclass CfgSoundEffects\n{\n    class UnderWaterEffects\n    {\n        class Mono\n        {\n            // 0m - unchanged sound\n            // 1m - below surface level all sounds are mixed into mono\n            distance = 1;\n        };\n        class Equalizer\n        {\n            // in range [0 - 3] equalizer pars are linearly interpolated from neutral values to set\n            distance = 3;\n            // Equalizer\n            center[] = { 100, 800, 2000, 10000 };    // frequencies\n            bandwidth[] = { 2.0, 2.0, 2.0, 2.0 };    // must be between 0.1 and 2.0\n            gain[] = { db3, db0, db-15, db-18 };    // +/- 18dB\n        };\n    };\n};\n```"},{"heading":"Unconscious State Effect","level":5,"markdown":"```cpp\nclass CfgSoundEffects\n{\n    class UnconsciousStateEffect\n    {\n        // linear interpolation ... Echo0 * t + (Echo1 - Echo0), t = [0 - 1]\n        class Echo0\n        {\n            WetDryMix = 0.25;   // 0 - 1\n            Feedback = 0.15;     // 0 - 1\n            Delay = 50;        // 1 - 2000\n        };\n        class Echo1\n        {\n            WetDryMix = 0.5;    // 0 - 1\n            Feedback = 0.2;     // 0 - 1\n            Delay = 100;      // 1 - 2000\n        };\n        class Equalizer0\n        {\n            center[] = { 100, 800, 2000, 10000 }; // frequencies\n            bandwidth[] = { 1.0, 1.0, 1.0, 1.0 }; // must be between 0.1 and 2.0\n            gain[] = { db0, db-5, db-10, db-10 }; // +/- 18dB\n        };\n        class Equalizer1\n        {\n            center[] = { 100, 800, 2000, 10000 };    // frequencies\n            bandwidth[] = { 2.0, 2.0, 2.0, 2.0 }; // must be between 0.1 and 2.0\n            gain[] = { db0, db-10, db-18, db-18 }; // +/- 18dB\n        };\n    };\n};\n```"},{"heading":"Radio Protocol Filters","level":5,"markdown":"```cpp\nclass CfgSoundEffects\n{\n    class RadioFilterEffects\n    {\n        class Part0\n        {\n            // Equalizer\n            center[] = { 370, 900, 6000, 10000 };    // frequencies\n            bandwidth[] = { 1, 2, 1, 1.2 };            // must be between 0.1 and 2.0\n            gain[] = { db0, db4, db4, db5 };        // +/- 18dB\n            // Limiter\n            lim_limit = 1;\n            lim_attack = 5;\n            lim_release = 50;\n            enabled[] = { true, false, true };    // equalizer, limiter, convert to 8bit\n        };\n        class Part1\n        {\n            // low pass filter\n            filter_cut_off = 650;\n            /* Filter radian frequency calculated as (2 * sin(pi * (desired filter cutoff frequency) / sampleRate)).\n            The frequency must be greater than or equal to 0 and less than or equal to XAUDIO2_MAX_FILTER_FREQUENCY\n            frequency == 11025, cuttoff > 1837 = 1 */\n            filter_one_over_Q = 0.5;\n            /* 0 - 1, Reciprocal of Q factor. Controls how quickly frequencies beyond Frequency are dampened.\n            Larger values result in quicker dampening while smaller values cause dampening to occur more gradually */\n            filter_enabled = true;\n        };\n        class Part2\n        {\n            // Equalizer\n            center[] = { 100, 250, 900, 5000 };        // 20 - 2000Hz\n            bandwidth[] = {2, 1.9, 2, 2 };            // 0.1 and 2.0\n            gain[] = { db-18, db-18, db4, db-3 };    // 0.126 - 7.94; +/- 18dB\n            // Compressor\n            comp_threshold = db0;\n            comp_ratio = 0.27;          // 1:1\n            comp_attack = 1;        // milliseconds\n            comp_relase = 100;        // milliseconds\n            // Limiter\n            lim_limit = db-18;\n            lim_attack = 1;\n            lim_release = 500;\n            enabled[] = { true, false, false };   // equalizer, compressor, limiter\n        };\n    };\n};\n```"}],"categories":["Arma 3: Sound"],"groups":["Configuration"]}