Adding voicelines to Narrat

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!

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:

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, in macros.yaml:

macros:
  - keyword: voiced
    label: voiced
    options:
      - name: character
        type: string
      - name: pose
        type: string
      - name: audio
        type: string
      - name: sentence
        type: string
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

1 Like

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

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 doc:
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:
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:
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:
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!