Jump to content
Sign in to follow this  
das attorney

Add continuous sound to object

Recommended Posts

Hello,

I have a number of static objects that I have created. These objects must emit a continuous sound in a loop.

At the moment, I have set up a sound source in CfgVehicles and am attaching it to them via script in game. This works ok, but I'd like to know if you can set a sound up in the objects config to play constantly.

Here is my current config:

class CfgVehicles {
class House;
class Horde_speakerStack: House {
	displayname = "4 x 12 Marshall Stack";
	scope = 2;
	vehicleClass = "Marshall_Amps";
	model = "Stacks\horde_speakerCab.p3d";
};

class Sound;
class Sound_SpeakerNoise: Sound {
	displayname = "Kerrang";
	scope = 2;
	sound = "horde_sound_ampSounds";
};
};


class CfgSFX {
class AlarmSfx;
class horde_sound_ampSounds: AlarmSfx {
	Sound1[] = {"sound\horde_sound_ampSounds",2,1,200,1,0,0,0};
	empty[] = {"",0,0,0,0,0,0,0};
	name = "horde_sound_ampSounds";
	sounds[] = {"Sound1"};
};
};

And I just attach "Sound_SpeakerNoise" to "Horde_speakerStack".

Does anyone know how to set up "Horde_speakerStack" to emit a sample endlessly?

Thanks.

Share this post


Link to post
Share on other sites

A Google search dug up an OFP relic that seems to describe what you need :D

I lifted it interesting bit from the page but I'll link to it anyway, it's long but it's stuffed with info.

- edit forgot add link

http://ofp.toadlife.net/downloads/tutorials/tutorial_sound/tutorial_sound.html

I see I lost the markup the original page has so it may be easier to check it out there.

Step 9.5 : Additional classes, advanced sound.

There are a few more classes, the first I will cover here is the CfgSFX class. Keep in mind that I assume you already know the deal with voices, radio and music classes, because the following is a bit harder.

The CfgSFX is the sound class that is referred to in the trigger effect box under "trigger" The beauty of this class is that it repeats sound, and can repeat a number of sounds. Very usefull if you want to have, for instance, ambient bird or animal sounds. The sound can be random. What it does not do is mix sounds. You have to do this with a soundeditor , and then use the CfgEnvSounds class.

class CfgSFX

{

sounds[] = { examplesound };

class examplesound

{

name = "example sound";

sounds[]={sound1,sound2};

sound1[]={"soundname.ogg", db-0,1,0.3,5,1,10};

sound2[]={"soundname2.ogg", db-0,1,0.3,5,1,10};

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

};

};

This line : sounds[]={sound1,sound2}; defines what sounds are in your loop. In this case sound1 and sound2, which are defined in the lines ahead. Lets take a look at the hard part, this line :

sound1[]={"soundname.ogg", db-0,1,0.3,5,1,10};

What are these numbers ?

sound1[]={"soundname.ogg", db-0,1,0.3,5,1,10};

db-0 defines the sound volume

sound1[]={"soundname.ogg", db-0,1,0.3,5,1,10};

this 1 defines the pitch of the sample.

sound1[]={"soundname.ogg", db-0,1,0.3,5,1,10};

0.3 is the chance this sound will play. If chance is 1 than this will be the only sound that plays

sound1[]={"soundname.ogg", db-0,1,0.3,5,1,10};

I really don't know what this setting does.

sound1[]={"soundname.ogg", db-0,1,0.3,5,1,10};

This number defines the minimum time it waits before moving on (randomly)

sound1[]={"soundname.ogg", db-0,1,0.3,5,1,10};

This number defines the maximum time it waits before moving on. (randomly)

And than you got this line :

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

I have absolutely no idea what this does as of yet. I did notice that taking it away crashes OFP, so tuck it in. Perhaps it is some sort of order of playing ? Or to define the end of this sound class ? I don't know....

Edited by BadLuckBurt

Share this post


Link to post
Share on other sites

thanks for reply BLB - I looked at the link you posted but as far as I can see it deals with setting up the CfgSfx for use in the mission (and if you check the config I posted, I've already set up CfgSfx entry for the looped sound.

Just to reiterate, I'm trying to get the object (Horde_speakerStack) to emit a sound, rather than having to set up CfgSfx as well and script the sound object to be attached to the object (Horde_speakerStack)

If that isn't possible, then that's fine, but I wondered if there was a way.

Thanks for checking though - appreciated :)

Share this post


Link to post
Share on other sites

Probably a bit overkill, but for the Nimitz engine sounds we just added, we use a fake vehicle that is attached to the carrier. The vehicle engine idle sound is supposed to present the carrier engine sound. If that's a workable solution for you, hit me up and we share the fake vehicle.

Share this post


Link to post
Share on other sites

Anyone know how to do this for a weapon on a vehicle? Need a sound to play everytime the trigger is pressed on an aircraft.

Share this post


Link to post
Share on other sites

@Strannix - no idea.

@ TeTeT - I tried making a entry under soundEngine but there wasn't any sound emitted. Maybe it is my base class (inherits from house), or another missing entry. I know little about vehicle configs so not sure what the problem is. Here's what I'm doing, have you got a sample config you can post up if ok?

class CfgVehicles { 
   class House; 
   class Horde_speakerStack: House { 
       displayname = "4 x 12 Marshall Stack"; 
       scope = 2;
       soundEngine[] = {"Stacks\sound\hum", 1, 1}
       vehicleClass = "Marshall_Amps"; 
       model = "Stacks\horde_speakerCab.p3d"; 
   };  
};

Share this post


Link to post
Share on other sites

@Das Attorney - Here is the complete fake vehicle for the engine sound:

http://tetet.de/arma/arma3/nimitz/experimental/JDG_carrier_Fake_Veh.7z

It's a much more heavy weight approach than just adding the sound to the House class, as it presents a vehicle in it's own right, merely used for the engine idle sound. I guess one could reduce the vehicle config footprint a lot, but I have no plans to invest time in that, sorry.

Share this post


Link to post
Share on other sites

Thanks TeTeT, I have downloaded it and will see if I can reduce the footprint - If so, I'll upload for you.

It took me a while to find the vehicle - I didn't realise it was like 1 micron in length :)

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  

×