# Playback of the sound of firing at a distance

**URL:** <https://qa.fmod.com/t/playback-of-the-sound-of-firing-at-a-distance/17816>\
**Category:** FMOD Studio\
**Created:** [October 19, 2021, 6:32pm UTC](https://qa.fmod.com/t/playback-of-the-sound-of-firing-at-a-distance/17816 "2021-10-19T18:32:16Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Koett](https://avatars.discourse-cdn.com/v4/letter/k/ecccb3/32.png) [@Koett](https://qa.fmod.com/u/Koett)\
**Post date:** [October 19, 2021, 6:32pm UTC](https://qa.fmod.com/t/playback-of-the-sound-of-firing-at-a-distance/17816/1 "2021-10-19T18:32:16Z")

</div>

Hello!

Faced with this problem.  
I am trying to implement a tank shot.  
I have 3 types of shot samples (close range, medium and long range).  
I have an event which contains these 3 samples.  
I need the samples to be played depending on the distance (for example on distance of 1km the sample “far distance” will be played.  
The thing is that I make RTS game and the camera is mostly high above the terrain.  
How do I do it?  
And is there such a possibility using one event?

With respect,  
Alex

---

<div class="post-metadata">

**Author:** ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)\
**Post date:** [October 19, 2021, 8:04pm UTC](https://qa.fmod.com/t/playback-of-the-sound-of-firing-at-a-distance/17816/2 "2021-10-19T20:04:44Z")

</div>

> [@Koett](#):
>
> And is there such a possibility using one event?

Yes, by using the built-in distance parameter.

> [@Koett](#):
>
> The thing is that I make RTS game and the camera is mostly high above the terrain.  
> How do I do it?

What’s the problem? Do you want the height of the camera to be taken into account or not?

---

<div class="post-metadata">

**Author:** ![Koett](https://avatars.discourse-cdn.com/v4/letter/k/ecccb3/32.png) [@Koett](https://qa.fmod.com/u/Koett)\
**Post date:** [October 19, 2021, 8:56pm UTC](https://qa.fmod.com/t/playback-of-the-sound-of-firing-at-a-distance/17816/3 "2021-10-19T20:56:13Z")

</div>

Hello, thanks for the quick reply! I’ve already sorted it out.  
I created a parameter “continious” from 0 to 2 and specified the required distance to enable the sample in the automation of this parameter

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/4/4350df5bc876edbb8037c649cbf7878fba44243b.png)

---

<div class="post-metadata">

**Author:** ![Koett](https://avatars.discourse-cdn.com/v4/letter/k/ecccb3/32.png) [@Koett](https://qa.fmod.com/u/Koett)\
**Post date:** [October 19, 2021, 8:59pm UTC](https://qa.fmod.com/t/playback-of-the-sound-of-firing-at-a-distance/17816/4 "2021-10-19T20:59:09Z")

</div>

I wanted to play the sample that I wanted (namely the sound of the shot at a long distance). I also set up all the necessary automation in the distance parameter (volume, lowpass, etc.).  
Seems to be working stable for now.

---

<div class="post-metadata">

**Author:** ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)\
**Post date:** [October 19, 2021, 9:05pm UTC](https://qa.fmod.com/t/playback-of-the-sound-of-firing-at-a-distance/17816/5 "2021-10-19T21:05:46Z")

</div>

Why do you put your instruments in the “Size\_Shooting” parameter sheet, with this parameter automated by the built-in Distance parameter, instead of putting directly your instruments in the Distance parameter sheet? Check the explosion event in the exemples provided with FMOD Studio to see what I’m talking about.

---

<div class="post-metadata">

**Author:** ![Koett](https://avatars.discourse-cdn.com/v4/letter/k/ecccb3/32.png) [@Koett](https://qa.fmod.com/u/Koett)\
**Post date:** [October 19, 2021, 9:32pm UTC](https://qa.fmod.com/t/playback-of-the-sound-of-firing-at-a-distance/17816/6 "2021-10-19T21:32:30Z")

</div>

Yes, I’ve tried putting the samples in “distance”, but when I fly the camera around the scene in unity, the samples play constantly. I’ve only recently started working in FMOD, maybe there’s a feature that turns this off.

---

<div class="post-metadata">

**Author:** ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)\
**Post date:** [October 19, 2021, 9:41pm UTC](https://qa.fmod.com/t/playback-of-the-sound-of-firing-at-a-distance/17816/7 "2021-10-19T21:41:55Z")

</div>

To avoid multiple triggering, you probably just have to check “hold value during playback” on the “distance” parameter.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/0/06187df147cd9ffa8b09c1a5f525aa9a51212d41.png)  
By the way, I don’t really get how did you avoid the problem by automating one parameter by another…

---

<div class="post-metadata">

**Author:** ![Koett](https://avatars.discourse-cdn.com/v4/letter/k/ecccb3/32.png) [@Koett](https://qa.fmod.com/u/Koett)\
**Post date:** [October 19, 2021, 9:46pm UTC](https://qa.fmod.com/t/playback-of-the-sound-of-firing-at-a-distance/17816/8 "2021-10-19T21:46:07Z")

</div>

yes by the way I didn’t check that value, I’ll try it now.

---

<div class="post-metadata">

**Author:** ![Koett](https://avatars.discourse-cdn.com/v4/letter/k/ecccb3/32.png) [@Koett](https://qa.fmod.com/u/Koett)\
**Post date:** [October 19, 2021, 10:06pm UTC](https://qa.fmod.com/t/playback-of-the-sound-of-firing-at-a-distance/17816/9 "2021-10-19T22:06:02Z")

</div>

Yes what you advised me works. thank you very much!  
If you don’t mind me asking one more question.  
For some reason it’s starting to work like this now… If I quickly change the value of the distance parameter (roughly speaking, quickly approaching a unit with the camera, then this origneous point moves very smoothly with a delay, before this did not happen).  
I.e. I am at an altitude of 500m, then quickly move the camera to the object, then a very slow sound increases.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/9/9007ac8ce7fafd945b4f2478ccf22d191e48d258.png)

---

<div class="post-metadata">

**Author:** ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)\
**Post date:** [October 19, 2021, 10:11pm UTC](https://qa.fmod.com/t/playback-of-the-sound-of-firing-at-a-distance/17816/10 "2021-10-19T22:11:06Z")

</div>

You probably set a seek speed you don’t want, on the parameter: ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/c/c38ad6a5941eb76d0d6af3a5646c24a0d084f009.png)

---

<div class="post-metadata">

**Author:** ![Koett](https://avatars.discourse-cdn.com/v4/letter/k/ecccb3/32.png) [@Koett](https://qa.fmod.com/u/Koett)\
**Post date:** [October 19, 2021, 10:15pm UTC](https://qa.fmod.com/t/playback-of-the-sound-of-firing-at-a-distance/17816/11 "2021-10-19T22:15:51Z")

</div>

YES its work.  
thx , big thanks 😉

---

<div class="post-metadata">

**Author:** ![Skaven252](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/skaven252/32/63_2.png) [@Skaven252](https://qa.fmod.com/u/Skaven252)\
**Post date:** [October 23, 2021, 3:02pm UTC](https://qa.fmod.com/t/playback-of-the-sound-of-firing-at-a-distance/17816/12 "2021-10-23T15:02:56Z")

</div>

If you put the 3 distance shots on 3 tracks on the Timeline, you can trigger them in sync, and automate the volume of each track by distance. That way you can blend between the distances smoothly so that you get a nice result at any distance without sudden changes in sound.
