Sound: Sound Curves – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page with "== Sound Curves == Sound curve is a simple set of points on 2D graph, which define the relationship between two variables (usually distance and volume). All sound curves hav...")
 
m (Some wiki formatting)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Sound Curves ==
== Sound Curves ==


Line 5: Line 6:
All sound curves have to be configured in the base class '''CfgSoundCurves''' (or directly in curve parameter)
All sound curves have to be configured in the base class '''CfgSoundCurves''' (or directly in curve parameter)


{| class="wikitable" style="color:black; background-color:#eeeeff;"
{{Feature|informative|
|
* In array of points <syntaxhighlight lang="cpp" inline>{ x, value }</syntaxhighlight>, x values must be ascending.
* In array of points {x, value}, x values must be ascending.
* x values are rescaled to range, which means:<br>using 0..1 values represent relative definition, while using meters represents absolute definition, but be sure that the highest x value is the same as range and the lowest x value is 0
* x values are rescaled to range (which means: using 0..1 values represent relative definition, while using meters represents absolute definition, but be sure that the highest x value is the same as range and the lowest x value is 0)
}}
|}


<code>
{{Feature|important|Some sound sources (from like {{hl|CfgAmmo}}, e.g a mortar shell) beyond [[viewDistance|terrain view distance]] are not played.}}
 
<syntaxhighlight lang="cpp">
class CfgSoundCurves
class CfgSoundCurves
{
{
    class InverseSquare1Curve
class InverseSquare1Curve
    {
{
        points[] =
points[] =
            {
{
                {0.0, 0.9751},
{ 0.0, 0.9751 },
                {0.1, 0.6332},
{ 0.1, 0.6332 },
                {0.2, 0.4307},
{ 0.2, 0.4307 },
                {0.3, 0.3009},
{ 0.3, 0.3009 },
                {0.4, 0.2128},
{ 0.4, 0.2128 },
                {0.5, 0.1503},
{ 0.5, 0.1503 },
                {0.6, 0.1043},
{ 0.6, 0.1043 },
                {0.7, 0.0695},
{ 0.7, 0.0695 },
                {0.8, 0.0426},
{ 0.8, 0.0426 },
                {0.9, 0.0213},
{ 0.9, 0.0213 },
                {1.0, 0.0041}
{ 1.0, 0.0041 }
            };
};
    };
};
};
};
</code>
</syntaxhighlight>


'''Example of configuration using curve class'''
'''Example of configuration using curve class'''
<code>
<syntaxhighlight lang="cpp">
class CfgSoundSets
class CfgSoundSets
{
{
//volumeCurve parameter using curve class
// volumeCurve parameter using curve class
class Rifle_Shot1_SoundSet
class Rifle_Shot1_SoundSet
{
{
soundShaders[] =  
soundShaders[] =
{
{
MX_closeShot_SoundShader,
"MX_closeShot_SoundShader"
};
};
volumeCurve = InverseSquare1Curve;
volumeCurve = InverseSquare1Curve;
};
};
};
};
</code>
</syntaxhighlight>


'''Example of configuration using direct curve definition'''
'''Example of configuration using direct curve definition'''
<code>  
<syntaxhighlight lang="cpp">
class CfgSoundSets
class CfgSoundSets
{
{
Line 57: Line 59:
class Rifle_Shot1_SoundSet
class Rifle_Shot1_SoundSet
{
{
soundShaders[] =  
soundShaders[] =
{
{
MX_closeShot_SoundShader,
"MX_closeShot_SoundShader"
};
};
volumeCurve[] =
volumeCurve[] =
{
{
{0.0, 0.9751},
{ 0.0, 0.9751 },
{0.1, 0.6332},
{ 0.1, 0.6332 },
{0.2, 0.4307},
{ 0.2, 0.4307 },
{0.3, 0.3009},
{ 0.3, 0.3009 },
{0.4, 0.2128},
{ 0.4, 0.2128 },
{0.5, 0.1503},
{ 0.5, 0.1503 },
{0.6, 0.1043},
{ 0.6, 0.1043 },
{0.7, 0.0695},
{ 0.7, 0.0695 },
{0.8, 0.0426},
{ 0.8, 0.0426 },
{0.9, 0.0213},
{ 0.9, 0.0213 },
{1.0, 0.0041}
{ 1.0, 0.0041 }
};
};
};
};
};
};
</code>
</syntaxhighlight>
 
 
{{GameCategory|arma3|Sound}}

Latest revision as of 17:20, 27 April 2023

Sound Curves

Sound curve is a simple set of points on 2D graph, which define the relationship between two variables (usually distance and volume).

All sound curves have to be configured in the base class CfgSoundCurves (or directly in curve parameter)

  • In array of points { x, value }, x values must be ascending.
  • x values are rescaled to range, which means:
    using 0..1 values represent relative definition, while using meters represents absolute definition, but be sure that the highest x value is the same as range and the lowest x value is 0
Some sound sources (from like CfgAmmo, e.g a mortar shell) beyond terrain view distance are not played.
class CfgSoundCurves
{
	class InverseSquare1Curve
	{
		points[] =
		{
			{ 0.0, 0.9751 },
			{ 0.1, 0.6332 },
			{ 0.2, 0.4307 },
			{ 0.3, 0.3009 },
			{ 0.4, 0.2128 },
			{ 0.5, 0.1503 },
			{ 0.6, 0.1043 },
			{ 0.7, 0.0695 },
			{ 0.8, 0.0426 },
			{ 0.9, 0.0213 },
			{ 1.0, 0.0041 }
		};
	};
};

Example of configuration using curve class

class CfgSoundSets
{
	// volumeCurve parameter using curve class
	class Rifle_Shot1_SoundSet
	{
		soundShaders[] =
		{
			"MX_closeShot_SoundShader"
		};
		volumeCurve = InverseSquare1Curve;
	};
};

Example of configuration using direct curve definition

class CfgSoundSets
{
	//volumeCurve direct definition
	class Rifle_Shot1_SoundSet
	{
		soundShaders[] =
		{
			"MX_closeShot_SoundShader"
		};
		volumeCurve[] =
		{
			{ 0.0, 0.9751 },
			{ 0.1, 0.6332 },
			{ 0.2, 0.4307 },
			{ 0.3, 0.3009 },
			{ 0.4, 0.2128 },
			{ 0.5, 0.1503 },
			{ 0.6, 0.1043 },
			{ 0.7, 0.0695 },
			{ 0.8, 0.0426 },
			{ 0.9, 0.0213 },
			{ 1.0, 0.0041 }
		};
	};
};