Sound – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
(→‎CfgSoundCurves: removed "[]" indicating an array although a class name is given)
(→‎sound3DProcessingType: added link to cfg3DSoundProcessors)
Line 320: Line 320:
|-
|-
!sound3DProcessingType
!sound3DProcessingType
|class name of 3D processing type or none if you want the old config behaviour
|class name of 3D processing type or ''none'' if you want the old config behaviour
|defaultSound3DProcessingType
|defaultSound3DProcessingType
|use '''emitter''' or '''panner'''? Class names defined in '''CfgSound3DProcessors'''
|use '''emitter''' or '''panner'''? Class names defined in '''CfgSound3DProcessors'''
|}
|}
There are two ways the new audio engine handles stereo files. ''StereoEmitter'' and ''StereoPanner''. They will get their own WikiPage where they will be explained.
Here you choose the 3D processing of the sound. You can use new systems explained in [[cfgSound3DProcessors]] but if you want the engine to behave like in the old days and downmix stereo files to mono to position them in the 3D world, set sound3DProcessingType to ''"none"''.
 
If you want the engine to behave like in the old days, set sound3DProcessingType to "none" and it will downmix your sounds to mono.


===spatialityRange===
===spatialityRange===

Revision as of 16:38, 8 February 2016

The first ever BIKI-Page dedicated to Audio in Arma

This site is WIP and will deliver more detailed information and examples as the time passes. For now we will focuss on basic understanding of SoundShader, SoundSet, cfgSoundGlobals, cfgSoundCurves and cfgSound3dProcessors.

SoundShader

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. class cfgSoundShaders { class MX_Closure_SoundShader { samples[] = { {"pathToYourSound1",1}, {"pathToYourSound2",1}, {"pathToYourSound3",1} }; volume = 0.5; frequency = 1; range = 10; rangeCurve[] = { {0,1}, {5,0.7}, {10,0} }; limitation = 0; }; };

samples

parameter unit/values default descriptions
samples {["path/sound",p], ...} none array containing sound file name with paths and probability values (p)

Here 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. The 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}.

Also noteworthy here is that in previous ArmA sound configuration we had to make sure that all the probability numbers add up to 1. So if we had two sounds their probabilities had to be 0.5. With the new configuration this is no longer needed. {"pathToYourSound1",10} {"pathToYourSound2",10} is the same as {"pathToYourSound1",1} {"pathToYourSound1",1} Both sounds have the same chance of being picked.

volume

parameter unit/values default descriptions
volume float (0-1) 1 basic volume value

Volume 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. If you want to calculate what values to enter here depending on dB, you can use this calculator (I suggest you download the site to your computer to make sure you can work offline). Any other percentage to dB calculator will work. Careful though, as you can see on this site signal dB is not equal power dB! Always be sure to calculate with the right dB! To ensure you work with the right dB test this: -6dB = 50%, always.

frequency

parameter unit/values default descriptions
frequency float 1 basic pitch value, 1 = no change = normal pitch. Parameter ignored if more than 1 SoundShaders in SoundSet

Playback speed/pitch of the sound. Low number = low pitch, high number = high pitch. This 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).

range

parameter unit/values default descriptions
range distance in meters 0 radius of circle around sound source where the sound will be played

The sound will be played in this radius around the sound source. There 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.

rangeCurve

parameter unit/values default descriptions
rangeCurve {d0,v0}, {d1,v1} none array of points or class name defined in CfgSoundCurves

Here 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. In the example the sound will be played at full volume at 0m distance. At 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. You 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: rangeCurve[] = { {0,1}, {0.5,0.7}, {1,0} }; 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".

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: First SoundShader (close sounds) range = 50; rangeCurve[] = { {0,1}, {25,0.7}, {50,0} }; Second SoundShader (distant sounds) range = 1800; rangeCurve[] = { {0,0.2}, {25,0.7}, {50,1}, {1800,1} }; The close sound will start to become quieter over distance and at 50m it will be completely silent. The 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).

CfgSoundCurves

CfgSoundCurves is it's own class in the audio configuration and is defined outside CfgSoundShaders but I will bring it up here anyway because it fits. Instead of having to define many points every time in every SoundShader you can use the class CfgSoundCurves to define specific sound curves and then just use the names of these soundCurves in your other sound configurations. Let's look at an example CfgSoundCurves entry: class CfgSoundCurves { class closureVolumeCurve { points[] = { {0.0,1.0}, {0.5,0.7}, {1.0,0.0} }; }; }; This entry uses relative distance values (0=0m, 1=maximum range) and is called "closureVolumeCurve". So in our example SoundShader above we could have used: rangeCurve = closureVolumeCurve and the result would be the same. Make sure the rangeCurve is defined in cfgSoundCurves class before using it in audio configuration!

limitation

parameter unit/values default descriptions
limitation bool false if true -> adds SoundShader to group of SoundShaders which will be limited within the SoundSet

If 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.

SoundSet

A SoundSet usually combines multiple SoundShaders and decides how they are presented in the world. Let's look at an example SoundSet: class cfgSoundSets { class MX_Shot_SoundSet { soundShaders[] = { gunShotClose, gunShotDistant }; soundShadersLimit = 1; volumeFactor = 1; volumeRandomizer = 0; volumeCurve = defaultVolumeCurve; frequencyFactor = 1; frequencyRandomizer = 0; loop = 0; spatial = 1; sound3DProcessingType = defaultSound3DProcessingType; doppler = 0; speedOfSound = 1; }; };

Important Notes on SoundSets

  • SoundSets are a dynamically mixed sample - audio is being created on the fly by the engine. If you mix a 1 second long SoundShader with a 3 second long SoundShader the final sample will be 3 seconds long.
  • the range of the SoundSet is the highest range of all SoundShaders used in SoundSet. So if one SoundShader has a range of 50 and another SoundShader has a range of 1800 - 1800 will be the range of the SoundSet.
  • volumeCurves applied to SoundSet will be scaled to that range. Looking at the example above 1 will mean 1800m and 0 will mean 0m.
  • currently it is necessary to use SoundShaders with the same frequency within the SoundSet (frequency parameter in SoundShader will be ignored if more than one SoundShader in SoundSet)

soundShaders

parameter unit/values default descriptions
soundShaders {soundShader1,soundShader2...}; none array of soundShaders to be submixed

All SoundShaders within this array will be called, their volume values evaluated and they will be SUBMIXED into one voice. There are multiple great things here:

  • The mixing is sample accurate! The way you hear it in your DAW is how you will hear the mix ingame! In previous arma titles sound events sometimes were not played simultaneously but with a tiny gap between them, creating weird effects - no more!
  • The final mix counts as ONE VOICE. Game Sound Designers know that sometimes we create a sound out of multiple layers and the number of voices ingame is limited - well even if you use 6 SoundShaders to make up one dynamic SoundSet, the SoundSet will count as ONE voice.

SoundShadersLimit

parameter unit/values default descriptions
soundShadersLimit 0 SoundShaders without limitation parameter will always be processed

If you set the value to 2, only the 2 loudest SoundShaders will be processed. When the SoundSet is triggered the engine looks at the rangeCurves and volume values of the SoundShaders. Since with rangeCurves you can have many soundShaders active this is a good way to save processing power. For this to work the SoundShaders must have limitation = 1; in their configurations.

volumeFactor

parameter unit/values default descriptions
volumeFactor float (0-n) 1 multiplication factor for volume

This allows you to manage volume for a group of sounds instead of doing it one by one like in old configuration versions. volumeFactor set to 2 means that every volume value of each SoundShader is doubled.

volumeRandomizer

parameter unit/values default descriptions
volumeRandomizer float 0 random multiplication factor for volume, calculated during each use of SoundSet

This allows you to have volume differences between each (for example) gunshot. How this works IN DETAIL will be added soon.

volumeCurve

parameter unit/values default descriptions
volumeCurve array of points or class name defined in CfgSoundCurves defaultVolumeCurve volume falloff curve for the SoundSet, based on highest range of SoundShaders in SoundSet

frequencyFactor

parameter unit/values default descriptions
frequencyFactor Number (0-n) 1 multiplication factor for frequency

This allows you to control the pitch of all SoundShaders in the SoundSet.

frequencyRandomizer

parameter unit/values default descriptions
frequencyRandomizer Semitones in numbers 0 random multiplication factor for frequency, calculated during each use of SoundSet

Every time soundSet is triggered a number between 0 and the value here is calculated and applied to the sound. So for example: frequencyRandomizer = 3; The sound will have pitch randomization within 3 semitones (positive and negative, sound pitch going up and down).

loop

parameter unit/values default descriptions
loop enum (0/1) or boolean 0 defining looping of SoundSet, start/stop of loop is handled by gameplay event

This is WIP, not sure how it works, will add information as soon as the feature becomes more prevalent.

distanceFilter

parameter unit/values default descriptions
distanceFilter class name of filter or "none" if you don't want filter defaultDistanceFilter defines the filter used when listener distance to sound increases

Distant sounds sound different compared to close sounds. Usually they become quieter (rangeCurve takes care of that) and they lose high frequency content. distanceFilter is defining how exactly the sound loses high frequency content. Open config.cpp in sounds.pbo and take a look at class cfgDistanceFilters to get a rough idea.

If you want NO filter to be applied to your soundSet, use distanceFilter = "none";

spatial

If 1 the sound will be treated like a 3D sound. If 0 the sound will be played back locally "in the player's head" which would sound the same as if you played the sound in your MP3 player.

sound3DProcessingType

parameter unit/values default descriptions
sound3DProcessingType class name of 3D processing type or none if you want the old config behaviour defaultSound3DProcessingType use emitter or panner? Class names defined in CfgSound3DProcessors

Here you choose the 3D processing of the sound. You can use new systems explained in cfgSound3DProcessors but if you want the engine to behave like in the old days and downmix stereo files to mono to position them in the 3D world, set sound3DProcessingType to "none".

spatialityRange

Default value 0. Distance in meters where signal starts "bleeding" into the opposite channel. It's X3DAudio's innerRadius value and you can read more about it here. I don't know exactly how it works so I will explain it when I know more.

spatialityRangeAngle

Angle in Radians. It's X3DAudio's innerRadiusAngle and you can read more about it here.

doppler

Decides whether the doppler effect will be applied to the SoundSet or not.

speedOfSound

Decides whether speed of sound calculation will be enabled for the SoundSet or not.