RPG Dialogue Generator

I created a module to dynamically generate character dialogue in Unity, using Wwise to handle all audio. It was designed with flexibility in mind, so that a single script could be used for all characters' dialogue in the context of a hypothetical game. For demonstration purposes, I exposed all variables as sliders to be edited in real time.


 
  • Download .zip file (above)
  • Extract to desired location
  • Launch Application file
 
  • On your Android device, go to Settings > Security
  • Allow installation of apps from unknown  sources
  • Download .pkm file (above) to device
  • Installation should begin automatically

Phonemes are selected through a Switch Container in Wwise.

Creating Intelligent Gibberish

For the generated dialogue, I wanted to achieve stylized gibberish in the vein of Animal Crossing, but slightly more legible.

To do this, I determined which basic phonemes were most vital for recognizable English speech, and recorded them. The engine then manipulates these phonemes in real time and plays them back in quick succession, creating the illusion of speech.

Defining Unique Characters

I chose to define each character's voice through five core parameters:

  1. Pitch - One of the simplest ways to change a voice also proved to be one of the most effective. I also used pitch to imply questions and randomized all pitches slightly to create natural variation.

  2. Volume - While volume could be used to create a distinctly loud or quiet character, this parameter is best used within the code's Enunciate method, which makes a sentence louder if it ends in an exclamation point!

  3. Gender - This one was trickier to implement than I'd originally planned. At first, I tried to imply gendered voices by filtering between formant frequencies, but Wwise lacked a reliable way to do this. Eventually, I decided to record a second set of phonemes using a girl's voice and create a Blend Container in Wwise to morph between the two.

  4. Tone - Here I used Wwise's Tremolo effect to add a toothy edge to the voice. In a game, effects like these could be rapidly added and tweaked as needed.

  5. Speed - This is the only parameter not directly used by Wwise. Instead, it is used in the module's code to determine the delay between phonemes. The higher the speed, the smaller the delay.

Each NPC is assigned values for each of these parameters, either through hard code,  in the Inspector window for that character, or using the live GUI sliders when running. The "Random" and "Default" buttons allow for quick adjustments.


"Consult your programmer..."

Before taking on this project, I'd only ever worked in isolated pieces of the game audio pipeline. Working like this, I became increasingly aware of the murky gaps in-between where the work became "someone else's job."

That didn't sit right with me. I knew I would become much more confident in my various isolated skills if I could see them all come together.

So with this, I set out to follow the pipeline entirely on my own, from initial recording to functional executable. This meant extending outside of my usual scope into programming, graphic design, UI design, and even some sprite art, but I am very pleased with the end result.

codeBreakdown
 
pseudocode_01-02.png
pseudocode_03.png
pseudocode_04.png
pseudocode_05.png