Jump to content
Sign in to follow this  
b00tsy

sound volume/ object distance

Recommended Posts

I have created a nice long soundloop for an arabic town centre, but I am having a volume issue once the sound has been activated.

I have tried 2 versions where I use a trigger to activate the loop and I have tried to use an object as the sound source.

The problem is that once activated the sound volume stays the same no matter the distance I travel from the sound source. So now when I have left the town I still hear the loop just as loud as in the town centre where I placed the trigger.

I have tried the FadeMusic command but that does not do what I had in mind.

Is there a way to link the sound to an object and let it auto calculate the volume/distance from the player?

edit: I am trying to let the custom sound behave just as when I use a build in trigger sound such as the arabicmarket sound that keeps repeating once triggered. The sounds i've added in the description.ext only shows up in the 'voice' and 'anonymous' trigger dropdown, is there a way to add them to the trigger dropdown so that it plays like the build in arbicmarket sound?

edit2: found a little work around to keep the sound repeating and form an object source, butI still appriciate knowing a good efficient way to have a looped sound source.

v1 say3D "arabtown1"; 10 fadeSound .1

Is what I do now and I grouped the trigger to a civil guy that keeps walking in and out of the trigger.

Edited by B00tsy

Share this post


Link to post
Share on other sites

Hi B00tsy

there are various sound classes you can use in the description.ext file. You are probably using CfgSounds right now since your sounds show up in the voice and anonymous drop downs in the editor as you say.

I suggest to consult Bloodmixer's sound tutorial on Ofpec.com. Among other things it describes the differences between the various sound classes and when to use which class (I could give only a rough - and likely faulty - description as I'm not a sound expert and can't memorise those things well ;)).

Share this post


Link to post
Share on other sites

Hey thanks for the link, will have a look at the tutorial :)

I have been messing with CfgSounds and cfgEnvsounds, both are not doing what I want so far.

Share this post


Link to post
Share on other sites

You can make a sound coming directly from an object using say.

Share this post


Link to post
Share on other sites
You can make a sound coming directly from an object using say.

Yeah tried that already, also with say3D, but it does not get looped then.

------

The tutorial is very helpful and made a description.ext with the proper sound class. I do not receive any errors, but I can't hear any sounds either. The sound class is selectable though in the effects trigger dropdown.

version=1;

class Mission

{

gametype = Coop;

};

respawn = 3;

respawnDelay = 30;

respawnDialog = 1;

class CfgSFX

{

sounds[] = {arabtown};

class arabtown

{

name = "arabtown";

sounds[]={sound1,sound2};

sound1[]={"/sound/arabtown1.ogg", db-5,1,.5,5,1,10};

sound2[]={"/sound/arabtown2.ogg", db-5,1,.5,5,1,10};

empty[]= {, , , , 1 , 5, 20};

};

};

Why do I not hear the sound? the trigger is activated by team leader, but when i walk into the trigger there is no sound.

Ohh and I am using a stereo sound not sure if thats the problem, the sounds works fine with a CfgSounds class. also tried different db settings, but makes no difference either.

Edited by B00tsy

Share this post


Link to post
Share on other sites
Yeah tried that already, also with say3D, but it does not get looped then.

For the loop:

while {true} do
{
[i]emptyH[/i] say "arabtown1";
sleep (1 + random 2);
};

Remember that emptyH is the name of the object (maybe a invisible Helipad).

And thats how you could try it inside the description.ext:

class CfgSounds
{
       class arabtown
{
	name = "arabtown1"; // Name for mission editor
	sound[] = {\sound\arabtown1.ogg, db + 0, 1.0};
	titles[] = {0, ""};
};
};

Edited by Wiggum

Share this post


Link to post
Share on other sites

Thanks Wiggum will give that a go.

For looping I went back the first thing I tried and just let some ai guy walk in and out of a trigger constantly which does the trick (guy activates sounds in 5 towns at once), but it's not very efficient :)

---------- Post added at 12:08 PM ---------- Previous post was at 11:40 AM ----------

Thanks that works!

Last question about adding sounds :)

I have saved the mission with the added sounds and saved it as a SP mission. when I played it as a senario non of the sounds played (editor worked good). Do I have to copy the sound map and the scripts to an other map? No doubt a n00b question >_<

Nevermind, it does work :)

Edited by B00tsy

Share this post


Link to post
Share on other sites

Here is what I use in my own Domination edit to get some sound effects going to really enhance the ambiance feel in the bigger towns. Start the script on clients only. All it does is create true triggers with sound effects all around the map (you need to manually define d_island_center somewhere though) based on building classes. Uncomment the line containing the "Sign_sphere100cm_EP1" if you want to debug the positions used.

[] spawn {
private ["_pos","_doexit"];
_tcounter = 0;
_d_soundobjects = [
//		["Land_Misc_Well_L_EP1","fx_well"],
//		["Land_Misc_Well_C_EP1","fx_well"],
//		["M1130_HQ_unfolded_Base_EP1","fx_humming",[0,3.8,1]],
	["Land_Ind_Oil_Tower_EP1","Engine_factory2_EP1",[-2,-1,-5]],
	["Land_Ind_Oil_Tower_EP1","Factory01Sfx",[1.5,-2.7,-12.5]],
	["Land_A_Minaret_EP1","Muslim_prayer1",[0,-2,10]],
	["Land_A_Mosque_big_minaret_2_EP1","Muslim_prayer2",[0,-2,12]],
	["Land_House_C_9_EP1","arabian_market_1",[0,0,-3]],
	["Land_Market_stalls_01_EP1","arabian_market_2",[0,0,0]],
	["Land_House_C_1_EP1","arabian_market_3",[-7,0,0]],
	["Land_House_C_1_EP1","arabian_market_4",[7,0,0]]
];
_d_tmparray = [];
for "_i" from 0 to count _d_soundobjects - 1 do {
	_d_tmparray set [count _d_tmparray, (_d_soundobjects select _i) select 0];
};
_d_array = nearestObjects [d_island_center, _d_tmparray, 9200]; //It's a stretch wrt performance, I know.
for "_i" from 0 to count _d_array - 1 do {
	for "_j" from 0 to count _d_soundobjects - 1 do {
		_doexit = false;
		if (typeOf (_d_array select _i) == (_d_soundobjects select _j) select 0) then {
			_pos = [];
			if (count (_d_soundobjects select _j) > 2) then {
				_pos = (_d_array select _i) modelToWorld ((_d_soundobjects select _j) select 2);
			} else {
				_pos = getPos (_d_array select _i);
			};
//				_obj = "Sign_sphere100cm_EP1" createVehicleLocal _pos; _obj setPos _pos;
			_trigger = createTrigger ["EmptyDetector", _pos];
			_trigger setTriggerStatements ["true", "", ""];
			_trigger setSoundEffect ["NoSound", "", "", (_d_soundobjects select _j) select 1];
			_trigger setTriggerText ((_d_soundobjects select _j) select 1);
			_doexit = true;
		};
		if (_doexit) exitWith {
			_tcounter = _tcounter + 1;
		};
		sleep 0.03;
	};
};
_soundobjects = nil;
_d_tmparray = nil;
_d_array = nil;
};

It only uses CfgSFX as already exist in the game. I have some additional ones but I have commented out those ones.

Then you might need to add this under cfgSounds in description.ext:

class NoSound {name = "NoSound";sound[] = {"", 0, 1};titles[] = {};};

It's only a dummy, it doesn't have a sound file. But setSoundEffect will (or rather, used to, haven't checked lately) choke if the first string parameter is left empty (weird engine bug).

Share this post


Link to post
Share on other sites

Interesting script, might use that for an other mission. The current mission I only use custom sounds to give it a more unique atmosphere which is turning out really well so far. A few issues I still encounter is that the sound falloff is not correct at some points (hearing arabic voices to far outside the town) and I had to cut up some sounds some more, they were causing temp freezes because of the too large file size.

I will post the custom sound collection on the forum if it is wanted. Contains many arabic jibberish voices, town and market sounds and several cool prayers... and some general environment sounds such as crickets, birds, generator noice etc.

Share this post


Link to post
Share on other sites

Yeah I have a large collection I use as well but only for singleplayer missions. Several megabytes of sound files is not what you want to include in a multiplayer game. I try to keep things small and use stock sounds if possible.

Too bad we have to live with existing classes (which may have volumes or other parameters that doesn't match what we're looking for) instead of simply creating new classes using sounds already in the games addons, without having to include the actual sound files. System should have been far more flexible with this.

Btw, I use similar kind of script on server side to attach event handlers to buildings etc.

Share this post


Link to post
Share on other sites

Hey guys, at the moment i am having a similar problem but the only problem here is that the sounds are either muffled (low) or sound as if theyre coming from a walkie talkie. What i want it to sound like is a major P.A announcement.. eg. If people come within 1km, within my base i want an alarm to go off.. which is pretty loud..

Share this post


Link to post
Share on other sites

Could be just the sound you are using. I recorded my own PA announcement, put it through a band-pass filter to reduced the quality and added a touch of echo to increase the feeling it was coming from a real loudspeaker outdoors. A trigger fires off a stock alarm sound FX and also kicks off a script to say3d 3 sound files to make the announcement. Only slightly hard part was ensuring the alarm shut down later.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×