echogarden 1.0.1 → 1.0.3
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/data/schemas/options.json +3 -3
- package/dist/alignment/SpeechAlignment.d.ts +1 -1
- package/dist/alignment/SpeechAlignment.js +2 -1
- package/dist/alignment/SpeechAlignment.js.map +1 -1
- package/dist/api/API.d.ts +1 -1
- package/dist/api/API.js +1 -1
- package/dist/api/API.js.map +1 -1
- package/dist/api/Alignment.d.ts +1 -1
- package/dist/api/Alignment.js +11 -7
- package/dist/api/Alignment.js.map +1 -1
- package/dist/api/LanguageDetection.d.ts +1 -1
- package/dist/api/LanguageDetection.js +1 -1
- package/dist/api/LanguageDetection.js.map +1 -1
- package/dist/api/Recognition.d.ts +1 -1
- package/dist/api/Synthesis.d.ts +2 -2
- package/dist/api/Synthesis.js.map +1 -1
- package/dist/api/Translation.d.ts +3 -3
- package/dist/api/Translation.js.map +1 -1
- package/dist/api/{Vad.js → VoiceActivityDetection.js} +1 -1
- package/dist/api/VoiceActivityDetection.js.map +1 -0
- package/dist/dsp/FFT.js +1 -1
- package/dist/dsp/FFT.js.map +1 -1
- package/dist/nlp/Segmentation.d.ts +2 -0
- package/dist/nlp/Segmentation.js +8 -3
- package/dist/nlp/Segmentation.js.map +1 -1
- package/dist/recognition/SileroSTT.js +1 -1
- package/dist/recognition/SileroSTT.js.map +1 -1
- package/dist/recognition/WhisperCppSTT.js +3 -2
- package/dist/recognition/WhisperCppSTT.js.map +1 -1
- package/dist/recognition/WhisperSTT.d.ts +13 -4
- package/dist/recognition/WhisperSTT.js +113 -32
- package/dist/recognition/WhisperSTT.js.map +1 -1
- package/dist/source-separation/MDXNetSourceSeparation.d.ts +1 -1
- package/dist/source-separation/MDXNetSourceSeparation.js +2 -1
- package/dist/source-separation/MDXNetSourceSeparation.js.map +1 -1
- package/dist/speech-language-detection/SileroLanguageDetection.d.ts +1 -1
- package/dist/speech-language-detection/SileroLanguageDetection.js +2 -1
- package/dist/speech-language-detection/SileroLanguageDetection.js.map +1 -1
- package/dist/subtitles/Subtitles.js +2 -2
- package/dist/subtitles/Subtitles.js.map +1 -1
- package/dist/synthesis/VitsTTS.d.ts +2 -2
- package/dist/synthesis/VitsTTS.js.map +1 -1
- package/dist/tests/Test.js +1 -1
- package/dist/tests/Test.js.map +1 -1
- package/dist/voice-activity-detection/SileroVAD.d.ts +5 -5
- package/dist/voice-activity-detection/SileroVAD.js +13 -12
- package/dist/voice-activity-detection/SileroVAD.js.map +1 -1
- package/docs/CLI.md +7 -0
- package/docs/Development.md +1 -1
- package/docs/Engines.md +1 -1
- package/docs/Options.md +4 -10
- package/docs/Releases.md +41 -30
- package/docs/Tasklist.md +5 -2
- package/package.json +8 -8
- package/src/alignment/SpeechAlignment.ts +2 -1
- package/src/api/API.ts +1 -1
- package/src/api/Alignment.ts +15 -9
- package/src/api/LanguageDetection.ts +2 -2
- package/src/api/Recognition.ts +1 -1
- package/src/api/Synthesis.ts +3 -3
- package/src/api/Translation.ts +3 -3
- package/src/dsp/FFT.ts +1 -1
- package/src/nlp/Segmentation.ts +11 -3
- package/src/recognition/SileroSTT.ts +3 -1
- package/src/recognition/WhisperCppSTT.ts +3 -2
- package/src/recognition/WhisperSTT.ts +154 -45
- package/src/source-separation/MDXNetSourceSeparation.ts +5 -1
- package/src/speech-language-detection/SileroLanguageDetection.ts +5 -1
- package/src/subtitles/Subtitles.ts +1 -1
- package/src/synthesis/VitsTTS.ts +3 -3
- package/src/tests/Test.ts +5 -4
- package/src/voice-activity-detection/SileroVAD.ts +23 -19
- package/dist/api/Vad.js.map +0 -1
- /package/dist/api/{Vad.d.ts → VoiceActivityDetection.d.ts} +0 -0
- /package/src/api/{Vad.ts → VoiceActivityDetection.ts} +0 -0
package/dist/tests/Test.js
CHANGED
|
@@ -5,12 +5,12 @@ setupProgramTerminationListeners();
|
|
|
5
5
|
//process.env.http_proxy = 'http://localhost:8080'
|
|
6
6
|
//const testText = `After a while, finding that nothing more happened, she decided on going into the garden at once; but, alas for poor Alice! when she got to the door, she found she had forgotten the little golden key, and when she went back to the table for it, she found she could not possibly reach it: she could see it quite plainly through the glass, and she tried her best to climb up one of the legs of the table, but it was too slippery; and when she had tired herself out with trying, the poor little thing sat down and cried.`
|
|
7
7
|
//await testKirshenbaumPhonemization(testText)
|
|
8
|
-
//await makeTarballsForInstalledPackages(true)
|
|
9
8
|
//getRepetitionScoreRelativeToFirstSubstring(['a', 'b', 'c', 'a', 'b', 'c'])
|
|
10
9
|
//getRepetitionScoreRelativeToFirstSubstring(['a', 'b', 'a', 'd', 'a', 'b', 'a', 'd'])
|
|
11
10
|
//getRepetitionScoreRelativeToFirstSubstring(['a', 'b', 'a', 'b', 'c', 'a', 'b', 'a', 'b'])
|
|
12
11
|
//getRepetitionScoreRelativeToFirstSubstring(['a', 'a', 'a', 'b', 'a', 'a', 'a', 'b'])
|
|
13
12
|
//getRepetitionScoreRelativeToFirstSubstring(['a', 'b', 'a', 'c', 'a', 'b', 'a', 'c', 'a'])
|
|
14
13
|
//getRepetitionScoreRelativeToFirstSubstring(['a', 'a', 'a', 'b', 'b', 'a', 'a', 'a', 'b'])
|
|
14
|
+
//await makeTarballsForInstalledPackages(true)
|
|
15
15
|
process.exit(0);
|
|
16
16
|
//# sourceMappingURL=Test.js.map
|
package/dist/tests/Test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Test.js","sourceRoot":"","sources":["../../src/tests/Test.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,WAAW,EAAE,gCAAgC,
|
|
1
|
+
{"version":3,"file":"Test.js","sourceRoot":"","sources":["../../src/tests/Test.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,WAAW,EAAE,gCAAgC,EAAiB,MAAM,2BAA2B,CAAA;AAIpJ,MAAM,GAAG,GAAG,WAAW,CAAA;AAEvB,gCAAgC,EAAE,CAAA;AAElC,gDAAgD;AAChD,kDAAkD;AAElD,yhBAAyhB;AACzhB,8CAA8C;AAE9C,4EAA4E;AAC5E,sFAAsF;AACtF,2FAA2F;AAC3F,sFAAsF;AACtF,2FAA2F;AAC3F,2FAA2F;AAE3F,8CAA8C;AAE9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/// <reference path="../../src/typings/Fillers.d.ts" />
|
|
2
|
-
import Onnx from 'onnxruntime-node';
|
|
2
|
+
import type * as Onnx from 'onnxruntime-node';
|
|
3
3
|
import { RawAudio } from '../audio/AudioUtilities.js';
|
|
4
4
|
export declare function detectVoiceActivity(rawAudio: RawAudio, modelPath: string, frameDuration: 30 | 60 | 90): Promise<number[]>;
|
|
5
5
|
export declare class SileroVAD {
|
|
6
6
|
session?: Onnx.InferenceSession;
|
|
7
|
-
modelStateH
|
|
8
|
-
modelStateC
|
|
9
|
-
modelSampleRate
|
|
7
|
+
modelStateH?: Onnx.Tensor;
|
|
8
|
+
modelStateC?: Onnx.Tensor;
|
|
9
|
+
modelSampleRate?: Onnx.Tensor;
|
|
10
10
|
modelPath: string;
|
|
11
11
|
constructor(modelPath: string);
|
|
12
12
|
predictAudioFrame(frame: Float32Array): Promise<number>;
|
|
13
|
-
private
|
|
13
|
+
private initializeIfNeeded;
|
|
14
14
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import Onnx from 'onnxruntime-node';
|
|
2
1
|
import { concatFloat32Arrays } from '../utilities/Utilities.js';
|
|
3
2
|
let sileroVad;
|
|
4
3
|
export async function detectVoiceActivity(rawAudio, modelPath, frameDuration) {
|
|
@@ -28,19 +27,12 @@ export class SileroVAD {
|
|
|
28
27
|
modelSampleRate;
|
|
29
28
|
modelPath;
|
|
30
29
|
constructor(modelPath) {
|
|
31
|
-
this.modelSampleRate = new Onnx.Tensor('int64', new BigInt64Array([BigInt(16000)]), []);
|
|
32
|
-
const h = new Float32Array(2 * 1 * 64);
|
|
33
|
-
const c = new Float32Array(2 * 1 * 64);
|
|
34
|
-
this.modelStateH = new Onnx.Tensor('float32', h, [2, 1, 64]);
|
|
35
|
-
this.modelStateC = new Onnx.Tensor('float32', c, [2, 1, 64]);
|
|
36
30
|
this.modelPath = modelPath;
|
|
37
31
|
}
|
|
38
32
|
async predictAudioFrame(frame) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
33
|
+
await this.initializeIfNeeded();
|
|
34
|
+
const Onnx = await import('onnxruntime-node');
|
|
42
35
|
const inputTensor = new Onnx.Tensor('float32', frame, [1, frame.length]);
|
|
43
|
-
//const inputs = { input: inputTensor, h0: this.modelStateH, c0: this.modelStateC }
|
|
44
36
|
const inputs = { input: inputTensor, sr: this.modelSampleRate, h: this.modelStateH, c: this.modelStateC };
|
|
45
37
|
const results = await this.session.run(inputs);
|
|
46
38
|
const probability = results['output'].data[0];
|
|
@@ -48,11 +40,20 @@ export class SileroVAD {
|
|
|
48
40
|
this.modelStateC = results['cn'];
|
|
49
41
|
return probability;
|
|
50
42
|
}
|
|
51
|
-
async
|
|
43
|
+
async initializeIfNeeded() {
|
|
44
|
+
if (this.session) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const Onnx = await import('onnxruntime-node');
|
|
48
|
+
const h = new Float32Array(2 * 1 * 64);
|
|
49
|
+
const c = new Float32Array(2 * 1 * 64);
|
|
50
|
+
this.modelStateH = new Onnx.Tensor('float32', h, [2, 1, 64]);
|
|
51
|
+
this.modelStateC = new Onnx.Tensor('float32', c, [2, 1, 64]);
|
|
52
|
+
this.modelSampleRate = new Onnx.Tensor('int64', new BigInt64Array([BigInt(16000)]), []);
|
|
52
53
|
const onnxOptions = {
|
|
53
54
|
logSeverityLevel: 3
|
|
54
55
|
};
|
|
55
|
-
this.session = await Onnx.InferenceSession.create(modelPath, onnxOptions);
|
|
56
|
+
this.session = await Onnx.InferenceSession.create(this.modelPath, onnxOptions);
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
//# sourceMappingURL=SileroVAD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SileroVAD.js","sourceRoot":"","sources":["../../src/voice-activity-detection/SileroVAD.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SileroVAD.js","sourceRoot":"","sources":["../../src/voice-activity-detection/SileroVAD.ts"],"names":[],"mappings":"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"}
|
package/docs/CLI.md
CHANGED
|
@@ -311,3 +311,10 @@ Uninstall one or more expansion packages
|
|
|
311
311
|
### `list-packages`
|
|
312
312
|
|
|
313
313
|
Show a list of installed expansion packages
|
|
314
|
+
|
|
315
|
+
## General CLI options
|
|
316
|
+
|
|
317
|
+
* `--play`, `--no-play`: enable/disable audio playback. Defaults to play if there is no output file specified
|
|
318
|
+
* `--overwrite`, `--no-overwrite`: overwrite/keep existing files. Doesn't overwrite by default
|
|
319
|
+
* `--debug`, `--no-debug`: show/hide the full details of JavaScript errors, if they occur. Disabled by default
|
|
320
|
+
* `--config=...`: path to configuration file to use. Defaults to `echogarden.config` or `echogarden.config.json`, if found at the current directory
|
package/docs/Development.md
CHANGED
|
@@ -12,7 +12,7 @@ Here's a quick guide on how to set up a development environment for making and t
|
|
|
12
12
|
* Fork or clone the repository (`git clone https://github.com/echogarden-project/echogarden`)
|
|
13
13
|
* Ensure you have [Node.js](https://nodejs.org/en/download) installed
|
|
14
14
|
* Ensure you have TypeScript installed (`npm install typescript -g`)
|
|
15
|
-
* Run `npm install`
|
|
15
|
+
* Run `npm install` at the project base directory
|
|
16
16
|
* Compile using `tsc .` at the project base directory
|
|
17
17
|
|
|
18
18
|
## Auto-compiling in Visual Studio Code
|
package/docs/Engines.md
CHANGED
|
@@ -48,7 +48,7 @@ These cloud-based engines connect to public cloud APIs that are not officially p
|
|
|
48
48
|
**Offline**:
|
|
49
49
|
* [OpenAI Whisper](https://github.com/openai/whisper) (`whisper`): high accuracy transformer-based speech recognition architecture. Supports 99 languages. There are several models of different sizes, some are multilingual, and some are English only (`.en`): `tiny`, `tiny.en`, `base`, `base.en`, `small`, `small.en`, `medium`, `medium.en`, `large`, `large-v1` and `large-v2`, `large-v3`. **Note**: large models are not currently supported by `onnxruntime-node` due to model size restrictions.
|
|
50
50
|
* [Whisper.cpp](https://github.com/ggerganov/whisper.cpp) (`whisper.cpp`): a port of the Whisper architecture to C++, by Georgi Gerganov. Supports all Whisper models, including several quantized ones (see full list in the options page). Has various different builds, including CUDA and OpenCL for GPU support.
|
|
51
|
-
* [Vosk](https://github.com/alphacep/vosk-api) (`vosk`): models available for 25+ languages.
|
|
51
|
+
* [Vosk](https://github.com/alphacep/vosk-api) (`vosk`): models available for 25+ languages. **Note**: the Vosk package is not included in the default installation, but you can add support for it using `npm install @echogarden/vosk -g`. Then, you'll need to manually [download a model](https://alphacephei.com/vosk/models) and specify its directory path via the `vosk.modelPath` option.
|
|
52
52
|
* [Silero](https://github.com/snakers4/silero-models) (`silero`): models available for English, Spanish, German and Ukrainian. For [non-commercial use only](https://github.com/snakers4/silero-models/blob/master/LICENSE).
|
|
53
53
|
|
|
54
54
|
**Cloud services**:
|
package/docs/Options.md
CHANGED
|
@@ -148,14 +148,15 @@ Applies to CLI operation: `transcribe`, API method: `recognize`
|
|
|
148
148
|
* `whisper.autoPromptParts`: use previous part's recognized text as prompt for the next part. Disabling this may help to prevent repetition carrying over between parts, in some cases. Defaults to `true`
|
|
149
149
|
* `whisper.maxTokensPerPart`: maximum number of tokens to decode for each 30 second audio part. Defaults to `250`
|
|
150
150
|
* `whisper.suppressRepetition`: attempt to suppress decoding repeating token patterns. Defaults to `true`
|
|
151
|
-
* `whisper.
|
|
151
|
+
* `whisper.decodeTimestampTokens`: enable/disable decoding of timestamp tokens, since more accurate timing is already extracted via cross-attention weight alignment. For unclear reasons, setting to `false` can significantly reduce the occurrence of hallucinations and token repetition loops, and increases word timestamp accuracy. However, there are cases where this can cause the model to end a part prematurely, especially in singing and less speech-like voice segments, or when there are multiple speakers. Defaults to `true`
|
|
152
|
+
* `whisper.seed`: provide a custom random seed for token selection when temperature is greater than 0. Uses a constant seed by default to ensure reproducibility
|
|
152
153
|
|
|
153
154
|
**Whisper.cpp**:
|
|
154
155
|
* `whisperCpp.model`: selects which `whisper.cpp` model to use. Can be `tiny`, `tiny.en`, `base`, `base.en`, `small`, `small.en`, `medium`, `medium.en`, `large` (same as `large-v2`), `large-v1`, `large-v2`, `large-v3`. These quantized models are also supported: `tiny-q5_1`, `tiny.en-q5_1`, `tiny.en-q8_0`,`base-q5_1`, `base.en-q5_1`, `small-q5_1`, `small.en-q5_1`, `medium-q5_0`, `medium.en-q5_0`, `large-v2-q5_0`, `large-v3-q5_0`. Defaults to `base` or `base.en`
|
|
155
156
|
* `whisperCpp.executablePath`: custom `whisper.cpp` executable path (currently required for macOS)
|
|
156
157
|
* `whisperCpp.build`: type of `whisper.cpp` build to use. Can be set `cpu`, `cublas-11.8.0`, `cublas-12.4.0`. By default, builds are auto-selected and downloaded for Windows x64 (`cpu`, `cublas-11.8.0`, `cublas-12.4.0`) and Linux x64 (`cpu`). Using other builds requires providing a custom `executablePath`
|
|
157
158
|
* `whisperCpp.threadCount`: number of threads to use, defaults to `4`
|
|
158
|
-
* `whisperCpp.splitCount`: number of splits of the audio data to process in parallel (called `--processors` in the CLI). A value greater than `1` can increase memory use significantly, reduce timing accuracy, and slow down execution in some cases. Defaults to `1` (highly recommended)
|
|
159
|
+
* `whisperCpp.splitCount`: number of splits of the audio data to process in parallel (called `--processors` in the `whisper.cpp` CLI). A value greater than `1` can increase memory use significantly, reduce timing accuracy, and slow down execution in some cases. Defaults to `1` (highly recommended)
|
|
159
160
|
* `whisperCpp.enableGPU`: enable GPU processing. Defaults to `true` on CUDA-enabled builds, otherwise `false`
|
|
160
161
|
* `whisperCpp.topCandidateCount`: the number of top candidate tokens to consider. Defaults to `5`
|
|
161
162
|
* `whisperCpp.beamCount`: the number of decoding paths to use during beam search. Defaults to `5`
|
|
@@ -205,7 +206,7 @@ Applies to CLI operation: `align`, API method: `align`
|
|
|
205
206
|
* `engine`: alignment algorithm to use, can be `dtw`, `dtw-ra` or `whisper`. Defaults to `dtw`
|
|
206
207
|
* `language`: language code for the audio and transcript ([ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)), like `en`, `fr`, `en-US`, `pt-BR`. Auto-detected from transcript if not set
|
|
207
208
|
* `crop`: crop to active parts using voice activity detection before starting. Defaults to `true`
|
|
208
|
-
* `isolate`: apply source separation to isolate voice before starting
|
|
209
|
+
* `isolate`: apply source separation to isolate voice before starting alignment. Defaults to `false`
|
|
209
210
|
* `customLexiconPaths`: an array of custom lexicon file paths. Optional
|
|
210
211
|
* `subtitles`: prefix to provide options for subtitles. Options detailed in section for subtitles
|
|
211
212
|
* `vad`: prefix to provide options for voice activity detection when `crop` is set to `true`. Options detailed in section for voice activity detection
|
|
@@ -333,10 +334,3 @@ These are shared between text-to-speech, speech-to-text and alignment operations
|
|
|
333
334
|
* `maxAddedDuration`: maximum extra time (in seconds) that may be added after a cue's end time. This gives the reader additional time to read the cue, and also ensures that very short duration cues aren't shown in a flash. Defaults to `3.0`
|
|
334
335
|
|
|
335
336
|
**Note**: options `maxLineCount`, `maxLineWidth`, `minWordsInLine`, `separatePhrases`, are only effective when using the `segment` and `sentence` modes, and are ignored in all other modes. `maxAddedDuration` doesn't apply to modes `word`, `phone` and `word+phone` (they always use the exact start and end timestamps).
|
|
336
|
-
|
|
337
|
-
# General CLI options
|
|
338
|
-
|
|
339
|
-
* `--play`, `--no-play`: enable/disable audio playback. Defaults to play if there is no output file specified
|
|
340
|
-
* `--overwrite`, `--no-overwrite`: overwrite/keep existing files. Doesn't overwrite by default
|
|
341
|
-
* `--debug`, `--no-debug`: show/hide the full details of JavaScript errors, if they occur. Disabled by default
|
|
342
|
-
* `--config=...`: path to configuration file to use. See the [CLI guide](CLI.md) for more information about configuration files
|
package/docs/Releases.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Release notes
|
|
2
2
|
|
|
3
|
-
## `1.0.0` (April
|
|
3
|
+
## `1.0.0` (April 12, 2024)
|
|
4
4
|
|
|
5
5
|
**New features**:
|
|
6
6
|
* Add support for [`whisper.cpp`](https://github.com/ggerganov/whisper.cpp), a C++ port of OpenAI's Whisper speech recognition architecture. It is faster than the integrated `whisper` engine, supports large models, and GPU processing. It can now be used for recognition, speech translation and alignment (via `dtw-ra`), though its word timestamps are less accurate than the integrated `whisper` engine.
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
* Expose several new configuration options for the Whisper engine: a settings for maximum tokens per part, and a setting to enable/disable repetition suppression, set custom random seed, disable/enable decoding of timestamp tokens
|
|
14
14
|
* Expose more options for the Elevenlabs engine
|
|
15
15
|
|
|
16
|
+
**Enhancements**:
|
|
17
|
+
* `detect-voice-activity` now also outputs the cropped voice when an audio file is given as output, with `.cropped` suffix added
|
|
18
|
+
* Improved word segmentation of whisper engine. Words spanning multiple recognized time segments are now split. Word timestamp ranges don't overlap non-speech sections.
|
|
19
|
+
* Whisper and Whisper.cpp outputs now include timestamps for individual recognized tokens
|
|
20
|
+
|
|
16
21
|
**Behavioral and breaking changes**:
|
|
17
22
|
* Minimal required node version changed to `18.0.0`
|
|
18
23
|
* All recognition, alignment, translation and language recognition operations first apply the new adaptive gate VAD (can be changed to any other VAD engine via the `vad.` option prefix) and remove any sections that are not identified as containing voice, before starting processing. This should improve results in most cases, and reduce processing time
|
|
@@ -30,11 +35,6 @@
|
|
|
30
35
|
* `maxIncreaseDb` post-processing and denoising option renamed to `maxGainIncrease`
|
|
31
36
|
* `dryMixGainDb` denoising option renamed to `dryMixGain`
|
|
32
37
|
|
|
33
|
-
**Enhancements**:
|
|
34
|
-
* `detect-voice-activity` now also outputs the cropped voice when an audio file is given as output, with `.cropped` suffix added
|
|
35
|
-
* Improved word segmentation of whisper engine. Words spanning multiple recognized time segments are now split. Word timestamp ranges don't overlap non-speech sections.
|
|
36
|
-
* Whisper and Whisper.cpp outputs now include timestamps for individual recognized tokens
|
|
37
|
-
|
|
38
38
|
**Fixes**:
|
|
39
39
|
* Integrated `whisper` engine now uses `tiktoken` to tokenize text, which produces near identical tokenization compared to the official Python implementation. This fixes issues with decoding Chinese characters, correctly encoding prompts, and several others languages with characters that span multiple tokens
|
|
40
40
|
* Fix voice language lists for multilingual voices in Elevenlabs TTS engine
|
|
@@ -43,14 +43,15 @@
|
|
|
43
43
|
* Fix issue with identifying legacy IEEE Float wave format
|
|
44
44
|
* Fix issue with language detection failing with empty inputs
|
|
45
45
|
* Fix issue with Whisper model failing when no tokens are detected in a part
|
|
46
|
-
* Fix issue with phone alignment not getting the right DTW window size, producing warnings like `all cost directions are equal to infinity
|
|
46
|
+
* Fix issue with phone alignment not getting the right DTW window size, producing warnings like `all cost directions are equal to infinity`
|
|
47
47
|
* Fix phone timelines in DTW-RA
|
|
48
48
|
* Add more workarounds for eSpeak tokenization bugs
|
|
49
49
|
* Various other fixes
|
|
50
50
|
|
|
51
51
|
**Documentation**:
|
|
52
|
-
* Add new
|
|
53
|
-
*
|
|
52
|
+
* Add new [release notes](./Releases.md) page. Releases before `1.0.x` were retroactively documented based on commit history (may not exactly detail all historical changes)
|
|
53
|
+
* Add new [development page](./Development.md) with a quick guide for setting up a development environment to make changes to the Echogarden codebase
|
|
54
|
+
* Options reference page reorganized and updated with some missing information
|
|
54
55
|
|
|
55
56
|
## `0.12.x` (March 16, 2024)
|
|
56
57
|
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
**Other**:
|
|
68
69
|
* Include `package-lock.json` in repository
|
|
69
70
|
|
|
71
|
+
|
|
70
72
|
## `0.11.x` (August 17, 2023)
|
|
71
73
|
|
|
72
74
|
Many features, enhancements, and fixes were incrementally added over the span of 7 months, up to March 2024.
|
|
@@ -87,6 +89,7 @@ Many features, enhancements, and fixes were incrementally added over the span of
|
|
|
87
89
|
* Fix audio playback in macOS
|
|
88
90
|
* Many other fixes
|
|
89
91
|
|
|
92
|
+
|
|
90
93
|
## `0.10.x` (August 2, 2023)
|
|
91
94
|
|
|
92
95
|
**New features**:
|
|
@@ -100,6 +103,7 @@ Many features, enhancements, and fixes were incrementally added over the span of
|
|
|
100
103
|
**Fixes**:
|
|
101
104
|
* Many fixes
|
|
102
105
|
|
|
106
|
+
|
|
103
107
|
## `0.9.x` (July 29, 2023)
|
|
104
108
|
|
|
105
109
|
**New features**:
|
|
@@ -114,6 +118,7 @@ Many features, enhancements, and fixes were incrementally added over the span of
|
|
|
114
118
|
* Work around several eSpeak bugs
|
|
115
119
|
* Many fixes
|
|
116
120
|
|
|
121
|
+
|
|
117
122
|
## `0.8.x` (July 25, 2023)
|
|
118
123
|
|
|
119
124
|
**New features**:
|
|
@@ -122,26 +127,25 @@ Many features, enhancements, and fixes were incrementally added over the span of
|
|
|
122
127
|
* Add punctuation thresholds to Whisper decoder
|
|
123
128
|
* Expose subtitle configuration options to CLI
|
|
124
129
|
|
|
125
|
-
**Behavioral changes**:
|
|
126
|
-
* Rename `subtitles.minWords` to `subtitles.minWordsInLine`
|
|
127
|
-
|
|
128
130
|
**Enhancements**:
|
|
129
131
|
* Improve speech language detection to work with arbitrary length audio. Split audio to overlapping parts and detect each part individually. Then average the results.
|
|
130
132
|
* Add more heteronyms
|
|
131
133
|
|
|
134
|
+
**Behavioral changes**:
|
|
135
|
+
* Rename `subtitles.minWords` to `subtitles.minWordsInLine`
|
|
136
|
+
|
|
132
137
|
**Fixes**:
|
|
133
138
|
* Improve numerical stability of softmax function
|
|
134
139
|
* Work around eSpeak bug with markers in long inputs
|
|
135
140
|
* Various fixes
|
|
136
141
|
|
|
142
|
+
|
|
137
143
|
## `0.7.x` (July 23, 2023)
|
|
138
144
|
|
|
139
145
|
**New features**:
|
|
140
146
|
* Alignment: Add option to accept custom lexicons
|
|
141
147
|
* Implement and add decoder temperature option to Whisper model
|
|
142
148
|
|
|
143
|
-
**Behavioral changes**:
|
|
144
|
-
|
|
145
149
|
**Enhancements**:
|
|
146
150
|
* Alignment: use preprocessing and lexicons
|
|
147
151
|
* Add language detection to speech translation
|
|
@@ -151,10 +155,13 @@ Many features, enhancements, and fixes were incrementally added over the span of
|
|
|
151
155
|
* Add colors to log messages
|
|
152
156
|
* Warn when maximum DTW window duration is smaller than source audio duration.
|
|
153
157
|
|
|
158
|
+
**Behavioral changes**:
|
|
159
|
+
|
|
154
160
|
**Fixes**:
|
|
155
161
|
* Fix support for SSML input in eSpeak engine
|
|
156
162
|
* Various fixes
|
|
157
163
|
|
|
164
|
+
|
|
158
165
|
## `0.6.x` (July 20, 2023)
|
|
159
166
|
|
|
160
167
|
**New features**:
|
|
@@ -165,16 +172,16 @@ Many features, enhancements, and fixes were incrementally added over the span of
|
|
|
165
172
|
* Add arguments to customize paragraph parsing
|
|
166
173
|
* Change whitespace option to include option for collapsing all whitespace
|
|
167
174
|
|
|
168
|
-
**Behavioral changes**:
|
|
169
|
-
* Set Elevenlabs defaults to mid-values
|
|
170
|
-
* Split plain text to paragraphs using double line breaks by default.
|
|
171
|
-
* Rename `awsPolly` options to `amazonPolly` to be more consistent with documentation
|
|
172
|
-
|
|
173
175
|
**Enhancements**:
|
|
174
176
|
* Change whitespace option to include option for collapsing all whitespace
|
|
175
177
|
* Add awareness of guillemets
|
|
176
178
|
* Log full language of selected voice
|
|
177
179
|
|
|
180
|
+
**Behavioral changes**:
|
|
181
|
+
* Set Elevenlabs defaults to mid-values
|
|
182
|
+
* Split plain text to paragraphs using double line breaks by default.
|
|
183
|
+
* Rename `awsPolly` options to `amazonPolly` to be more consistent with documentation
|
|
184
|
+
|
|
178
185
|
**Fixes**:
|
|
179
186
|
* Fix and update Elevenlabs engine
|
|
180
187
|
* Fix incorrect gender properties for some VITS voices
|
|
@@ -184,26 +191,25 @@ Many features, enhancements, and fixes were incrementally added over the span of
|
|
|
184
191
|
**Other**:
|
|
185
192
|
* Remove `package-lock.json` from the repository
|
|
186
193
|
|
|
194
|
+
|
|
187
195
|
## `0.5.x` (July, 19 2023)
|
|
188
196
|
|
|
189
197
|
**New features**:
|
|
190
198
|
|
|
191
|
-
**Behavioral changes**:
|
|
192
|
-
* Move to new package system supporting version tags, and hosted in a Hugging Face repository
|
|
193
|
-
|
|
194
199
|
**Enhancements**:
|
|
195
200
|
* Add large numbers of VITS voices
|
|
196
201
|
|
|
202
|
+
**Behavioral changes**:
|
|
203
|
+
* Move to new package system supporting version tags, and hosted in a Hugging Face repository
|
|
204
|
+
|
|
197
205
|
**Fixes**:
|
|
198
206
|
* Various fixes
|
|
199
207
|
|
|
208
|
+
|
|
200
209
|
## `0.4.x` (July 9, 2023)
|
|
201
210
|
|
|
202
211
|
**New features**:
|
|
203
212
|
|
|
204
|
-
**Behavioral changes**:
|
|
205
|
-
* Remove support for `afplay` and `aplay` for playback. Only SoX is used now.
|
|
206
|
-
|
|
207
213
|
**Enhancements**:
|
|
208
214
|
* Improve text normalization and add support for currencies
|
|
209
215
|
* Improve heteronym lexicons
|
|
@@ -212,32 +218,34 @@ Many features, enhancements, and fixes were incrementally added over the span of
|
|
|
212
218
|
* Add some British English (RP) pronunciations to heteronym lexicon
|
|
213
219
|
* Add large numbers of VITS voices
|
|
214
220
|
|
|
221
|
+
**Behavioral changes**:
|
|
222
|
+
* Remove support for `afplay` and `aplay` for playback. Only SoX is used now.
|
|
223
|
+
|
|
215
224
|
**Fixes**:
|
|
216
225
|
* Various fixes
|
|
217
226
|
|
|
227
|
+
|
|
218
228
|
## `0.3.x` (July 1, 2023)
|
|
219
229
|
|
|
220
230
|
**New features**:
|
|
221
231
|
|
|
222
|
-
**Behavioral changes**:
|
|
223
|
-
|
|
224
232
|
**Enhancements**:
|
|
225
233
|
* Upgrade heteronym disambiguation to an improved, rule-based approach, which doesn't use POS tagging
|
|
226
234
|
* Extend decade normalization
|
|
227
235
|
* Improve text normalization and add support to currencies
|
|
228
236
|
* Update the heteronym lexicon
|
|
229
237
|
|
|
238
|
+
**Behavioral changes**:
|
|
239
|
+
|
|
230
240
|
**Fixes**:
|
|
231
241
|
* Remove sentences containing only whitespace when synthesizing
|
|
232
242
|
* Many fixes
|
|
233
243
|
|
|
244
|
+
|
|
234
245
|
## `0.2.x` (May 10, 2023)
|
|
235
246
|
|
|
236
247
|
**New features**:
|
|
237
248
|
|
|
238
|
-
**Behavioral changes**:
|
|
239
|
-
* Remove dependency on `xregexp` package. Use Unicode RegExp instead.
|
|
240
|
-
|
|
241
249
|
**Enhancements**:
|
|
242
250
|
* Show current sentence and segment in synthesis log.
|
|
243
251
|
* Add check for cancellation flag.
|
|
@@ -245,6 +253,9 @@ Many features, enhancements, and fixes were incrementally added over the span of
|
|
|
245
253
|
* Improve auto TTS engine selection
|
|
246
254
|
* Many Enhancements
|
|
247
255
|
|
|
256
|
+
**Behavioral changes**:
|
|
257
|
+
* Remove dependency on `xregexp` package. Use Unicode RegExp instead.
|
|
258
|
+
|
|
248
259
|
**Fixes**:
|
|
249
260
|
* Many fixes
|
|
250
261
|
|
package/docs/Tasklist.md
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## Bugs
|
|
4
4
|
|
|
5
|
+
### Alignment
|
|
6
|
+
|
|
5
7
|
* In DTW-RA, recognition transcript including something like "Question 2.What does Juan", where "2.What" has a point in the middle, is breaking playback of the timeline.
|
|
8
|
+
* DTW-RA will not work correctly with Polish language texts, due to issues with the eSpeak engine pronouncing `|` characters, which are intended to be used as separators and ignored by all other eSpeak languages.
|
|
6
9
|
|
|
7
10
|
### Synthesis
|
|
8
11
|
|
|
@@ -108,8 +111,8 @@
|
|
|
108
111
|
* See if it's possible to reliably use eSpeak as a segmentation engine
|
|
109
112
|
|
|
110
113
|
### Subtitles
|
|
114
|
+
* Split long words if needed. This is especially important for Chinese
|
|
111
115
|
* 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)
|
|
112
|
-
* Split long words if needed
|
|
113
116
|
* Decide how many punctuation characters to allow before breaking to a new line (currently it's infinite)
|
|
114
117
|
* Add more clause separators, for even more special cases
|
|
115
118
|
* Add option to output usable word or phoneme-level caption files (investigate how it's done on YouTube auto-captions)
|
|
@@ -155,10 +158,10 @@
|
|
|
155
158
|
* Currently, when input is set to be SSML, it is wrapped in a `<speak>` tag. Handle the case where the user made their own SSML document wrapped with a `<speak>` tag as well. Currently, it may send invalid input to Azure
|
|
156
159
|
|
|
157
160
|
### Recognition
|
|
161
|
+
* Recognized word entries that span VAD segment boundaries can be split
|
|
158
162
|
* Show alternatives when playing in the CLI. Clear current line and rewrite already printed text for alternatives during the speech recognition process
|
|
159
163
|
* Option to split recognized audio to segments or sentences, as is done with synthesized audio
|
|
160
164
|
* Try to exclude the timing for trailing punctuation tokens in words that contain them. This can help narrow down the end timestamp to cover the word more tightly
|
|
161
|
-
* Recognized word entries that span VAD boundaries may be split
|
|
162
165
|
|
|
163
166
|
### Recognition / Whisper
|
|
164
167
|
* May get stuck in a token repeat loop when silence or non-speech segment encountered in audio. Decide what to do
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "echogarden",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "An integrated speech toolset, providing a variety of synthesis, recognition, alignment, and other processing tools, designed to be directly accessible to end-users.",
|
|
5
5
|
"author": "Rotem Dan",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"echogarden": "./dist/cli/CLILauncher.js"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@aws-sdk/client-polly": "^3.
|
|
58
|
-
"@aws-sdk/client-transcribe-streaming": "^3.
|
|
57
|
+
"@aws-sdk/client-polly": "^3.556.0",
|
|
58
|
+
"@aws-sdk/client-transcribe-streaming": "^3.556.0",
|
|
59
59
|
"@echogarden/espeak-ng-emscripten": "^0.1.2",
|
|
60
60
|
"@echogarden/fasttext-wasm": "^0.1.0",
|
|
61
61
|
"@echogarden/flite-wasi": "^0.1.1",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"compromise": "^14.13.0",
|
|
76
76
|
"compromise-dates": "^3.5.0",
|
|
77
77
|
"fs-extra": "^11.2.0",
|
|
78
|
-
"gaxios": "^6.
|
|
78
|
+
"gaxios": "^6.5.0",
|
|
79
79
|
"graceful-fs": "^4.2.11",
|
|
80
80
|
"html-escaper": "^3.0.3",
|
|
81
81
|
"html-to-text": "^9.0.5",
|
|
@@ -90,11 +90,11 @@
|
|
|
90
90
|
"ndarray": "^1.0.19",
|
|
91
91
|
"ndarray-ops": "^1.2.2",
|
|
92
92
|
"onnxruntime-node": "^1.17.0",
|
|
93
|
-
"openai": "^4.
|
|
93
|
+
"openai": "^4.37.0",
|
|
94
94
|
"sam-js": "^0.2.1",
|
|
95
95
|
"strip-ansi": "^7.1.0",
|
|
96
|
-
"tar": "^7.0.
|
|
97
|
-
"tiktoken": "^1.0.
|
|
96
|
+
"tar": "^7.0.1",
|
|
97
|
+
"tiktoken": "^1.0.14",
|
|
98
98
|
"tinyld": "^1.3.4",
|
|
99
99
|
"ws": "^8.16.0",
|
|
100
100
|
"wtf_wikipedia": "^10.3.0"
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
"@types/recursive-readdir": "^2.2.4",
|
|
128
128
|
"@types/tar": "^6.1.12",
|
|
129
129
|
"@types/ws": "^8.5.10",
|
|
130
|
-
"ts-json-schema-generator": "^
|
|
130
|
+
"ts-json-schema-generator": "^2.0.1",
|
|
131
131
|
"typescript": "^5.4.5"
|
|
132
132
|
}
|
|
133
133
|
}
|
|
@@ -151,7 +151,7 @@ export async function alignUsingDtw(
|
|
|
151
151
|
return mappedTimeline
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
export async function
|
|
154
|
+
export async function alignUsingDtwWithRecognition(
|
|
155
155
|
sourceRawAudio: RawAudio,
|
|
156
156
|
referenceRawAudio: RawAudio,
|
|
157
157
|
referenceTimeline: Timeline,
|
|
@@ -272,6 +272,7 @@ export async function alignUsingDtwWithRecognitionReference(
|
|
|
272
272
|
|
|
273
273
|
let currentSynthesizedToRecognizedMappingIndex = 0
|
|
274
274
|
|
|
275
|
+
// Map from synthesized reference timestamps to the recognition timestamps
|
|
275
276
|
function mapSynthesizedToRecognizedTimeAndAdvance(synthesizedTime: number) {
|
|
276
277
|
for (; ; currentSynthesizedToRecognizedMappingIndex += 1) {
|
|
277
278
|
const left = synthesizedToRecognizedTimeMapping[currentSynthesizedToRecognizedMappingIndex].synthesized
|
package/src/api/API.ts
CHANGED
|
@@ -7,7 +7,7 @@ export * from './Recognition.js'
|
|
|
7
7
|
export * from './Alignment.js'
|
|
8
8
|
export * from './Translation.js'
|
|
9
9
|
export * from './LanguageDetection.js'
|
|
10
|
-
export * from './
|
|
10
|
+
export * from './VoiceActivityDetection.js'
|
|
11
11
|
export * from './Denoising.js'
|
|
12
12
|
export * from './SourceSeparation.js'
|
|
13
13
|
export * from '../server/Server.js'
|
package/src/api/Alignment.ts
CHANGED
|
@@ -7,11 +7,12 @@ import { Logger } from '../utilities/Logger.js'
|
|
|
7
7
|
import * as API from './API.js'
|
|
8
8
|
import { Timeline, addTimeOffsetToTimeline, addWordTextOffsetsToTimeline, wordTimelineToSegmentSentenceTimeline } from '../utilities/Timeline.js'
|
|
9
9
|
import { formatLanguageCodeWithName, getDefaultDialectForLanguageCodeIfPossible, getShortLanguageCode, normalizeLanguageCode } from '../utilities/Locale.js'
|
|
10
|
-
import { WhisperOptions } from '../recognition/WhisperSTT.js'
|
|
10
|
+
import { type WhisperOptions } from '../recognition/WhisperSTT.js'
|
|
11
11
|
import chalk from 'chalk'
|
|
12
12
|
import { DtwGranularity, createAlignmentReferenceUsingEspeak } from '../alignment/SpeechAlignment.js'
|
|
13
13
|
import { SubtitlesConfig, defaultSubtitlesBaseConfig } from '../subtitles/Subtitles.js'
|
|
14
14
|
import { EspeakOptions, defaultEspeakOptions } from '../synthesis/EspeakTTS.js'
|
|
15
|
+
import { isWord } from '../nlp/Segmentation.js'
|
|
15
16
|
|
|
16
17
|
const log = logToStderr
|
|
17
18
|
|
|
@@ -85,7 +86,7 @@ export async function align(input: AudioSourceParam, transcript: string, options
|
|
|
85
86
|
|
|
86
87
|
logger.start('Load alignment module')
|
|
87
88
|
|
|
88
|
-
const {
|
|
89
|
+
const { alignUsingDtwWithRecognition, alignUsingDtw } = await import('../alignment/SpeechAlignment.js')
|
|
89
90
|
|
|
90
91
|
function getDtwWindowDurationsAndGranularities() {
|
|
91
92
|
let granularities: DtwGranularity[]
|
|
@@ -127,7 +128,7 @@ export async function align(input: AudioSourceParam, transcript: string, options
|
|
|
127
128
|
const {
|
|
128
129
|
referenceRawAudio,
|
|
129
130
|
referenceTimeline
|
|
130
|
-
} = await createAlignmentReferenceUsingEspeak(transcript, language, options.plainText, options.customLexiconPaths)
|
|
131
|
+
} = await createAlignmentReferenceUsingEspeak(transcript, language, options.plainText, options.customLexiconPaths, false)
|
|
131
132
|
|
|
132
133
|
logger.end()
|
|
133
134
|
|
|
@@ -145,7 +146,12 @@ export async function align(input: AudioSourceParam, transcript: string, options
|
|
|
145
146
|
logger.end()
|
|
146
147
|
|
|
147
148
|
// Recognize source audio
|
|
148
|
-
|
|
149
|
+
let { wordTimeline: recognitionTimeline } = await API.recognize(sourceRawAudio, recognitionOptions)
|
|
150
|
+
|
|
151
|
+
logger.log('')
|
|
152
|
+
|
|
153
|
+
// Remove non-word entries from recognition timeline
|
|
154
|
+
recognitionTimeline = recognitionTimeline.filter(entry => isWord(entry.text))
|
|
149
155
|
|
|
150
156
|
// Synthesize the ground-truth transcript and get its timeline
|
|
151
157
|
logger.start('Synthesize ground-truth transcript with eSpeak')
|
|
@@ -154,14 +160,14 @@ export async function align(input: AudioSourceParam, transcript: string, options
|
|
|
154
160
|
referenceRawAudio,
|
|
155
161
|
referenceTimeline,
|
|
156
162
|
espeakVoice,
|
|
157
|
-
} = await createAlignmentReferenceUsingEspeak(transcript, language, options.plainText, options.customLexiconPaths,
|
|
163
|
+
} = await createAlignmentReferenceUsingEspeak(transcript, language, options.plainText, options.customLexiconPaths, false)
|
|
158
164
|
|
|
159
165
|
logger.end()
|
|
160
166
|
|
|
161
167
|
const { windowDurations, granularities } = getDtwWindowDurationsAndGranularities()
|
|
162
168
|
|
|
163
169
|
const phoneAlignmentMethod = options.dtw!.phoneAlignmentMethod!
|
|
164
|
-
|
|
170
|
+
|
|
165
171
|
const espeakOptions: EspeakOptions = {
|
|
166
172
|
...defaultEspeakOptions,
|
|
167
173
|
voice: espeakVoice,
|
|
@@ -170,7 +176,7 @@ export async function align(input: AudioSourceParam, transcript: string, options
|
|
|
170
176
|
}
|
|
171
177
|
|
|
172
178
|
// Align the ground-truth transcript and the recognized transcript
|
|
173
|
-
mappedTimeline = await
|
|
179
|
+
mappedTimeline = await alignUsingDtwWithRecognition(
|
|
174
180
|
sourceRawAudio,
|
|
175
181
|
referenceRawAudio,
|
|
176
182
|
referenceTimeline,
|
|
@@ -345,10 +351,10 @@ export const defaultAlignmentOptions: AlignmentOptions = {
|
|
|
345
351
|
topCandidateCount: 5,
|
|
346
352
|
punctuationThreshold: 0.2,
|
|
347
353
|
maxTokensPerPart: 250,
|
|
348
|
-
autoPromptParts:
|
|
354
|
+
autoPromptParts: false,
|
|
349
355
|
suppressRepetition: true,
|
|
356
|
+
decodeTimestampTokens: true,
|
|
350
357
|
seed: undefined,
|
|
351
|
-
decodeTimestampTokens: false,
|
|
352
358
|
}
|
|
353
359
|
},
|
|
354
360
|
|
|
@@ -6,7 +6,7 @@ import { Logger } from '../utilities/Logger.js'
|
|
|
6
6
|
import * as API from './API.js'
|
|
7
7
|
import { logToStderr } from '../utilities/Utilities.js'
|
|
8
8
|
import path from 'path'
|
|
9
|
-
import { WhisperModelName } from '../recognition/WhisperSTT.js'
|
|
9
|
+
import { type WhisperModelName } from '../recognition/WhisperSTT.js'
|
|
10
10
|
import { formatLanguageCodeWithName, languageCodeToName } from '../utilities/Locale.js'
|
|
11
11
|
import { loadPackage } from '../utilities/PackageManager.js'
|
|
12
12
|
import chalk from 'chalk'
|
|
@@ -117,7 +117,7 @@ export async function detectSpeechLanguage(input: AudioSourceParam, options: Spe
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
logger.end()
|
|
120
|
-
logger.logDuration('\nTotal detection time', startTime, chalk.magentaBright)
|
|
120
|
+
logger.logDuration('\nTotal language detection time', startTime, chalk.magentaBright)
|
|
121
121
|
|
|
122
122
|
return {
|
|
123
123
|
detectedLanguage,
|
package/src/api/Recognition.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { loadPackage } from '../utilities/PackageManager.js'
|
|
|
12
12
|
import chalk from 'chalk'
|
|
13
13
|
import { SubtitlesConfig, defaultSubtitlesBaseConfig } from '../subtitles/Subtitles.js'
|
|
14
14
|
import { OpenAICloudSTTOptions, defaultOpenAICloudSTTOptions } from '../recognition/OpenAICloudSTT.js'
|
|
15
|
-
import { WhisperCppOptions } from '../recognition/WhisperCppSTT.js'
|
|
15
|
+
import { type WhisperCppOptions } from '../recognition/WhisperCppSTT.js'
|
|
16
16
|
|
|
17
17
|
const log = logToStderr
|
|
18
18
|
|