Warning: include(/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php): failed to open stream: No such file or directory in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Warning: include(): Failed opening '/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Notice: Undefined index: OFPEC in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152
    Home   Help Login Register  

Author Topic: Attach sound to projectile  (Read 2107 times)

0 Members and 1 Guest are viewing this topic.

Offline Dobermann

  • Members
  • *
  • Ready to disturb you anytime
Attach sound to projectile
« on: 11 Jul 2007, 13:28:30 »
Hi !

I can detect that a d30 has fired a shot with eventhandler fired. Now I want to have a sound attached to the projectile that got fired. Is there any way this can be done with scripting only ? The sound should move along with the projectile. I guess I can´t use the projectile as a "speaker" as it´s no live unit and looping a speaker along the flightpath of the projectile will probably not work that good.
Any ideas ?

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Attach sound to projectile
« Reply #1 on: 11 Jul 2007, 13:58:20 »
Configure your sound in description.exp

Code: [Select]
class CfgSounds
{
sounds[] = {D30_sound};

class D30_sound
{
name = "D30_sound";
sound[] = {"D30_sound.ogg", db-0, 1.0};
titles[] = {0};
};
};

Then, when you get the round object:
Code: [Select]
_object say "D30_sound";

D30_sound.ogg should be "mono" and stored into the "Sound" folder of your mission.

Offline Dobermann

  • Members
  • *
  • Ready to disturb you anytime
Re: Attach sound to projectile
« Reply #2 on: 13 Jul 2007, 02:14:31 »
Had to grin a bit when I read the reply.
I just forgot that "say" also works with objects. At some point I tend to get lost while editing.
Still, there is a problem for me making this work good.
UNN provided me some code for eventhandler and script and I embedded it but it sounds not really satisfying.
I do not know what is wrong particularely, maybe it´s Arma sound engine that makes it sound stupid, maybe it´s a flaw in the code.
I call the emitter script with this eventhandler from init of d30 gun:

Code: [Select]
this AddEventHandler ["Fired",{[_This Select 0, NearestObject [_This Select 0,_This Select 4]] ExecVM "arisound.sqs"}]
The arisound.sqs looks like this:
Code: [Select]
_Gun= _This Select 0;
_Round= _This Select 1;

//Length of the sound sample in seconds
_SoundDuration=2;

WaitUntil
       {
_Round Say "arifly";

       Sleep _SoundDuration;

       !(Alive _Round)
       };

I actually had to put the volume of the sound very high to be hearable at all. It´s about +50 db now.
But it plays somehow wrong. It sounds like it´s speed up and I do not get the feeling of a projectile flying over my head. There´s also a gap of half a second before the projectile detonates where it´s totally silent, although the sound is definately longer than the time it take for the projectile to fly.

I´m a bit confused on the bad results.

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: Attach sound to projectile
« Reply #3 on: 13 Jul 2007, 02:19:52 »
The game runs into trouble when an object is saying something on the move. I had a helicopter flying around me and I tried to simulate loud speakers on it. I used the "Say" command and ingame it warped terribly. Speeding up and slowing down as the chopper flew about.

Unfortunatley I never got over the problem. :confused:
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Dobermann

  • Members
  • *
  • Ready to disturb you anytime
Re: Attach sound to projectile
« Reply #4 on: 13 Jul 2007, 08:25:00 »
I guess the bad result is an effect of the changed soundpath engine in Arma. It seems to apply the same effect that can be heard when a tank is speed up by some event. Still, the altering of the sound is so bad that it´s almost impossible to get it sound straight.
Still, there has to be a way to get it done properly as there are already sounds for projectiles in mods that do not sound that weird. I guess I will send Goeth a PM, maybe he has an idea.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Attach sound to projectile
« Reply #5 on: 13 Jul 2007, 09:52:30 »
In sound mods the sounds are defined in the addond config, not in any mission, and that is totally different thing than the one you're trying to achieve here..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Dobermann

  • Members
  • *
  • Ready to disturb you anytime
Re: Attach sound to projectile
« Reply #6 on: 13 Jul 2007, 11:29:47 »
I know but the principle should be the same as the projectile in both cases is the sound emitter and I do not think that
those emitters are handled different by the engine.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Attach sound to projectile
« Reply #7 on: 13 Jul 2007, 11:58:41 »
I use the method described above for my missiles, and the "object class" of these missiles is in most cases a missile, a bomb or a shell. So far the sound works well, while the maximum speed I did test is only around 900 m/s.

You may do a test, attach a camera to the your projectile (a _shell switchCamera "EXTERNAL" should be enough) and check how that sound is heard this way, because may be your problem is with the sound propagation system of ArmA.

Offline Dobermann

  • Members
  • *
  • Ready to disturb you anytime
Re: Attach sound to projectile
« Reply #8 on: 16 Jul 2007, 21:18:32 »
After some testing I can now confirm that it is an issue with the new Arma sound routines. They do alter the sound with fast moving objects in a very surreal way. I guess there is a max speed at which the sound calculations are doing fine. Above that speed the sound gets out of control.
However, there are exclusions for the sound engine. Goeth told me that supersonicCrackNear[] and supersonicCrackFar[] have different configs that work very well with the engine but are different than the rest of the sound implementations.
I guess I will send Suma a PM about this. Maybe there is a way to bypass the alternation of custom embedded sounds or have the sound class altered with a patch with the settings of supersonicCrackNear[] or supersonicCrackFar[] values. I guess this would make embedding custom sounds for any kind of useage a perfect deal for mission editors.
I can´t think of a downside, if you have obligations, please post.