Fork me on GitHub


The SoLoud::Speech class implements a simple Klatt-style formant speech synthesizer. It's barely legible, not really human-like, but it's free, and it's here.

Adjusting the speech synthesizer's output with audio filters should allow for various voices, which, along with subtitles, will let you add voice to your games cheaply.

For more serious use, feel free to study the source code and play with the various internal parameters, as well as apply various filters to the sound.

For legal notes, please see the license page.


The setText function can be used to set the text to be spoken.

SoLoud::Speech sp;
sp.setText("Hello world.  You will be assimilated.");

If the setText function is called while speech is playing, SoLoud stops any playing instances to avoid crashing.

Trying to set the text to NULL will return an error code.


This function can be used to set the speech to loop.


Calling this function will not affect "live" sound sources.


As with any other audio source, you can attach filters to speech audio sources.

gRobot.setFilter(0, &gRobotize);


You can stop all instances of a speech sound source with stop(). This is equivalent of calling soloud.stopAudioSource() with the sound source.

gHeyListen.stop(); // shut up already!


Set the inaudible behavior of the sound. By default, if a sound is inaudible, it's paused, and will resume when it becomes audible again. With this function you can tell SoLoud to either kill the sound if it becomes inaudible, or to keep ticking the sound even if it's inaudible.

// Keep on talking even if I'm not around
gSpeech.setInaudibleBehavior(true, false);


Set the default volume of the instances created from this audio source.


Inherited 3d audio interfaces

Like all other audio sources, Speech inherits the 3d audio interfaces. Please refer to the 3d audio chapter for details on:

Copyright©2013-2015 Jari Komppa