I discovered this Youtube video by Equalo where he makes an Animal Crossing style voice generator in Python and wanted to adapt it to GDScript as a fun placeholder dialogue audio system when making games with Godot Engine.
The letter sounds are taken from his animalese-generator repo here.
Checkout this Reddit post to see a video of it in action!
- Add ACVoicebox.tscn to your scene.
- To read a string aloud pass it like
$ACVoicebox.play_string('Your example string!')
- The pitch can be varied by setting
$ACVoicebox.base_pitch
between 2.5 and 4.5. - The
characters_sounded
signal is emitted with the spoken characters as an argument when each sound is made, it can be used to make letters appear on the screen as the dialogue is spoken. - The
finished_phrase
signal is emitted once all the characters have been spoken.
- Use AudioEffectPitchShift to vary the pitch rather than
pitch_scale
inAudioStreamPlayer
so that we don't speed up/slow down the dialogue when changing pitch.