Trigger sound effect upon parameter change

Hi,

I’m a beginner just doing my first project in FMOD Studio after following some tutorials and reading up on the documentation.

I have my first project pretty nicely setup, except for one thing that I don’t seem to be able to implement: the triggering of an instrument to play upon parameter change.

Here’s the idea: I have some background ambience music playing constantly. Upon the change of value of a binary parameter (discrete parameter with minimun value 0 and maximum value 1) I need two things to happen:

  • when the parameter goes from 0 to 1, I need the volume of the continuous ambience track to go up
  • when the parameter goes from 1 ot 0, I need a short sound effect to be played and the ambience volume to be turned down

I can easily manage the ambience volume part through parameter bound automation of the volume. But how do I add that sound effect to be played? Mind that it is not a transition, nor the triggering of a loop. I simply need the ambience to continue to be played, but at a higher/lower volume.

Thanks a lot for your insights!

Hi and welcome!

Just to precise some things:

  • If you use discrete parameter instead of continuous, you won’t be able to have a smooth volume change ; isn’t it a problem?
  • How is set your main loop? A synced single instrument within a loop region? (a screenshot would help)
  • You want your short sound effect to by played at 0 except at the beginning (0 being the default value), correct?

Depending of your answer to the 2 first questions, there’s several possibilities for the third point.
Actually, if you stay with a discrete parameter (which I won’t do, when volume automation is involved), it’s rather simple: a parameter sheet playing the sound at 0, and a third default value for the beginning (say -1).
If you want your discrete parameter to trigger a smooth volume change, it could be done by a snapshot (but requires some special routing to the project mixer).
With a continuous parameter (which is the solution I would recommend), the SFX could be played within a transition region.

Hi,

Thanks a lot for your swift reply.

To the answers:

  • the parameter is discrete on purpose; the discreet volume change is indeed a feature, not a bug :slight_smile:
  • the main loop indeed is a synced single instrument within a loop region (and a transition region with a transition condition based on another parameter)

Here are some screenshots (I have extremely wide instrument blocks, as it’s all precomposed and not looping):

Detail:

Some background: this is a game where one has to avoid being caught by a simple laser/light sensor trap. If one does trigger the laser defence system, I need to audio (aptly called missionimpossible in the screenshot :-)) to go down in volume, but also for a loud screeching alarm trigger to be heard. Later, when the lasers are activated again, the missionimpossible ambience can be loud again.

About your last question: I’m not sure what you mean exactly with ‘at 0’. I try to explain: at any time within the missionimpossible loop, a laser trap can be triggered, resulting in the screech, but also in the continuation of the ambience (not restarting), simply at a lower volume.

Thank you so much for thinking along with me!

By ‘at 0’, I mean the value of the parameter you were talking about. So is it 0 the default (starting) value? What is the parameter you were talking about? “Lasers active”?

By the way, what’s the purpose of the transition region we see on the second screenshot? (Lasers to Siren)

Do you mean the volume down effect should be triggered only the first time but not anymore?

Ah, now I see.

Ok, here’s the full event description:

  • one enters the room: ambience plays, all parameters are at 0
  • one finds and presses the right button: ambience gets replaced by missionimpossible at high volume, buttons_pressed_first_time goes to 1, lasers_active goes to 1
  • one triggers the laser protection: screeching alarm sounds once, missionimpossible continues at low volume, buttons_pressed_first_time stays on 1, lasers_active goes back to 0
  • one presses the right button again: missionimpossible continues at high volume, buttons_pressed_first_time stays on 1, lasers_active jumps up to 1 again
  • one manages to open the gate protected by the lasers: missionimpossible is replaced with siren, buttons_pressed_first_time stays on 1, lasers_active is 0 again, gate_opened is now 1
  • game is over

All this works perfectly fine, even with some transition timelines (which I didn’t elaborate on above).

So, the volume for missionimpossible jumps up and down, as long as the player doesn’t manage to successfully pass the lasers to open the gate and has to retry.

Thanks again, I hope this is clear.

So if I understand well, you can’t manage to get the screeching alarm sound while continuing the music at low volume.
If I were you, I’d merge all parameters in one labelled parameter, called, say, “Progression”, with 4 values : Ambient (0), Lasers active (1), Protection active (2), Game Over (3). Set the volume automation of Mission Impossible track for values 1 and 2. Open the parameter sheet and put the screeching alarm sound in it, at value 2. Don’t put the sound in the timeline. The Progression parameter going from 1 to 2 (or from 2 to 1) should be set to have no impact on the timeline (so the music to play continuously).

However if you want to keep things as they are, you should put your SFX in the “Lasers active” parameter sheet, at value 0, with the trigger behavior condition “Button pressed” = 1.

Yes, of course! I totally missed the possibility of adding sounds into parameter sheets. Thank you so much.

And, indeed, your bonus tip is also great: I’ll investigate if it’s a good idea to merge my three parameters together into one Progression parameter. Perhaps a labelled one makes sense here. I’m thinking about the API implementation, to keep it clean and clear there as well.

Thank you so much again for the great help!

Actually, labelled and discrete is exactly the same, labels are only reminders inside FMOD studio.

I realized that it may be that you didn’t understand one point: when I told you should convert your discrete parameter to continuous, I wasn’t saying you should redesing everything. I was just saying you should use a continuous parameter with discrete values. If you set an appropriate “seek speed”, changing discretely from 0 to 1 on a continuous parameter would allow the volume automation to be done less abruptly, for instance in 300 ms, which is better to the ears than 0 ms!

Aha, yes I see; it would indeed make sense to have some sort of fade-in/fade-out. In face, I have now converted the event to a single labelled (same as discreet, indeed) parameter, with one extra ‘intermediate’ parameter with its own ambient music volume and a command instrument that updates the parameter itself.

A hack, I agree… let me experiment with continuous parameters a bit…

And what does trigger the command instrument? The timeline? If so, why not automating the volume directly in the timeline?

Changing for one unique continuous parameter with a seek speed, which is the thing to do until smooth discrete transitions hasn’t been added to FMOD (I’ve heard it was planned), will get you a few problems, though:

  • You’ll have to trick the value range of your alarm sound to have it instantaneously played.
  • Going from value 1 (Lasers on) to 3 (game over) will trigger the alarm sound (on value 2), and won’t transition instantaneously. Solution: keep “game over” on a separate parameter (which could be dedicated to transitions in the timeline, Ambiant as well).