# Adding voicelines to Narrat

**URL:** <https://narrat.discourse.group/t/adding-voicelines-to-narrat/442>\
**Category:** Help\
**Created:** [26 September 2025 13:12 UTC](https://narrat.discourse.group/t/adding-voicelines-to-narrat/442 "2025-09-26T13:12:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ether](https://yyz2.discourse-cdn.com/free1/user_avatar/narrat.discourse.group/ether/32/488_2.png) [@Ether](https://narrat.discourse.group/u/Ether)\
**Post date:** [26 September 2025 13:12 UTC](https://narrat.discourse.group/t/adding-voicelines-to-narrat/442/1 "2025-09-26T13:12:37Z")

</div>

Hewwo!

I want to add pre-recorded voices to the dialogues of my Narrat game. I’m not thinking about barks or sounds per letter, but actual voicelines recorded by VA.

My current understanding is to use `play sound` and manually add all the voicelines at the right place each time. Is that correct?

I’m also not sure how to let the player interrupt the voiceline if they’re moving forward faster than the voiceline?

Thank you!

---

<div class="post-metadata">

**Author:** ![liana](https://yyz2.discourse-cdn.com/free1/user_avatar/narrat.discourse.group/liana/32/428_2.png) [@liana](https://narrat.discourse.group/u/liana)\
**Post date:** [26 September 2025 14:49 UTC](https://narrat.discourse.group/t/adding-voicelines-to-narrat/442/2 "2025-09-26T14:49:47Z")

</div>

There isn’t yet a feature for voices, so yes something like that. One thing that would help would be to make a function and/or macros to simplify it, like:

```auto
voiced character pose audio sentence:
  play sound $audio
  talk $character $pose $sentence
  stop sound $audio

main:
  run voiced myCharacter idle "voice_line_01" "Some text"

```

Then this could be simplified a bit more with a [macro](https://docs.narrat.dev/scripting/macros.html#macros), in `macros.yaml`:

```yaml
macros:
  - keyword: voiced
    label: voiced
    options:
      - name: character
        type: string
      - name: pose
        type: string
      - name: audio
        type: string
      - name: sentence
        type: string

```

```auto
main:
  voiced myCharacter idle "my_audio_file" "My sentence"

```

I don’t really know if it will work or not, but it might be decent

---

<div class="post-metadata">

**Author:** ![Ether](https://yyz2.discourse-cdn.com/free1/user_avatar/narrat.discourse.group/ether/32/488_2.png) [@Ether](https://narrat.discourse.group/u/Ether)\
**Post date:** [26 September 2025 15:04 UTC](https://narrat.discourse.group/t/adding-voicelines-to-narrat/442/3 "2025-09-26T15:04:15Z")

</div>

Thank you! I will give it a go and let you know.

---

<div class="post-metadata">

**Author:** ![Ether](https://yyz2.discourse-cdn.com/free1/user_avatar/narrat.discourse.group/ether/32/488_2.png) [@Ether](https://narrat.discourse.group/u/Ether)\
**Post date:** [28 September 2025 17:53 UTC](https://narrat.discourse.group/t/adding-voicelines-to-narrat/442/4 "2025-09-28T17:53:02Z")

</div>

It took a little tinkering, but it does work! Thank you again.

I’m adding the full process here in case anyone else wonders about it:

1. Create a `macros.yaml` and add it to `index.ts` as per the [macros](https://docs.narrat.dev/scripting/macros.html#macros) doc:

```auto
macros:
  - keyword: voiced
    label: voiced
    options:
      - name: character
        type: string
      - name: pose
        type: string
      - name: audio
        type: string
      - name: sentence
        type: string

```

1. Add your audio files to your `src` folder and to `audio.yaml` as you would for music, for example:

```auto
files:
  background_music:
    loop: true
    volume: 0.5
    src: music/music.mp3
  my_voiceline:
    src: audio/voiceline.ogg
  my_second_voiceline:
    src: audio/voiceline_2.ogg
options:
  volume: 1.5

```

I recommend setting the `volume` of your music lower than the voicelines like so, but do what feels right for your game.

1. Add the `voiced` function in your `game.narrat` file or equivalent:

```auto
voiced character pose audio sentence:
  stop sound
  play sound $audio
  talk $character $pose $sentence
  stop sound $audio

```

The first `stop sound` is here to stop the previous line from being spoken over the next one in case of the “continue” button being clicked faster than the voice is being read.

The very last voiceline will be read in its entirety no matter what but I didn’t have the capacity to look for a solution to that.

1. Add your voiced lines in your game labels where needed, for example:

```auto
main: 
voiced character idle "my_voiceline" "This is me saying a voiceline!"
voiced character idle "my_second_voiceline" "And now this is me saying another voiceline!"

```

And done!
