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.
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.
The speech's voice can be adjusted by changing the parameters;
setParams(unsigned int aBaseFrequency, float aBaseSpeed, float aBaseDeclination, int aBaseWaveform)
The default parameters for these are 1330 for frequecy, 10 for speed, 0.5 for declination and KW_SQUARE as waveform. The easiest way to understand what these parameters do and how they affect the voice is to play with the "speechfilter" demo that is part of the megademo example.
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.
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.
If looping is enabled, the loop point is, by default, the start of the stream. The loop point can be changed, and current loop point can be queried with these functions.
double t = snd.getLoopPoint(); snd.setLoopPoint(t + 1); // skip 1 second more when looping ... snd.setLoopPoint(0); // loop from start
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-2018 Jari Komppa