echogarden 0.9.2 → 0.10.0

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.
Files changed (74) hide show
  1. package/README.md +3 -7
  2. package/data/schemas/options.json +57 -26
  3. package/dist/api/Alignment.d.ts +4 -4
  4. package/dist/api/Alignment.js +31 -31
  5. package/dist/api/Alignment.js.map +1 -1
  6. package/dist/api/Denoising.d.ts +9 -3
  7. package/dist/api/Denoising.js +9 -9
  8. package/dist/api/Denoising.js.map +1 -1
  9. package/dist/api/LanguageDetection.d.ts +13 -17
  10. package/dist/api/LanguageDetection.js +13 -17
  11. package/dist/api/LanguageDetection.js.map +1 -1
  12. package/dist/api/Recognition.d.ts +4 -4
  13. package/dist/api/Recognition.js +10 -12
  14. package/dist/api/Recognition.js.map +1 -1
  15. package/dist/api/Synthesis.d.ts +10 -6
  16. package/dist/api/Synthesis.js +61 -25
  17. package/dist/api/Synthesis.js.map +1 -1
  18. package/dist/api/Translation.d.ts +4 -4
  19. package/dist/api/Translation.js +11 -12
  20. package/dist/api/Translation.js.map +1 -1
  21. package/dist/api/Vad.d.ts +5 -8
  22. package/dist/api/Vad.js +12 -14
  23. package/dist/api/Vad.js.map +1 -1
  24. package/dist/audio/AudioPlayer.d.ts +1 -1
  25. package/dist/audio/AudioPlayer.js +12 -14
  26. package/dist/audio/AudioPlayer.js.map +1 -1
  27. package/dist/audio/AudioUtilities.d.ts +2 -0
  28. package/dist/audio/AudioUtilities.js +28 -0
  29. package/dist/audio/AudioUtilities.js.map +1 -1
  30. package/dist/audio/SoxPath.js +4 -0
  31. package/dist/audio/SoxPath.js.map +1 -1
  32. package/dist/cli/CLI.js +84 -120
  33. package/dist/cli/CLI.js.map +1 -1
  34. package/dist/codecs/FFMpegTranscoder.d.ts +1 -0
  35. package/dist/codecs/FFMpegTranscoder.js +48 -2
  36. package/dist/codecs/FFMpegTranscoder.js.map +1 -1
  37. package/dist/denoising/RNNoise.js.map +1 -1
  38. package/dist/dsp/MFCC.js.map +1 -1
  39. package/dist/nlp/JapaneseSegmentation.js +3 -2
  40. package/dist/nlp/JapaneseSegmentation.js.map +1 -1
  41. package/dist/recognition/WhisperSTT.js +2 -2
  42. package/dist/recognition/WhisperSTT.js.map +1 -1
  43. package/dist/server/Client.d.ts +10 -8
  44. package/dist/server/Client.js +56 -59
  45. package/dist/server/Client.js.map +1 -1
  46. package/dist/server/Server.js +23 -12
  47. package/dist/server/Server.js.map +1 -1
  48. package/dist/server/Worker.d.ts +28 -11
  49. package/dist/server/Worker.js +44 -11
  50. package/dist/server/Worker.js.map +1 -1
  51. package/dist/speech-language-detection/SileroLanguageDetection.js +2 -2
  52. package/dist/speech-language-detection/SileroLanguageDetection.js.map +1 -1
  53. package/dist/synthesis/EspeakTTS.js +2 -3
  54. package/dist/synthesis/EspeakTTS.js.map +1 -1
  55. package/dist/synthesis/GoogleTranslateTTS.js.map +1 -1
  56. package/dist/synthesis/MicrosoftEdgeTTS.js +1 -1
  57. package/dist/synthesis/MicrosoftEdgeTTS.js.map +1 -1
  58. package/dist/synthesis/VitsTTS.js.map +1 -1
  59. package/dist/utilities/Logger.d.ts +2 -2
  60. package/dist/utilities/Logger.js +7 -9
  61. package/dist/utilities/Logger.js.map +1 -1
  62. package/dist/utilities/ObjectUtilities.js +4 -1
  63. package/dist/utilities/ObjectUtilities.js.map +1 -1
  64. package/dist/utilities/PackageManager.js +3 -1
  65. package/dist/utilities/PackageManager.js.map +1 -1
  66. package/dist/utilities/Timeline.js.map +1 -1
  67. package/dist/utilities/Utilities.d.ts +1 -0
  68. package/dist/utilities/Utilities.js +6 -0
  69. package/dist/utilities/Utilities.js.map +1 -1
  70. package/docs/API.md +188 -0
  71. package/docs/Options.md +30 -23
  72. package/docs/Server.md +110 -0
  73. package/docs/Tasklist.md +4 -8
  74. package/package.json +7 -7
package/docs/Server.md ADDED
@@ -0,0 +1,110 @@
1
+ # Starting and interfacing with the WebSocket server
2
+
3
+ ## Starting the server
4
+
5
+ ```bash
6
+ echogarden serve [options]
7
+ ```
8
+
9
+ **Options** (all optional):
10
+ * `port`: Port number. Defaults to `45054`
11
+ * `secure`: Start a secure server? Defaults to `false`
12
+ * `certPath`: Path to a certificate file, required when `secure = true`
13
+ * `keyPath`: Path to a private key file, required when `secure = true`
14
+ * `deflate`: Use per-message deflate. Defaults to `true`
15
+ * `maxPayload`: Maximum raw message payload size (in bytes). Defaults to `1000 * 1000000` (1GB)
16
+ * `useWorkerThread`: Run worker in a separate thread. Defaults to `true` (recommended to leave as is)
17
+
18
+ ## The protocol
19
+
20
+ The protocol is based on binary WebSocket messages, for both request and response objects. Messages are encoded using the [MessagePack](https://msgpack.org/index.html) encoding scheme.
21
+
22
+ All messages are objects and have the basic structure:
23
+
24
+ ```ts
25
+ {
26
+ messageType: string
27
+ requestId: string
28
+
29
+ // ... other data specific for the target message type
30
+ }
31
+ ```
32
+
33
+ The `messageType` property is a string representing the operation to perform. These operations are parallel to the methods provided by the Node.js API. They can be one of:
34
+
35
+ * `SynthesisRequest`
36
+ * `VoiceListRequest`
37
+ * `RecognitionRequest`
38
+ * `AlignmentRequest`
39
+ * `SpeechTranslationRequest`
40
+ * `SpeechLanguageDetectionRequest`
41
+ * `TextLanguageDetectionRequest`
42
+
43
+ When sending a message, `requestId` should contain a long random string that uniquely identifies your request, like `cb7e0f3ec835a213b005c4424c8d5775`.
44
+
45
+ For example, this message requests synthesis:
46
+ ```ts
47
+ {
48
+ messageType: 'SynthesisRequest',
49
+ requestId: 'cb7e0f3ec835a213b005c4424c8d5775',
50
+
51
+ input: 'Hello World!',
52
+
53
+ options: {
54
+ engine: 'espeak',
55
+ voice: 'en-GB'
56
+ }
57
+ }
58
+ ```
59
+
60
+ After a message is sent, the server may send one or more response messages. Each response message includes the `requestId` identifier that was given on the request it replies to. The response message `messageType` can be:
61
+
62
+ * `SynthesisResponse`, `SynthesisSegmentEvent`, `SynthesisSentenceEvent`
63
+ * `VoiceListResponse`
64
+ * `RecognitionResponse`
65
+ * `AlignmentResponse`
66
+ * `SpeechTranslationResponse`
67
+ * `SpeechLanguageDetectionResponse`
68
+ * `TextLanguageDetectionResponse`
69
+
70
+ The properties included in the response objects, are similar to the ones returned by the API.
71
+
72
+ Example response, for the above synthesis request:
73
+
74
+ ```ts
75
+ {
76
+ messageType: 'SynthesisResponse',
77
+ requestId: 'cb7e0f3ec835a213b005c4424c8d5775',
78
+
79
+ rawAudio: {
80
+ sampleRate: 22050,
81
+ channels: [ ... ] // An array of `float32` sample data
82
+ }
83
+
84
+ // ... other result object properties
85
+ }
86
+ ```
87
+
88
+ ## Client package (future)
89
+
90
+ For Node.js clients, there is a simpler client class, that allows to wrap communications with with the server in a more convenient interface.
91
+
92
+ Currently, the client is is embedded in the original codebase. This means you have to import the entire package to use it.
93
+
94
+ In the future, this module would be separated to an independent lightweight package.
95
+
96
+ ## Web-based user interface (future)
97
+
98
+ When an HTTP web-based user interface is developed, it would be integrated with the WebSocket server and share the same port.
99
+
100
+ Currently, if you start a non-secure server and try to open `http://localhost:45054` (or another port you specified), you should see a placeholder message saying:
101
+
102
+ ```
103
+ This is the Echogarden HTTP server!
104
+ ```
105
+
106
+ If you can't see this message, there may be a configuration issue, or some other problem.
107
+
108
+ ## TODO
109
+
110
+ Expose more operations to the server.
package/docs/Tasklist.md CHANGED
@@ -42,9 +42,7 @@
42
42
 
43
43
  ### Worker
44
44
  * Add cancelation checks in more operations
45
- * Optionally omit unnecessary data from the response (decoded input, segment data, etc.)
46
45
  * Support more operations
47
- * Support compressed audio in response
48
46
 
49
47
  ### CLI
50
48
  * Show names of files written do disk. This is useful for cases where a file is auto-renamed to allow overwrite.
@@ -53,7 +51,6 @@
53
51
  * Consider what to do with non-supported templates like `[hello]`
54
52
  * Show a message when a new version is available
55
53
  * Figure out which terminal outputs should go to stdout, or if that's a good idea at all
56
- * Option to set audio output codec options
57
54
  * Option to set audio output device for playback
58
55
  * Print available synthesis voices when no voice matches (or suggest near matches)
59
56
  * `transcribe` may also accept `http://` and `https://` URLs and pull the remote media file
@@ -83,9 +80,9 @@
83
80
 
84
81
  ### CLI / New commands
85
82
  * `speak-youtube`: To speak the subtitles of a YouTube video
86
- * `play-with-captions`: Preview captions in terminal
83
+ * `play-with-subtitles`: Preview subtitles in terminal
87
84
  * `play-with-timeline`: Preview timeline in terminal
88
- * `captions-to-text`, `captions-to-timeline`, `srt-to-vtt`, `vtt-to-srt`
85
+ * `subtitles-to-text`, `subtitles-to-timeline`, `srt-to-vtt`, `vtt-to-srt`
89
86
  * `crop-to-timeline`, `split-by-timeline`
90
87
  * `text-to-ipa`, `arpabet-to-ipa`, `ipa-to-arpabet`
91
88
  * `phonemize-text`
@@ -110,7 +107,6 @@
110
107
  ### Segmentation
111
108
  * Split long words
112
109
  * See if it's possible to reliably use eSpeak as a segmentation engine
113
- * Path to `kuromoji` dictionaries can be found more reliably than current
114
110
 
115
111
  ### Subtitles
116
112
  * If a subtitle is too short and at the end of the audio, try to extend it back if possible (for example, if the previous subtitle is already extended, take back from it)
@@ -139,10 +135,10 @@
139
135
 
140
136
  ### Synthesis / preprocessing
141
137
  * Extend the heteronyms JSON document with additional words like "conducts", "survey", "protest", "transport", "abuse", "combat", "combats", "affect", "contest", "detail", "marked", "contrast", "construct", "constructs", "console", "recall", "permit", "permits", "prospect", "prospects", "proceed", "proceeds", "invite", "reject", "deserts", "transcript", "transcripts", "compact", "impact", "impacts"
142
- * Full date normalization (e.g. `21 August 2023`, `21 Aug 2023`)
138
+ * Full date normalization (e.g. `21 August 2023`, `21 Aug 2023`, `August 21, 2023`)
143
139
  * Add support for capitalized-only rules, and possibly also all uppercase / all lowercase rules.
144
- * Support normalizing to graphemes, not only phonemes
145
140
  * Add support for multiple words in `precededBy` and `succeededBy`
141
+ * Support substituting to graphemes in lexicons, not only phonemes
146
142
  * Cache lexicons to avoid parsing the JSON each time it is loaded (this may not be needed for if the file is relatively small)
147
143
  * Is it possible to pre-phonemize common words like "the" or is it a bad idea / not necessary?
148
144
  * Add support for text preprocessing for all engines that can benefit from it (possibly including cloud engines).
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "echogarden",
3
- "version": "0.9.2",
3
+ "version": "0.10.0",
4
4
  "description": "An integrated speech system, providing a set of synthesis, recognition, alignment, and other processing tools, designed to be directly accessible to end-users.",
5
5
  "author": "Rotem Dan",
6
- "license": "GPL-3.0-only",
6
+ "license": "GPL-3.0",
7
7
  "keywords": [
8
8
  "speech",
9
9
  "text-to-speech",
@@ -53,8 +53,8 @@
53
53
  "echogarden": "./dist/cli/CLILauncher.js"
54
54
  },
55
55
  "dependencies": {
56
- "@aws-sdk/client-polly": "^3.379.1",
57
- "@aws-sdk/client-transcribe-streaming": "^3.379.1",
56
+ "@aws-sdk/client-polly": "^3.382.0",
57
+ "@aws-sdk/client-transcribe-streaming": "^3.382.0",
58
58
  "@echogarden/espeak-ng-emscripten": "^0.1.2",
59
59
  "@echogarden/fasttext-wasm": "^0.1.0",
60
60
  "@echogarden/flite-wasi": "^0.1.1",
@@ -66,7 +66,6 @@
66
66
  "@echogarden/speex-resampler-wasm": "^0.1.1",
67
67
  "@echogarden/svoxpico-wasm": "^0.1.0",
68
68
  "@mozilla/readability": "^0.4.4",
69
- "@types/graceful-fs": "^4.1.6",
70
69
  "alawmulaw": "^6.0.0",
71
70
  "buffer-split": "^1.0.0",
72
71
  "chalk": "^5.3.0",
@@ -124,8 +123,9 @@
124
123
  "@types/recursive-readdir": "^2.2.1",
125
124
  "@types/tar": "^6.1.5",
126
125
  "@types/ws": "^8.5.5",
127
- "@typescript-eslint/eslint-plugin": "^6.2.0",
128
- "@typescript-eslint/parser": "^6.2.0",
126
+ "@typescript-eslint/eslint-plugin": "^6.2.1",
127
+ "@typescript-eslint/parser": "^6.2.1",
128
+ "@types/graceful-fs": "^4.1.6",
129
129
  "eslint": "^8.46.0",
130
130
  "ts-json-schema-generator": "^1.2.0",
131
131
  "typescript": "^5.1.6"