Drive how much a sound gets played with parameter

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

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

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.

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.

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.

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.

Thanks for the idea, I will definitely try that.