1 /** 2 * Cross-engine Text To Speech (TTS) interface. 3 * 4 * This module publicly imports the system default engine implementation of this interface. 5 * Currently, the default engine is Microsoft Speech API (SAPI) on Windows, and eSpeak for 6 * every other platform. 7 * 8 * Only cross-platform features are documented here. Documentation for implementation-specific 9 * features can be found in their respective modules. 10 */ 11 module speech.synthesis; 12 13 version(Windows) 14 { 15 public import speech.windows.synthesis; 16 } 17 else 18 { 19 public import speech.espeak.synthesis; 20 } 21 22 version(speech4d_ddoc): 23 24 /// Speech synthesizer for Text To Speech. 25 struct Synthesizer 26 { 27 /// Create a new speech synthesis interface using the system default voice. 28 static Synthesizer create(); 29 30 /// Speak a string of text. 31 void speak(in char[] text); 32 33 /// Ditto 34 void speak(in wchar[] text); 35 36 /// Synthesizer is an $(D OutputRange) of strings. 37 alias put = speak; 38 39 /// Voice to use for speech synthesis. 40 void voice(Voice newVoice) @property; 41 42 /// Ditto 43 Voice voice() @property; 44 45 /// Volume of speech playback in the range 0-100. 46 void volume(uint newVolume) @property; 47 48 /// Ditto 49 uint volume() @property; 50 51 /// Rate of speech synthesis. 52 void rate(int newRate) @property; 53 54 /// Ditto 55 int rate() @property; 56 } 57 58 /// Represents a single voice to use with speech synthesis. 59 struct Voice 60 { 61 /// Name of this voice. 62 string name() @property; 63 } 64 65 /// Get an $(D InputRange) of $(D Voice) enumerating all voices installed on the system. 66 auto voiceList() {} 67