Multi Instrument to loop only one instrument


(Christian) #1

Hey there folks !

Sorry in advance if I overlooked a similar thread here.

Here is the situation:

I am trying to emulate a firesound (as a trap against ice foes)
I have three different fire cracking/burning sounds on an audio track as a multi instrument.

The three are randomized with order and pitch, so as to get a different sound for every fire trap I lay on the ground.

Here is the tricky part:

The traps will burn for 15 seconds and then the fire will die unless the player adds wood, which will renew the burn time.

I want to be able to loop one firetrap but every time the loop starts over, a different sound is triggered, which obviously sounds very weird.

Is there a way to tell FMOD that it should loop ONLY the one sound it used for one trap?

That would be awesome :slight_smile:

Thx y’all


(Joseph Harvey) #2

So, you’ve got a series of audio files designed to loop. You want to create an event that, when triggered, plays one of these audio files on loop for fifteen seconds - and you want players to be able to reset the timer at any time without changing which audio file is playing.

That’s no problem. There’s a number of different ways in which you could do this, but this one is the easiest:

  1. Create an event.
  2. Add a new parameter to the event. Name this parameter “Fires” and give it any range you like. (The default of 0-1 will work just fine.)
  3. Set the parameter’s initial value to exactly half of its range. (If you went with the default range of 0-1, you should set the initial value to 0.5.)
  4. Add a random modulator to the parameter value, and set it to 100%.
  5. On the Fires parameter, create one single instrument for each of your fire audio files, and lay them out evenly along the parameter. (Or unevenly, if you prefer. The important thing is that there should be no gaps between them, and no areas of overlap.)

You’ll never need to set the Fires parameter in your game code. Instead, whenever an instance of the event starts playing, its Fires parameter will be given a random value. This randomly selects a new audio audio asset to play when an instance of the event starts playing, but not subsequently.

  1. Create a new preset parameter. Name it “Timer” and give it a range of 0-16.
  2. Give the Timer parameter a velocity of 1/s.
  3. Assign each of the instruments in your event a parameter condition for the Timer parameter, and set the range to 0-15.
  4. Enable cut mode for each of the instruments.

The Timer parameter acts as a fifteen-second timer that starts the moment the event does. Once it hits 15, whichever instrument is currently playing will stop playing. All you need to do to reset the timer is set the timer parameter back to 0.

Let us know if this method doesn’t suit the requirements of your project; as I said above, there are a umber of other ways in which you could achieve the same thing.


(Christian) #3

Wow, thank you for this very detailed answer.
I must admit though, that I’m quite new to FMOD, so let me give it a try and I shall report back with results (if I can manage to implement your tips)

Have a good one
Chris