# Drive how much a sound gets played with parameter

**URL:** https://qa.fmod.com/t/drive-how-much-a-sound-gets-played-with-parameter/14384
**Category:** Unity
**Created:** [February 22, 2019, 2:06am UTC](https://qa.fmod.com/t/drive-how-much-a-sound-gets-played-with-parameter/14384 "2019-02-22T02:06:23Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![rhinoceroz](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@rhinoceroz](https://qa.fmod.com/u/rhinoceroz)
#### Post date: [February 22, 2019, 2:06am UTC](https://qa.fmod.com/t/drive-how-much-a-sound-gets-played-with-parameter/14384/1 "2019-02-22T02:06:23Z")

</div>

Hi - Let’s say I have a sound in FMOD, beginning of sound is 0% and the end of the sound file is 100%. Is it possible to control how much of that sound gets played through the Z translation of a gameobject? Example: Let’s say the player pulls the gameobject +20 units in Z, then FMOD plays 20% of the sound. Player pulls another 10 units, then another 10% of the sound gets played. It would be like controlling FMOD playback through Unity. Thanks

---

<div class="post-metadata">

### Author: ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)
#### Post date: [February 22, 2019, 3:23am UTC](https://qa.fmod.com/t/drive-how-much-a-sound-gets-played-with-parameter/14384/2 "2019-02-22T03:23:40Z")

</div>

Are you referring to starting the sound at different times depending on the Z positioning? You can do this by automating the offset of the instrument by a parameter, then using the Z position of the game object to set the parameter passed in through game code. Here’s an example of the instrument set up in FMOD Studio:

![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/1X/ba8cf1ccb51aa264a978b2dfceb96e4dfce81e87.png)

If you need an entire event to be offset, you will need to make that event an event instrument to access the offset property.

If you are referring to playing “chunks” of sound based on the amount of movement then you can set up small instruments to be triggered on a parameter that is also set up to have the Z position set as the parameter value.

If I’m misunderstanding your question please let me know.

---

<div class="post-metadata">

### Author: ![rhinoceroz](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@rhinoceroz](https://qa.fmod.com/u/rhinoceroz)
#### Post date: [February 22, 2019, 4:01pm UTC](https://qa.fmod.com/t/drive-how-much-a-sound-gets-played-with-parameter/14384/3 "2019-02-22T16:01:39Z")

</div>

hi, I basically have a drawer that’s physics based. Player can open it by dragging it. I want my “drawer sound” to play a certain % depending on how far the player opens/closes it. So I think your offset idea might work. Do you have an example on how to set that up? I’m fairly new to FMOD, still learning the ins and outs. Thanks.

---

<div class="post-metadata">

### Author: ![rhinoceroz](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@rhinoceroz](https://qa.fmod.com/u/rhinoceroz)
#### Post date: [February 22, 2019, 5:06pm UTC](https://qa.fmod.com/t/drive-how-much-a-sound-gets-played-with-parameter/14384/4 "2019-02-22T17:06:56Z")

</div>

hi, I was able to expose the offset and control it with the z translation, however that’s not what I need. How far the person pulls the drawer dictates how much of the sound gets played (play 15% of it, 20%, play the entire thing, etc) Basically I need a way to control the instrument timeline through my z translation.

---

<div class="post-metadata">

### Author: ![magomusica](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/magomusica/32/420_2.png) [@magomusica](https://qa.fmod.com/u/magomusica)
#### Post date: [February 22, 2019, 11:56pm UTC](https://qa.fmod.com/t/drive-how-much-a-sound-gets-played-with-parameter/14384/5 "2019-02-22T23:56:40Z")

</div>

I would rethink how you’re designing and implementing the sound.

How about a looping sound that starts at a random point using the offset parameter mentioned above. If it’s physics based, the player can open and close the drawer at variable velocity. So make a velocity parameter that controls the volume, and maybe subtle pitching. Maybe make 2 or 3 layers that fade in or out with lower or higher velocities.

---

<div class="post-metadata">

### Author: ![rhinoceroz](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@rhinoceroz](https://qa.fmod.com/u/rhinoceroz)
#### Post date: [March 1, 2019, 12:08am UTC](https://qa.fmod.com/t/drive-how-much-a-sound-gets-played-with-parameter/14384/6 "2019-03-01T00:08:36Z")

</div>

Thanks for the idea, I will definitely try that.
