Playing a sound fo each letter when text is animating

Hello, I am trying to make the characters sound when typed, similar to the example published at https://demo.narrat.dev/.
I have saved the sound files letter-1.wav, letter-2.wav, … in public/audio
The audio.yaml configuration file has content similar to the example:

files:
   letter-a:
     src: audio/letter-1.wav
   letter-b:
     src: audio/letter-2.wav
   letter-c:
     src: audio/letter-3.wav
...
options:
   volume: 0.5
   musicFadeInTime: 0.5
   musicFadeInDelay: 0.5
   musicFadeOutTime: 0.5

audioTriggers: {}

dialogAudio:
   defaultAudio:
     soundPerLetter:
       prefix: letter-
   characterAudio:
     boss:
       soundPerLetter:
         prefix: letter-
     player:
       soundPerLetter:
         prefix: letter-

“boss” is a character in my program.

If in game.narrat I put
play sound letter-a
a beep sounds. But when the texts are written, nothing.

In the common.yaml file inside dialogPanel is animateText: true

I have searched and tried a lot, but I have not found anything. I have not found the configuration files for the example either. Some help?.

I wonder if it could just be from being on an old version and the feature not being there? The config file looks correct to me otherwise, and if the sound plays by itself it all looks good…

When you look at the inspector console in your browser, at some point early on in the logs it says which version of narrat is running, in green

image

If it has some older one, try updating (npm install narrat@latest). and if it’s not updating properly, try deleting the node_modules folder and then running npm install again.

If not that, I don’t know, are there any errors or anything weird going on?

Thanks for answering.
I think the problem is this:

The AudioContext was not allowed to start. …

But at the moment I haven’t seen how to solve it. It happens to me in all browsers. Any ideas?

The feature for those letter sounds was added in 3.8.0

You’re running an older one than that so you just need to update narrat

It works now.

When updating the version it gave problems. I reinstalled everything and updated. Perfect.

Thank you very much for your help.

1 Like