NPC Voice Driven by Real-Time Sound Diffraction in Unreal Engine 5
I want to show a new feature I've added to my "Dynamic Diffraction" project: an NPC whose voice reacts to the acoustics around it. 🗣️
The vocal effort is picked from how far the sound actually has to travel to reach you, rather than from the straight line distance. So if you are standing two steps away but behind a wall, the NPC starts shouting. The sound has to go all the way around a corner to get to you. And you can hear it doing exactly that, since the voice runs through the diffraction system like any other sound would.
It also chooses what to say based on the acoustic situation. There are separate lines for being behind a wall, being just around a corner, and the moment you step out of sight.
The voice lines are pre-generated locally with an AI voice model, using recordings of my own voice as the reference. There is one render per line for each effort level. Beware, there are some noticeable artifacts, especially in the shouted lines. It is a strange feeling to hear a slightly wrong version of your own voice shouting at you 😆
Let me know if you have any feedback or ideas for improvement 😃