Page 1 of 1

Use PitchMod in sounds.lua to prevent loud explosions

Posted: 12 Oct 2012, 16:40
by jK
Put all your explosion sounds in a common directory (e.g. "sounds/explosions/") and put the following in your sounds.lua:

Code: Select all

local files = VFS.DirList("sounds/explosions/")
local t = Sounds.SoundItems
for i=1,#files do
	local fileName = files[i]
	t[fileName] = {
		file     = fileName;
		pitchmod = 0.3;
		gainmod  = 0.2;
		maxconcurrent = 8;
	}
end
PS: Explosions are so loud cause they are started in the same simFrame and so are played in sync -> resonance. PitchMod now changes the playback time (e.g. with 0.3 the sounds should have a playback time of 100-130%) and so there isn't a resonance anymore even when the sound is started multiple times in the same simframe.

PPS: THIS IS NOTHING THE ENGINE CAN DO, cause you cannot force a PitchMod globally, i.e. voices already sound extreme strange when played at 110% playback time.

Re: Use PitchMod in sounds.lua to prevent loud explosions

Posted: 13 Apr 2015, 14:24
by 8611
Added as example to wiki:
https://springrts.com/wiki/Sounds.lua#U ... losions.3D
No idea if explosions even still do the "resonance boom noise" but the example it is interessting and seems relevant to have.