@met4citizen/headtts 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -10
- package/modules/language-en-us.mjs +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -188,14 +188,14 @@ of strings or inputs items.
|
|
|
188
188
|
|
|
189
189
|
Type | Description | Example
|
|
190
190
|
---|---|---
|
|
191
|
-
`text` | Speak the text in `value`. This is equivalent to giving a pure string input. | <pre
|
|
192
|
-
`speech` | Speak the text in `value` with corresponding subtitles in `subtitles` (optional). This type allows the spoken words to be different that the subtitles. | <pre
|
|
193
|
-
`phonetic` | Speak the model specific phonetic alphabets in `value` with corresponding `subtitles` (optional). | <pre
|
|
194
|
-
`characters` | Speak the `value` character-by-character with corresponding `subtitles` (optional). Supports also numbers that are read digit-by-digit. | <pre
|
|
195
|
-
`number` | Speak the number in `value` with corresponding `subtitles` (optional). The number should presented as a string. | <pre
|
|
196
|
-
`date` | Speak the date in `value` with corresponding `subtitles` (optional). The date is presented as milliseconds from epoch. | <pre
|
|
197
|
-
`time` | Speak the time in `value` with corresponding `subtitles` (optional). The time is presented as milliseconds from epoch. | <pre
|
|
198
|
-
`break` | The length of the break in milliseconds in `value` with corresponding `subtitles` (optional). | <pre
|
|
191
|
+
`text` | Speak the text in `value`. This is equivalent to giving a pure string input. | <pre>{<br> type: "text",<br> value: "This is an example."<br>}</pre>
|
|
192
|
+
`speech` | Speak the text in `value` with corresponding subtitles in `subtitles` (optional). This type allows the spoken words to be different that the subtitles. | <pre>{<br> type: "text",<br> value: "One two three",<br> subtitles: "123"<br>}</pre>
|
|
193
|
+
`phonetic` | Speak the model specific phonetic alphabets in `value` with corresponding `subtitles` (optional). | <pre>{<br> type: "phonetic",<br> value: "mˈɜɹʧəndˌIz",<br> subtitles: "merchandise"<br>}</pre>
|
|
194
|
+
`characters` | Speak the `value` character-by-character with corresponding `subtitles` (optional). Supports also numbers that are read digit-by-digit. | <pre>{<br> type: "characters",<br> value: "ABC-123-8",<br> subtitles: "ABC-123-8"<br>}</pre>
|
|
195
|
+
`number` | Speak the number in `value` with corresponding `subtitles` (optional). The number should presented as a string. | <pre>{<br> type: "number",<br> value: "123.5",<br> subtitles: "123.5"<br>}</pre>
|
|
196
|
+
`date` | Speak the date in `value` with corresponding `subtitles` (optional). The date is presented as milliseconds from epoch. | <pre>{<br> type: "date",<br> value: Date.now(),<br> subtitles: "02/05/2025"<br>}</pre>
|
|
197
|
+
`time` | Speak the time in `value` with corresponding `subtitles` (optional). The time is presented as milliseconds from epoch. | <pre>{<br> type: "time",<br> value: Date.now(),<br> subtitles: "6:45 PM"<br>}</pre>
|
|
198
|
+
`break` | The length of the break in milliseconds in `value` with corresponding `subtitles` (optional). | <pre>{<br> type: "break",<br> value: 2000,<br> subtitles: "..."<br>}</pre>
|
|
199
199
|
|
|
200
200
|
*TODO: Add support for `audio` type.*
|
|
201
201
|
|
|
@@ -223,10 +223,12 @@ An example using an array of input items:
|
|
|
223
223
|
|
|
224
224
|
# NodeJS WebSocket/RESTful Server: `headtts-node.mjs`
|
|
225
225
|
|
|
226
|
-
Install
|
|
226
|
+
Install (requires Node.js v20+):
|
|
227
227
|
|
|
228
228
|
```bash
|
|
229
|
-
|
|
229
|
+
git clone https://github.com/met4citizen/HeadTTS
|
|
230
|
+
cd HeadTTS
|
|
231
|
+
npm install
|
|
230
232
|
```
|
|
231
233
|
|
|
232
234
|
Start the server:
|
|
@@ -427,14 +427,14 @@ class Language extends LanguageBase {
|
|
|
427
427
|
const n = parseFloat(num);
|
|
428
428
|
if (num == "0") {
|
|
429
429
|
return "ZERO";
|
|
430
|
-
} else if(num.toString().startsWith('0')){
|
|
431
|
-
return this.convertDigitByDigit(num).trim();
|
|
432
430
|
} else if (num < 0 ) {
|
|
433
431
|
return "MINUS " + this.convertNumberToWords( Math.abs(num).toString() ).trim();
|
|
434
432
|
} else if ( n && !Number.isInteger(n) ) {
|
|
435
433
|
const parts = n.toString().split('.');
|
|
436
434
|
return this.convertNumberToWords(parts[0]).trim() + " POINT " + this.convertDigitByDigit(parts[1]).trim();
|
|
437
|
-
} else if
|
|
435
|
+
} else if(num.toString().startsWith('0')){
|
|
436
|
+
return this.convertDigitByDigit(num).trim();
|
|
437
|
+
} else if ((num<1000 && num>99 && (num % 100) !== 0) || (num>10000&&num<1000000)) { //read area and zip codes digit by digit
|
|
438
438
|
return this.convertDigitByDigit(num).trim();
|
|
439
439
|
} else if ((num > 1000 && num < 2000)||(num>2009&&num<3000)) { //read years as two sets of two digits
|
|
440
440
|
return (num % 100 != 0 ? this.convertSetsOfTwo(num).trim() : this.convertTens(num.toString().substring(0, 2)).trim() + " HUNDRED");
|