How to: Animal Crossing Dialogue Sounds


*I'm using Yarn Spinner through Unity to handle dialogue -- but I think the principles laid out here should follow for custom dialogue systems, and other game engines*


I'm working on GOODLANDS, a game about "dinos digging up dinos" -- which is a cute way of describing a fossil hunting game set in a small open world where you and all the characters are dinosaurs (or other prehistoric animals).

Early on in development, I decided I wanted to give my characters distinct "voices." My first thought was to implement a similar system to what is seen in Undertale, where characters have unique voices composed of a single sound played when each letter is printed to the dialogue box (e.g., sans with "duh-duh-duh"). 

But before I got to that -- I found a video on YouTube by Blipsounds, which explained how he went about replicating the Animal Crossing: New Horizons style of dialogue sounds. This concept immediately appealed to me because it would:

1) make the dialogue sound slightly more like some kind of gibberish language, which I liked the idea of

2) allow me to put my friends and family's voices into the game

Tutorial Below!

I set out to work out a way to replicate this technique using the free tools I had access to. Here's how I went about it:

First, I recorded myself saying the alphabet in Audacity. I used a Blue Snowball microphone for this, and I'd recommend you use a quality mic for this. I left the first five seconds of the recording blank so I could perform noise reduction on it, and then I exported each letter as a separate .wav file. 

I then created an empty game object in Unity and added an AudioSource component, and a custom component  which I will call "sfx" for the sake of simplicity. It contained an AudioClip[] (array) and a reference to the AudioSource component attached to the game object. In the AudioClip[] , I added all 26 .wav files, and added a final entry (27th entry, index = 26) and left it blank. 

Then, I wrote a variation of the pseudo code you see below in my dialogue runner:

foreach (char c in text) // (i)
{
    index = char.ToUpper(c) - 65; // (ii)
    if (index < 0) // (iii)
        {
            index = 26; // (iv)
        }
    sfx.audioSource.clip = sfx.audioClip[index]; // (v)
    sfx.audioSource.Play(); // (vi)
}

(i) Most dialogue systems iterate over each character in a line to print each letter, one at a time, like a typewriter. I just take advantage of that existing structure to perform actions as the dialogue runner iterates over the characters.

(ii) The first thing I do is calculate an int value called "index." It consists of finding the unicode value for the upper case version of the letter [char.ToUpper(c)], and then subtracting that value by 65. The reason for taking the upper case unicode value is because we only want one sound for both the upper and lower case versions of a letter.

Let's say our first word is "Are" -- the for loop iterates over each character ("A" then "r" then "e"). The index for "A" is 65 - 65 = 0, the index for "r" is 82 - 65 = 17, and the index for "e" is 69 - 65 = 4. 

(iii + iv) I then check to see if the index is less than 0 -- if it is then the character is not a letter. I assign the index the value, 26, which was the empty slot I made in AudioClip[] earlier. 

(aside: in my project, I made special exceptions here for numbers, which occupy the 48-57 spots in the unicode decimal system and assigned them a random index from 0-25)

(v) Then, I load the AudioSource component (which is referenced in the sfx component) with a .wav file from AudioClip[] using the index we calculated in (ii). This means that for the letter "A" (or "a") the index will be 0, and so we will pull the 0th clip from AudioClip[], and put it into the clip field within AudioSource.

(vi) The script then tells the AudioSource to play the sound it has loaded. If the index is 26, there will be no sound. This means that punctuation and spaces will be honored by the system, allowing for a speech pattern that mimics the words being printed out in real time.

Watch the first ~20s of the video at the top of the page if you'd like to hear how the dialogue sounds turned out.

Please don't hesitate to ask questions!

-------

The great thing about this is that you can then record people's voices and put them into your game as characters. You can also add in a pitch slider onto different characters to provide even more variety for the you have voices.

A few notes: 

-I replaced the "c" and "s" files with "k" and "z," respectively. I didn't like the "s" sound that these letters made, and found it distracting -- I much prefer the replacements.

-I also added in head movement with the dialogue. This is easily done by adding a reference to the active character's head bone (armature), and scaling it up and down on each for loop pass.

-All the voices I use are automatically set at a pitch of 2 -- I recommend using something around this to get the cute effect, and potentially moving the pitch ± 0.5 to produce variation.

-You may need to play with the length of the audio clips, and the speed of your dialogue system to get the sounds to the place you want them to be at.

-If you're interested in using YarnSpinner for your dialogue system, here are two videos that really help with getting started: 

Getting Started with Yarn Spinner and YarnSpinner for Unity Guide

-I would also highly recommend using YarnSpinner's discord for questions you have about setup (it was very helpful!)

If you're interested, consider giving the project a follow here on itch! Or you can follow progress on my YouTube channel or Twitter :)

Comments

Log in with itch.io to leave a comment.

(+2)

This is a rad resource, thanks!

no worries :) really glad to hear it!