You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+73-8Lines changed: 73 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,8 +5,24 @@ Simple tts (text-to-speech) module for Titanium SDK. Allows you to say a sentenc
5
5
## Methods
6
6
7
7
- <b>init()</b>
8
-
- <b>speak(string)</b> - There is a character limit of 4000 characters per speak method
9
-
- <b>synthesizeToFile(string)</b>
8
+
- <b>init( engine: string )</b> - Init specific TTS Engine if available
9
+
- <b>speak({ text: string, uid: string, volume: float, pan: float, flush: boolean })</b> - There is a character limit (of 4000 characters) per speak method. The exact maximum allowed length can be read from the bufferlen property.
- <b>getVoices( filter: string )</b> - Returns a string with voices separated by a `|`. Optionally you can pass in a string to filter on voices names, for example `de-de` to only get German voices.
15
+
- <b>getVoiceList( filter: string )</b>
16
+
- <b>getEngines()</b>
17
+
- <b>getEngineList()</b>
18
+
- <b>getEnginePackageList()</b> - The Engines' Package Name for init(engine) and setEngine(engine).
19
+
- <b>getLanguages()</b>
20
+
- <b>getLanguageList()</b>
21
+
- <b>getVoiceFeatures( voice: string )</b>
22
+
- <b>initSilent()</b> - Init without events emitter (except for the init event once).
23
+
- <b>emitEvents()</b> - Start events emitter.
24
+
- <b>separateSpeaker()</b> - Return a new Instance of TTS ( Experimental feature, marked as Deprecated to notify it).
25
+
- <b>setEngine( engine: string )</b> - Deprecated, because do not emit the init event when the engine is ready. Use init(engine) instead.
10
26
11
27
## Properties
12
28
@@ -15,35 +31,84 @@ Simple tts (text-to-speech) module for Titanium SDK. Allows you to say a sentenc
15
31
- <b>voices</b> (getter): string. Returns a string with voices separated by a `|`. Optional you can pass in `de-de` to only get German voices.
16
32
- <b>voice</b> (setter): string
17
33
- <b>language</b> (setter): string. e.g. `de` or `en`
34
+
- <b>speaking</b> (getter): boolean. (DO NOT RELY ON THIS ON INIT! You could need to start flushing the queque after init. )
35
+
- <b>bufferlen</b> (getter): int. Maximum length of the text string to read (Usually 4000 character)
18
36
19
37
## Events
20
38
21
-
- <b>init()</b>: when TTS is ready
22
-
- <b>done()</b>: returns `blob` with the sound file
39
+
- <b>init</b>: when TTS is ready - CallBack({ status: int })
- flush: Boolean, FLUSH the speak queque or ADD the text to speak to the queue (only for speak method).
74
+
- blob: Retrive Blob to done event (only for synthesizeToFile method).
75
+
- filename: File name (only for synthesizeToFile method).
76
+
- uid: Utterance ID.
77
+
78
+
## Notes
79
+
80
+
- There is a limit of bufferlen (4000) characters for each call to speak and synthesizeToFile.
81
+
- Sometimes after the init event a queque FLUSH could be needed to start speaking (especially if speaking is true).
82
+
24
83
## Example
25
84
26
85
```js
27
86
consttts=require("ti.tts");
28
87
constwin=Ti.UI.createWindow();
29
88
30
-
win.open();
89
+
tts.addEventListener("init", function(e) {
90
+
91
+
tts.speak({text:"Hello World!", flush:true});
92
+
});
31
93
32
94
win.addEventListener("open", function() {
33
95
tts.init();
34
96
});
35
-
tts.addEventListener("init", function(e) {
36
-
tts.speak("Hello");
97
+
win.addEventListener("close", function() {
98
+
tts.shutdown();
37
99
});
100
+
101
+
win.open();
38
102
```
39
103
40
104
## Note
41
105
42
106
Needs Android 21 or higher.
43
107
44
108
45
-
## Author
109
+
## Authors
46
110
47
111
* Michael Gangolf (<ahref="https://github.com/m1ga">@MichaelGangolf</a> / <ahref="https://www.migaweb.de">Web</a>)
112
+
* T. A. (<ahref="https://github.com/informate">@TA</a> / <ahref="https://www.informate.it">Web</a>)
48
113
49
114
<spanclass="badge-buymeacoffee"><ahref="https://www.buymeacoffee.com/miga"title="donate"><imgsrc="https://img.shields.io/badge/buy%20me%20a%20coke-donate-orange.svg"alt="Buy Me A Coke donate button" /></a></span>
0 commit comments