# Best way to trigger voice lines?

**URL:** <https://qa.fmod.com/t/best-way-to-trigger-voice-lines/20657>\
**Category:** FMOD Studio\
**Created:** [September 15, 2023, 11:30am UTC](https://qa.fmod.com/t/best-way-to-trigger-voice-lines/20657 "2023-09-15T11:30:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![trjaudio](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@trjaudio](https://qa.fmod.com/u/trjaudio)\
**Post date:** [September 15, 2023, 11:30am UTC](https://qa.fmod.com/t/best-way-to-trigger-voice-lines/20657/1 "2023-09-15T11:30:52Z")

</div>

Hi. I have some voice lines that I want to trigger.

I can go about it 2 ways as I see it:  
The “A” way.

I have 4 words in the game. I want to be able to control in what order those 4 words are played, to create many combinations of sentences from the 4 words. A (weird) example could be this:  
I have the following words. “Hello”, “Goodbye”, “Start”, “Stop”.  
I want to be able to dynamically create, from a parameter any combination of those words. For instance “Hello Start Stop Goodbye” or “Stop Start Goodbye Hello” or any other combination.

I also want to have 3 versions of each word, so the sentence wont sound the exact same, even though I have the exact same sentence triggered 10 times in a row.

So far so good.

I have set up an event where I, on the time line, have the 4 different words, each with their own playlist of 3 variations of each word. I then set up destination markers and transition markers, driven by a parameter called “Speak”. The “speak” parameter is set as “User:Labeled” and each value is tied to a word.

So if I press play and go scroll through each of the values on the parameter, I get sentences.

The idea is then that the programmer will write a command that contains a string of the right words, with a small delay between each parameter change. That should then form a sentence.

The problem is though, that I can end up in a situation where 2 parameter changes have happened before the word is finished and then there would be a word skipped in the sentence.  
Is there a smarter way to do this?  
Or to stack/que parameter changes, so I make sure that they all are recieved and trigger the correct word?

Another way (the “B” way), would be to go with a Programmer instrument. The problem there is that I don’t get the randomization. I would have to make one single audio file for each sentence, and don’t get the granularity/randomization that I would like.

Any ideas or suggestions?  
Thanks 🙂

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [September 18, 2023, 6:42am UTC](https://qa.fmod.com/t/best-way-to-trigger-voice-lines/20657/2 "2023-09-18T06:42:02Z")

</div>

Hi,

What version of FMOD are you using?

> [@trjaudio](#):
>
> Is there a smarter way to do this?  
> Or to stack/que parameter changes, so I make sure that they all are recieved and trigger the correct word?

Unfortunately, there isn’t this specific functionality in Studio. You could utilize [Studio | Studio Guide - Event Callback](https://fmod.com/docs/2.02/api/studio-guide.html#event-callbacks) to trigger sending the next parameter which would make sure they are only sent at the end of the current event. An alternative would be using [FMOD Studio | Instrument Reference - Command Instrument](https://fmod.com/docs/2.02/studio/instrument-reference.html#command-instrument).

> [@trjaudio](#):
>
> would be to go with a Programmer instrument

I think this would be the best option as you could have all the audio files in a single [FMOD Studio | Dialogue and Localization - Audio Table](https://fmod.com/docs/2.02/studio/dialogue-and-localization.html#audio-tables) which could then utilize a single instrument. You could then create the sentence via code and use an [FMOD Studio | Studio Guide - Event Callback](https://fmod.com/docs/2.02/api/studio-guide.html#event-callbacks) to trigger the whole sentence.

> [@trjaudio](#):
>
> granularity/randomization that I would like.

This could still be applied to the programmer instrument using parameters and [FMOD Studio | Authoring Events - Automation](https://fmod.com/docs/2.02/studio/authoring-events.html#automation).

---

<div class="post-metadata">

**Author:** ![trjaudio](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@trjaudio](https://qa.fmod.com/u/trjaudio)\
**Post date:** [September 18, 2023, 6:47am UTC](https://qa.fmod.com/t/best-way-to-trigger-voice-lines/20657/3 "2023-09-18T06:47:12Z")

</div>

Thanks. Using 2.02.15

I will have an in depth look at your answers once the programmer has time.

Thanks for getting back to me

---

<div class="post-metadata">

**Author:** ![trjaudio](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@trjaudio](https://qa.fmod.com/u/trjaudio)\
**Post date:** [September 18, 2023, 9:09am UTC](https://qa.fmod.com/t/best-way-to-trigger-voice-lines/20657/4 "2023-09-18T09:09:18Z")

</div>

By the way. You said that I could use the command instrument. What would that approach look like/how would it solve stuff?  
Thanks

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [September 19, 2023, 1:58am UTC](https://qa.fmod.com/t/best-way-to-trigger-voice-lines/20657/5 "2023-09-19T01:58:08Z")

</div>

Hi,

You could use the command instruments to set the parameter and automate the value via code. This way the parameters are only set when the command instrument is reached by the playback position.

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

`CodeControlledValue` can be changed hopefully without skipping other words.

Let me know if this fits the behavior you are looking for.

---

<div class="post-metadata">

**Author:** ![trjaudio](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@trjaudio](https://qa.fmod.com/u/trjaudio)\
**Post date:** [September 19, 2023, 9:13am UTC](https://qa.fmod.com/t/best-way-to-trigger-voice-lines/20657/6 "2023-09-19T09:13:14Z")

</div>

I have to say that I don’t fully follow you. This is what I am doing:

 ![billede](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/3/343caf1e7b63d04a4671a1fb8365eee65dc6bb53.png)

I have a parameter called “Speak” that is set to User:Labeled and then value 0=Stop, Value1=WordA, Value2=b etc.

I have placed the “Word A” (etc) transition at the end of each word.  
The problem is that if I quickly skip the “Speak” value, faster than the words are being said/are finished, there will be underlying words that will not be played.

Thanks

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [September 21, 2023, 12:29am UTC](https://qa.fmod.com/t/best-way-to-trigger-voice-lines/20657/7 "2023-09-21T00:29:04Z")

</div>

Hi,

Thank you for sharing the screenshot.

Looking at the event I believe your best option would be to use individual events that have callbacks on `FMOD_STUDIO_EVENT_CALLBACK_STOPPED` ([FMOD Engine | Studio API Reference - FMOD\_STUDIO\_CALLBACK\_TYPE](https://fmod.com/docs/2.02/api/studio-api-eventinstance.html#fmod_studio_event_callback_type:~:text=playing.%20Parameters%20%3D%20unused.-,FMOD_STUDIO_EVENT_CALLBACK_STOPPED,-The%20event%20has)). You then pass the next event with the desired parameters to be played which would allow for much easier expansion rather than having to add more transition regions to the parent event.

I would also suggest utilizing [FMOD Studio | Glossary - Defaults](https://fmod.com/docs/2.02/studio/glossary.html#default) this allows for events to have the same base setup and quick expansion if more words are added.

---

<div class="post-metadata">

**Author:** ![trjaudio](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@trjaudio](https://qa.fmod.com/u/trjaudio)\
**Post date:** [September 21, 2023, 8:22am UTC](https://qa.fmod.com/t/best-way-to-trigger-voice-lines/20657/8 "2023-09-21T08:22:53Z")

</div>

Thanks 🙂
