-
-
Notifications
You must be signed in to change notification settings - Fork 18
Synth
Matěj Štágl edited this page Dec 18, 2018
·
5 revisions
Speech synthesizer is a brand new feature to SGML. It allows for converting strings to voice output, wav files and several other formats. Synth speak functions can be executed either on the main thread which will result in lock of this thread in the same way show_message
works, or asynchronously on a new thread created especially for the function call. Only one speak function can be executed on a single Synthesizer at time, function calls will be automatically queued. In case you need multiple speak functions to be executed you need to instantiate more instances of Synthesizer:
SpeechSynthesizer mySynth = new SpeechSynthesizer();
synth_speak_async("Hello world"); // Will be executed on a synth default to SGML
synth_speak_async("One more sound", mySynth); // Will be executed on mySynth, resulting in both sounds being played at once
Synthesizers are disposable so remember to clear them from memory once they are not needed:
mySynth.Dispose();
Back to Manual