This tutorial assumes you have completed the Tutorial 05a.
It is also recommended you have already took the previous tutorials.
Here is again the dialogue tree we created in last tutorial:
We want, whenever characters are talking, correct audio is heard.
This is up to you. Use any preferred recording studio and get good sounding voice actors. We can't really help.
You have three options. Either make each visible “onscreen line” a separate file, or record whole conversation to single file. It is harder to sync out separate files, but might be more memory efficient. Or use combined methods, like we do now.
Once you have your voices sampled (or you can use the samples mr. Reece was kind to donate: Premade sounds by mr. Reece, for the use of this tutorial only).
Place them in a new folder inside data folder called Sounds
Now we want to “link” the files and the sounds. First we have to load them to Dage, by adding following line inside InitDialog function, in a conversations.txt.
-- Let's add All Dialogue sound effects. Sound.AddSpeechFX("Sounds/WhoAreYou.ogg","who"); Sound.AddSpeechFX("Sounds/ImRob.ogg","ImRob"); Sound.AddSpeechFX("Sounds/ImBob.ogg","ImBob"); Sound.AddSpeechFX("Sounds/Nice2Meet.ogg","Nice2Meet"); Sound.AddSpeechFX("Sounds/likewise.ogg","likewise"); Sound.AddSpeechFX("Sounds/WhereAmI.ogg","WhereAmI"); Sound.AddSpeechFX("Sounds/ThisIsR2.ogg","ThisIsR2"); Sound.AddSpeechFX("Sounds/wow.ogg","wow");
AddSpeechFX has two parameters. First is the file and second is the key to the audio file.
Then make sure you have created handler for Sound in GUI.txt file:
Sound = TSound.Create();
Next we use the keys, we created in AddSpeechFX, by just adding to the beginning of corresponding line inside curly brackets like this:
function WhoAreYou() Dialog.HideNodes(); MainActor.Say("{who}Who are you?"); Robby.Say("{ImRob}I'm Robby, and you are?"); MainActor.Say("{ImBob}I'm Bobby"); Robby.Say("{Nice2Meet}Nice to meet you"); MainActor.Say("{likewise}Likewise",0,'ShowStartNode'); end function WhereAmI() Dialog.HideNodes(); MainActor.Say("{WhereAmI}Where am I?"); Robby.Say("{ThisIsR2}This is Room02 in Tutorial for"); Robby.Say("Creating Dage Adventures"); MainActor.Say("{wow}Wow",0,'ShowStartNode'); end
Note that
Robby.Say("{ThisIsR2}This is Room02 in Tutorial for"); Robby.Say("Creating Dage Adventures");
doesn't have brackets in both texts, because the first audio file contains both.
Finally make sure that you sometime unload all the speech files, so your memory is not drained.
Add inside ExitDialog function
Sound.UnloadSpeech();
That's it.
Off to test. You might want to adjust the sound files right amount of time.