Reducing Weapon Firing Sound

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

slater1376
Posts: 11
Joined: Thu, 30. Apr 15, 02:59
x4

Reducing Weapon Firing Sound

Post by slater1376 »

Anybody know a way to reduce audio volume of a weapon firing, when that weapon was added by a mod? I've been using "Terran Weapons" mod. The medium main gun Proton Barrage is horribly loud compared to other weapons. Any help is appreciated.

Edit: I'm not sure if its a line i can type in on one of the mod's xml files or whether i need to find the audio clip the weapon uses and remix the audio with less gain. I have audio editing/mixing software in case of the latter.
User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13487
Joined: Sun, 15. Feb 04, 20:12
x4

Re: Reducing Weapon Firing Sound

Post by euclid »

Check the wav files in the sfx folder (unpacked ofc). Can be a challenge to find the correct one ;-)

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786
Realspace
Posts: 1638
Joined: Wed, 15. Nov 06, 10:21
x4

Re: Reducing Weapon Firing Sound

Post by Realspace »

You can look in the libraries of the mod, have to unpack if it is a ext_01.cat. In libraries/soundlibrary.xml the new sounds added by the mod are listed. You can adjust the volume. If they are new sounds added. If they are vanilla, then look if the modder replaced some. If they have been replaced by a subst_01.cat then the only thing you can do is unpack it, remove the specific sound, repack them as Subst.
slater1376
Posts: 11
Joined: Thu, 30. Apr 15, 02:59
x4

Re: Reducing Weapon Firing Sound

Post by slater1376 »

Ok what i've found, this mod refers back to a vanilla terran dlc sound. I found the original weapon sound and libraries/sound_library.xml I extracted the vanilla terran dlc ext_03.cat and changed the sound volume in the sound_library.xml and appended it back into the vanilla ext_03.cat

There is an ext_03_sig.cat right next to it. I know tampering with vanilla cat files isn't the proper way.

There is no sound_library.xml in the weapon mod. I'm no coder, but is there a way to add a line of < diff > code, or some such, to a new sound_library.xml that i could place in the libraries folder of the mod that hijacks the volume settings for that vanilla weapon sound?

Edit: These lines are exactly what i'm working with out of the vanilla Terran sound_library.xml This xml already has a <diff> at the top and bottom of it. I know i don't need to add every line to the new xml, only the lines of the stats i want changed. The rest remain unchanged by omission. How can i package these after editing, so my volume edits are used instead of vanilla?
Spoiler
Show
<sound id="weapon_ter_m_gatling_01_mk1_muzzle" description="M Terran gatling" repeat="1" is3d="1" preload="0">
<sample selection="random">
<select start="extensions\ego_dlc_terran\sfx\weapons\weapon_ter_m_gatling_01_mk1_muzzle_01"/>
<select start="extensions\ego_dlc_terran\sfx\weapons\weapon_ter_m_gatling_01_mk1_muzzle_02"/>
<select start="extensions\ego_dlc_terran\sfx\weapons\weapon_ter_m_gatling_01_mk1_muzzle_03"/>
<select start="extensions\ego_dlc_terran\sfx\weapons\weapon_ter_m_gatling_01_mk1_muzzle_04"/>
</sample>
<volume start="0.6" distance="10"/>
<effects>
<filter mode="lowpass" distance="10">
<distancecurve>
<point distance="0.0" volume="1.0"/>
<point distance="0.3" volume="0.5"/>
<point distance="0.6" volume="0.1"/>
<point distance="1.0" volume="0.05"/>
</distancecurve>
</filter>
</effects>
</sound>

<sound id="weapon_ter_s_gatling_01_mk1_muzzle" description="S Terran gatling" repeat="1" is3d="1" preload="0">
<sample selection="random">
<select start="extensions\ego_dlc_terran\sfx\weapons\weapon_ter_s_gatling_01_mk1_muzzle_01"/>
<select start="extensions\ego_dlc_terran\sfx\weapons\weapon_ter_s_gatling_01_mk1_muzzle_02"/>
<select start="extensions\ego_dlc_terran\sfx\weapons\weapon_ter_s_gatling_01_mk1_muzzle_03"/>
<select start="extensions\ego_dlc_terran\sfx\weapons\weapon_ter_s_gatling_01_mk1_muzzle_04"/>
</sample>
<volume start="0.6" distance="10"/>
<effects>
<filter mode="lowpass" distance="10">
<distancecurve>
<point distance="0.0" volume="1.0"/>
<point distance="0.3" volume="0.5"/>
<point distance="0.6" volume="0.1"/>
<point distance="1.0" volume="0.05"/>
</distancecurve>
</filter>
</effects>
</sound>

<sound id="weapon_ter_gatling_01_start" description="S Terran gatling start" repeat="1" is3d="1" preload="0">
<sample selection="random">
<select start="extensions\ego_dlc_terran\sfx\weapons\weapon_ter_s_gatling_01_start_01"/>
<select start="extensions\ego_dlc_terran\sfx\weapons\weapon_ter_s_gatling_01_start_02"/>
</sample>
<volume start="0.7" distance="10"/>
<effects>
<filter mode="lowpass" distance="10">
<distancecurve>
<point distance="0.0" volume="1.0"/>
<point distance="0.3" volume="0.5"/>
<point distance="0.6" volume="0.1"/>
<point distance="1.0" volume="0.05"/>
</distancecurve>
</filter>
</effects>
</sound>

<sound id="weapon_ter_gatling_01_stop" description="S Terran gatling stop" repeat="1" is3d="1" preload="0">
<sample selection="random">
<select start="extensions\ego_dlc_terran\sfx\weapons\weapon_ter_s_gatling_01_stop_01"/>
<select start="extensions\ego_dlc_terran\sfx\weapons\weapon_ter_s_gatling_01_stop_01"/>
</sample>
<volume start="0.3" distance="10"/>
<effects>
<filter mode="lowpass" distance="10">
<distancecurve>
<point distance="0.0" volume="1.0"/>
<point distance="0.3" volume="0.5"/>
<point distance="0.6" volume="0.1"/>
<point distance="1.0" volume="0.05"/>
</distancecurve>
</filter>
</effects>
</sound>
Maybe the edits like this?
Spoiler
Show
<sound id="weapon_ter_m_gatling_01_mk1_muzzle" description="M Terran gatling" repeat="1" is3d="1" preload="0">
<volume start="0.6" distance="10"/>
</sound>

<sound id="weapon_ter_s_gatling_01_mk1_muzzle" description="S Terran gatling" repeat="1" is3d="1" preload="0">
<volume start="0.6" distance="10"/>
</sound>

<sound id="weapon_ter_gatling_01_start" description="S Terran gatling start" repeat="1" is3d="1" preload="0">
<volume start="0.7" distance="10"/>
</sound>

<sound id="weapon_ter_gatling_01_stop" description="S Terran gatling stop" repeat="1" is3d="1" preload="0">
<volume start="0.3" distance="10"/>
</sound>
user1679
Posts: 1088
Joined: Fri, 20. Jul 18, 23:20

Re: Reducing Weapon Firing Sound

Post by user1679 »

A DIFF will allow you to replace the node with your changes. Copy the whole thing and change what you want. For example, if I want to change the volume start from 0.6 to 0.9 and distance from 10 to 5:

Code: Select all

<diff>	
	<replace sel="//soundlibrary/sound[@id='weapon_ter_m_gatling_01_mk1_muzzle']">
		<sound id="weapon_ter_m_gatling_01_mk1_muzzle" description="M Terran gatling" repeat="1" is3d="1" preload="0">
			<sample selection="random">
				<select start="extensions\ego_dlc_terran\sfx\weapons\weapon_ter_m_gatling_01_mk1_muzzle_01"/>
				<select start="extensions\ego_dlc_terran\sfx\weapons\weapon_ter_m_gatling_01_mk1_muzzle_02"/>
				<select start="extensions\ego_dlc_terran\sfx\weapons\weapon_ter_m_gatling_01_mk1_muzzle_03"/>
				<select start="extensions\ego_dlc_terran\sfx\weapons\weapon_ter_m_gatling_01_mk1_muzzle_04"/>
			</sample>
			<volume start="0.9" distance="10"/>  <!-- I changed this from 0.6 to 0.9 and 10 to 5 -->
			<effects>
				<filter mode="lowpass" distance="5">
					<distancecurve>
						<point distance="0.0" volume="1.0"/>
						<point distance="0.3" volume="0.5"/>
						<point distance="0.6" volume="0.1"/>
						<point distance="1.0" volume="0.05"/>
					</distancecurve>
				</filter>
			</effects>
		</sound>
	</replace>
</diff>
Notice I simply copied the original block into my replace node and just changed the line I wanted (pay attention to the REPLACE SEL line, it's important to use the proper ID from the original file). If you save this in a sound_library.xml file and create the proper folder structure in your mod, it should load and overwrite the original.
slater1376
Posts: 11
Joined: Thu, 30. Apr 15, 02:59
x4

Re: Reducing Weapon Firing Sound

Post by slater1376 »

user1679 wrote: Tue, 11. Feb 25, 05:16

Code: Select all

<diff>	
	<replace sel="//soundlibrary/sound[@id='weapon_ter_m_gatling_01_mk1_muzzle']">
		
	</replace>
</diff>
Yes! This is it! The missing piece of the puzzle for me. Thanks very much for this. I appreciate all these responses too. I really need to find one of those books with the yellow and black hazard tape across the cover thats titled "Coding xml for dummies" :D
user1679
Posts: 1088
Joined: Fri, 20. Jul 18, 23:20

Re: Reducing Weapon Firing Sound

Post by user1679 »

slater1376 wrote: Tue, 11. Feb 25, 20:23
user1679 wrote: Tue, 11. Feb 25, 05:16

Code: Select all

<diff>	
	<replace sel="//soundlibrary/sound[@id='weapon_ter_m_gatling_01_mk1_muzzle']">
		
	</replace>
</diff>
Yes! This is it! The missing piece of the puzzle for me. Thanks very much for this. I appreciate all these responses too. I really need to find one of those books with the yellow and black hazard tape across the cover thats titled "Coding xml for dummies" :D

I know how you feel. I still have trouble with SEL statements too, I've coded in Visual Basic, C++, Java, and a few others but the code X4 uses often gets me stumped.

Return to “X4: Foundations - Scripts and Modding”