echogarden 0.12.2 → 1.0.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 (334) hide show
  1. package/README.md +15 -14
  2. package/data/schemas/options.json +398 -111
  3. package/dist/alignment/DTWMfccSequenceAlignment.d.ts +1 -1
  4. package/dist/alignment/DTWMfccSequenceAlignment.js +8 -8
  5. package/dist/alignment/DTWSequenceAlignment.d.ts +1 -1
  6. package/dist/alignment/DTWSequenceAlignment.js +1 -1
  7. package/dist/alignment/DTWSequenceAlignmentWindowed.d.ts +1 -1
  8. package/dist/alignment/DTWSequenceAlignmentWindowed.js +2 -2
  9. package/dist/alignment/LevenshteinSequenceAlignment.d.ts +1 -1
  10. package/dist/alignment/LevenshteinSequenceAlignment.js +1 -1
  11. package/dist/alignment/SpeechAlignment.d.ts +9 -10
  12. package/dist/alignment/SpeechAlignment.js +136 -105
  13. package/dist/alignment/SpeechAlignment.js.map +1 -1
  14. package/dist/api/API.d.ts +13 -12
  15. package/dist/api/API.js +14 -13
  16. package/dist/api/API.js.map +1 -1
  17. package/dist/api/APIOptions.d.ts +5 -4
  18. package/dist/api/Alignment.d.ts +15 -9
  19. package/dist/api/Alignment.js +88 -74
  20. package/dist/api/Alignment.js.map +1 -1
  21. package/dist/api/Common.js +1 -1
  22. package/dist/api/Denoising.d.ts +6 -6
  23. package/dist/api/Denoising.js +23 -23
  24. package/dist/api/Denoising.js.map +1 -1
  25. package/dist/api/LanguageDetection.d.ts +19 -12
  26. package/dist/api/LanguageDetection.js +88 -38
  27. package/dist/api/LanguageDetection.js.map +1 -1
  28. package/dist/api/Recognition.d.ts +16 -6
  29. package/dist/api/Recognition.js +129 -55
  30. package/dist/api/Recognition.js.map +1 -1
  31. package/dist/api/SourceSeparation.d.ts +17 -0
  32. package/dist/api/SourceSeparation.js +61 -0
  33. package/dist/api/SourceSeparation.js.map +1 -0
  34. package/dist/api/Synthesis.d.ts +18 -18
  35. package/dist/api/Synthesis.js +191 -164
  36. package/dist/api/Synthesis.js.map +1 -1
  37. package/dist/api/Translation.d.ts +19 -8
  38. package/dist/api/Translation.js +132 -35
  39. package/dist/api/Translation.js.map +1 -1
  40. package/dist/api/Vad.d.ts +10 -5
  41. package/dist/api/Vad.js +76 -38
  42. package/dist/api/Vad.js.map +1 -1
  43. package/dist/audio/AudioBufferConversion.d.ts +1 -1
  44. package/dist/audio/AudioBufferConversion.js +4 -4
  45. package/dist/audio/AudioPlayer.d.ts +1 -1
  46. package/dist/audio/AudioPlayer.js +26 -26
  47. package/dist/audio/AudioPlayer.js.map +1 -1
  48. package/dist/audio/AudioRecorder.d.ts +1 -1
  49. package/dist/audio/AudioRecorder.js +5 -5
  50. package/dist/audio/AudioUtilities.d.ts +13 -9
  51. package/dist/audio/AudioUtilities.js +86 -24
  52. package/dist/audio/AudioUtilities.js.map +1 -1
  53. package/dist/cli/CLI.d.ts +3 -3
  54. package/dist/cli/CLI.js +271 -162
  55. package/dist/cli/CLI.js.map +1 -1
  56. package/dist/cli/CLIConfigFile.js +8 -8
  57. package/dist/cli/CLILauncher.js +6 -6
  58. package/dist/cli/CLIOptionsSchema.js +2 -2
  59. package/dist/cli/CLIParser.js +5 -5
  60. package/dist/cli/CLIStarter.js +4 -4
  61. package/dist/codecs/FFMpegTranscoder.d.ts +2 -2
  62. package/dist/codecs/FFMpegTranscoder.js +37 -37
  63. package/dist/codecs/FFMpegTranscoder.js.map +1 -1
  64. package/dist/codecs/TIMITCodec.js +5 -5
  65. package/dist/codecs/WaveCodec.d.ts +1 -1
  66. package/dist/codecs/WaveCodec.js +22 -22
  67. package/dist/denoising/RNNoise.d.ts +1 -1
  68. package/dist/denoising/RNNoise.js +9 -9
  69. package/dist/dsp/BiquadFilter.d.ts +3 -2
  70. package/dist/dsp/BiquadFilter.js +18 -11
  71. package/dist/dsp/BiquadFilter.js.map +1 -1
  72. package/dist/dsp/DecayingPeakEstimator.d.ts +16 -0
  73. package/dist/dsp/DecayingPeakEstimator.js +23 -0
  74. package/dist/dsp/DecayingPeakEstimator.js.map +1 -0
  75. package/dist/dsp/FFT.d.ts +8 -4
  76. package/dist/dsp/FFT.js +76 -30
  77. package/dist/dsp/FFT.js.map +1 -1
  78. package/dist/dsp/KWeightingFilter.d.ts +9 -0
  79. package/dist/dsp/KWeightingFilter.js +40 -0
  80. package/dist/dsp/KWeightingFilter.js.map +1 -0
  81. package/dist/dsp/LoudnessEstimator.d.ts +21 -0
  82. package/dist/dsp/LoudnessEstimator.js +47 -0
  83. package/dist/dsp/LoudnessEstimator.js.map +1 -0
  84. package/dist/dsp/MFCC.d.ts +2 -2
  85. package/dist/dsp/MFCC.js +15 -15
  86. package/dist/dsp/MelSpectogram.d.ts +1 -1
  87. package/dist/dsp/MelSpectogram.js +6 -6
  88. package/dist/dsp/Rubberband.d.ts +11 -11
  89. package/dist/dsp/Rubberband.js +27 -27
  90. package/dist/dsp/Sonic.d.ts +1 -1
  91. package/dist/dsp/Sonic.js +3 -3
  92. package/dist/dsp/SpeexResampler.d.ts +1 -1
  93. package/dist/dsp/SpeexResampler.js +2 -2
  94. package/dist/math/VectorMath.d.ts +12 -8
  95. package/dist/math/VectorMath.js +35 -32
  96. package/dist/math/VectorMath.js.map +1 -1
  97. package/dist/nlp/ChineseSegmentation.js +2 -2
  98. package/dist/nlp/CompromiseNLP.js +3 -3
  99. package/dist/nlp/EspeakPhonemizer.js +30 -30
  100. package/dist/nlp/IPA.js +20 -20
  101. package/dist/nlp/JapaneseSegmentation.js +6 -6
  102. package/dist/nlp/Lexicon.d.ts +1 -1
  103. package/dist/nlp/Lexicon.js +7 -7
  104. package/dist/nlp/Segmentation.d.ts +3 -0
  105. package/dist/nlp/Segmentation.js +21 -14
  106. package/dist/nlp/Segmentation.js.map +1 -1
  107. package/dist/nlp/TextNormalizer.js +16 -16
  108. package/dist/recognition/AmazonTranscribeSTT.d.ts +2 -2
  109. package/dist/recognition/AmazonTranscribeSTT.js +13 -14
  110. package/dist/recognition/AmazonTranscribeSTT.js.map +1 -1
  111. package/dist/recognition/AzureCognitiveServicesSTT.js +5 -6
  112. package/dist/recognition/AzureCognitiveServicesSTT.js.map +1 -1
  113. package/dist/recognition/GoogleCloudSTT.d.ts +3 -3
  114. package/dist/recognition/GoogleCloudSTT.js +18 -18
  115. package/dist/recognition/OpenAICloudSTT.d.ts +19 -0
  116. package/dist/recognition/OpenAICloudSTT.js +81 -0
  117. package/dist/recognition/OpenAICloudSTT.js.map +1 -0
  118. package/dist/recognition/SileroSTT.d.ts +2 -2
  119. package/dist/recognition/SileroSTT.js +25 -25
  120. package/dist/recognition/VoskSTT.d.ts +2 -2
  121. package/dist/recognition/VoskSTT.js +8 -8
  122. package/dist/recognition/WhisperCppSTT.d.ts +88 -0
  123. package/dist/recognition/WhisperCppSTT.js +332 -0
  124. package/dist/recognition/WhisperCppSTT.js.map +1 -0
  125. package/dist/recognition/WhisperSTT.d.ts +49 -25
  126. package/dist/recognition/WhisperSTT.js +626 -481
  127. package/dist/recognition/WhisperSTT.js.map +1 -1
  128. package/dist/server/Client.d.ts +1 -1
  129. package/dist/server/Client.js +22 -22
  130. package/dist/server/Server.js +9 -9
  131. package/dist/server/Server.js.map +1 -1
  132. package/dist/server/Worker.d.ts +22 -22
  133. package/dist/server/Worker.js +36 -36
  134. package/dist/server/Worker.js.map +1 -1
  135. package/dist/server/WorkerStarter.js +2 -2
  136. package/dist/source-separation/MDXNetSourceSeparation.d.ts +11 -0
  137. package/dist/source-separation/MDXNetSourceSeparation.js +161 -0
  138. package/dist/source-separation/MDXNetSourceSeparation.js.map +1 -0
  139. package/dist/speech-language-detection/SileroLanguageDetection.d.ts +1 -1
  140. package/dist/speech-language-detection/SileroLanguageDetection.js +7 -7
  141. package/dist/subtitles/Subtitles.d.ts +10 -0
  142. package/dist/subtitles/Subtitles.js +2 -2
  143. package/dist/subtitles/Subtitles.js.map +1 -1
  144. package/dist/synthesis/AwsPollyTTS.d.ts +1 -1
  145. package/dist/synthesis/AwsPollyTTS.js +12 -12
  146. package/dist/synthesis/AzureCognitiveServicesTTS.js +7 -7
  147. package/dist/synthesis/CoquiServerTTS.js +10 -10
  148. package/dist/synthesis/CoquiServerTTS.js.map +1 -1
  149. package/dist/synthesis/ElevenlabsTTS.d.ts +23 -0
  150. package/dist/synthesis/ElevenlabsTTS.js +103 -0
  151. package/dist/synthesis/ElevenlabsTTS.js.map +1 -0
  152. package/dist/synthesis/EspeakTTS.d.ts +6 -5
  153. package/dist/synthesis/EspeakTTS.js +81 -69
  154. package/dist/synthesis/EspeakTTS.js.map +1 -1
  155. package/dist/synthesis/FliteTTS.d.ts +3 -3
  156. package/dist/synthesis/FliteTTS.js +154 -154
  157. package/dist/synthesis/FliteTTS.js.map +1 -1
  158. package/dist/synthesis/GoogleCloudTTS.d.ts +3 -3
  159. package/dist/synthesis/GoogleCloudTTS.js +17 -17
  160. package/dist/synthesis/GoogleCloudTTS.js.map +1 -1
  161. package/dist/synthesis/GoogleTranslateTTS.d.ts +1 -1
  162. package/dist/synthesis/GoogleTranslateTTS.js +103 -103
  163. package/dist/synthesis/MicrosoftEdgeTTS.d.ts +2 -2
  164. package/dist/synthesis/MicrosoftEdgeTTS.js +74 -74
  165. package/dist/synthesis/OpenAICloudTTS.d.ts +13 -0
  166. package/dist/synthesis/OpenAICloudTTS.js +169 -0
  167. package/dist/synthesis/OpenAICloudTTS.js.map +1 -0
  168. package/dist/synthesis/SamTTS.js +3 -3
  169. package/dist/synthesis/SapiTTS.d.ts +3 -3
  170. package/dist/synthesis/SapiTTS.js +26 -26
  171. package/dist/synthesis/StreamlabsPollyTTS.d.ts +2 -2
  172. package/dist/synthesis/StreamlabsPollyTTS.js +27 -27
  173. package/dist/synthesis/SvoxPicoTTS.d.ts +2 -2
  174. package/dist/synthesis/SvoxPicoTTS.js +65 -65
  175. package/dist/synthesis/SvoxPicoTTS.js.map +1 -1
  176. package/dist/synthesis/VitsTTS.d.ts +3 -3
  177. package/dist/synthesis/VitsTTS.js +378 -378
  178. package/dist/synthesis/VitsTTS.js.map +1 -1
  179. package/dist/tests/Test.js +2 -2
  180. package/dist/utilities/Compression.d.ts +5 -0
  181. package/dist/utilities/Compression.js +29 -13
  182. package/dist/utilities/Compression.js.map +1 -1
  183. package/dist/utilities/FileDownloader.d.ts +1 -1
  184. package/dist/utilities/FileDownloader.js +16 -16
  185. package/dist/utilities/FileSystem.js +7 -7
  186. package/dist/utilities/Locale.d.ts +7 -7
  187. package/dist/utilities/Locale.js +15 -15
  188. package/dist/utilities/Logger.js +3 -3
  189. package/dist/utilities/ObjectUtilities.js +19 -19
  190. package/dist/utilities/OpenPromise.js +2 -2
  191. package/dist/utilities/OpenPromise.js.map +1 -1
  192. package/dist/utilities/PackageManager.js +31 -0
  193. package/dist/utilities/PackageManager.js.map +1 -1
  194. package/dist/utilities/PathUtilities.js +8 -8
  195. package/dist/utilities/RandomGenerator.js +2 -2
  196. package/dist/utilities/SmoothEstimator.d.ts +8 -0
  197. package/dist/utilities/SmoothEstimator.js +25 -0
  198. package/dist/utilities/SmoothEstimator.js.map +1 -0
  199. package/dist/utilities/TarballMaker.js +8 -8
  200. package/dist/utilities/Timeline.d.ts +3 -2
  201. package/dist/utilities/Timeline.js +11 -11
  202. package/dist/utilities/Timeline.js.map +1 -1
  203. package/dist/utilities/Timer.js +4 -4
  204. package/dist/utilities/Utilities.d.ts +4 -0
  205. package/dist/utilities/Utilities.js +38 -15
  206. package/dist/utilities/Utilities.js.map +1 -1
  207. package/dist/utilities/WasmMemoryManager.js +7 -7
  208. package/dist/utilities/WebReader.js +23 -23
  209. package/dist/utilities/WikipediaReader.js +2 -2
  210. package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts +28 -0
  211. package/dist/voice-activity-detection/AdaptiveGateVAD.js +138 -0
  212. package/dist/voice-activity-detection/AdaptiveGateVAD.js.map +1 -0
  213. package/dist/voice-activity-detection/SileroVAD.d.ts +1 -1
  214. package/dist/voice-activity-detection/SileroVAD.js +5 -5
  215. package/dist/voice-activity-detection/SileroVAD.js.map +1 -1
  216. package/dist/voice-activity-detection/WebRtcVAD.d.ts +1 -1
  217. package/dist/voice-activity-detection/WebRtcVAD.js +4 -4
  218. package/docs/API.md +29 -11
  219. package/docs/CLI.md +31 -7
  220. package/docs/Contributing.md +38 -0
  221. package/docs/Development.md +93 -19
  222. package/docs/Engines.md +28 -16
  223. package/docs/Licenses.md +4 -1
  224. package/docs/Options.md +158 -78
  225. package/docs/Releases.md +262 -0
  226. package/docs/Server.md +7 -7
  227. package/docs/Tasklist.md +95 -76
  228. package/docs/Technical.md +4 -4
  229. package/package.json +13 -14
  230. package/src/alignment/DTWMfccSequenceAlignment.ts +9 -9
  231. package/src/alignment/DTWSequenceAlignment.ts +2 -2
  232. package/src/alignment/DTWSequenceAlignmentWindowed.ts +3 -3
  233. package/src/alignment/LevenshteinSequenceAlignment.ts +2 -2
  234. package/src/alignment/SpeechAlignment.ts +204 -119
  235. package/src/api/API.ts +14 -13
  236. package/src/api/APIOptions.ts +12 -11
  237. package/src/api/Alignment.ts +147 -90
  238. package/src/api/Common.ts +1 -1
  239. package/src/api/Denoising.ts +28 -28
  240. package/src/api/LanguageDetection.ts +135 -48
  241. package/src/api/Recognition.ts +198 -59
  242. package/src/api/SourceSeparation.ts +99 -0
  243. package/src/api/Synthesis.ts +217 -181
  244. package/src/api/Translation.ts +193 -40
  245. package/src/api/Vad.ts +110 -41
  246. package/src/audio/AudioBufferConversion.ts +4 -4
  247. package/src/audio/AudioPlayer.ts +27 -27
  248. package/src/audio/AudioRecorder.ts +5 -5
  249. package/src/audio/AudioUtilities.ts +107 -24
  250. package/src/cli/CLI.ts +313 -164
  251. package/src/cli/CLIConfigFile.ts +8 -8
  252. package/src/cli/CLILauncher.ts +6 -6
  253. package/src/cli/CLIOptionsSchema.ts +2 -2
  254. package/src/cli/CLIParser.ts +5 -5
  255. package/src/cli/CLIStarter.ts +4 -4
  256. package/src/codecs/FFMpegTranscoder.ts +38 -38
  257. package/src/codecs/TIMITCodec.ts +5 -5
  258. package/src/codecs/WaveCodec.ts +22 -22
  259. package/src/denoising/RNNoise.ts +9 -9
  260. package/src/dsp/BiquadFilter.ts +19 -11
  261. package/src/dsp/DecayingPeakEstimator.ts +35 -0
  262. package/src/dsp/FFT.ts +103 -35
  263. package/src/dsp/KWeightingFilter.ts +43 -0
  264. package/src/dsp/LoudnessEstimator.ts +74 -0
  265. package/src/dsp/MFCC.ts +15 -15
  266. package/src/dsp/MelSpectogram.ts +7 -7
  267. package/src/dsp/Rubberband.ts +38 -38
  268. package/src/dsp/Sonic.ts +4 -4
  269. package/src/dsp/SpeexResampler.ts +2 -2
  270. package/src/math/VectorMath.ts +42 -33
  271. package/src/nlp/ChineseSegmentation.ts +3 -3
  272. package/src/nlp/CompromiseNLP.ts +3 -3
  273. package/src/nlp/EspeakPhonemizer.ts +30 -30
  274. package/src/nlp/IPA.ts +20 -20
  275. package/src/nlp/JapaneseSegmentation.ts +6 -6
  276. package/src/nlp/Lexicon.ts +8 -8
  277. package/src/nlp/Segmentation.ts +23 -14
  278. package/src/nlp/TextNormalizer.ts +16 -16
  279. package/src/recognition/AmazonTranscribeSTT.ts +16 -17
  280. package/src/recognition/AzureCognitiveServicesSTT.ts +8 -6
  281. package/src/recognition/GoogleCloudSTT.ts +21 -21
  282. package/src/recognition/OpenAICloudSTT.ts +142 -0
  283. package/src/recognition/SileroSTT.ts +26 -26
  284. package/src/recognition/VoskSTT.ts +10 -10
  285. package/src/recognition/WhisperCppSTT.ts +555 -0
  286. package/src/recognition/WhisperSTT.ts +760 -507
  287. package/src/server/Client.ts +23 -23
  288. package/src/server/Server.ts +9 -9
  289. package/src/server/Worker.ts +53 -53
  290. package/src/server/WorkerStarter.ts +2 -2
  291. package/src/source-separation/MDXNetSourceSeparation.ts +228 -0
  292. package/src/speech-language-detection/SileroLanguageDetection.ts +8 -8
  293. package/src/subtitles/Subtitles.ts +3 -3
  294. package/src/synthesis/AwsPollyTTS.ts +14 -14
  295. package/src/synthesis/AzureCognitiveServicesTTS.ts +10 -10
  296. package/src/synthesis/CoquiServerTTS.ts +10 -10
  297. package/src/synthesis/ElevenlabsTTS.ts +137 -0
  298. package/src/synthesis/EspeakTTS.ts +90 -71
  299. package/src/synthesis/FliteTTS.ts +157 -157
  300. package/src/synthesis/GoogleCloudTTS.ts +19 -19
  301. package/src/synthesis/GoogleTranslateTTS.ts +104 -104
  302. package/src/synthesis/MicrosoftEdgeTTS.ts +80 -80
  303. package/src/synthesis/OpenAICloudTTS.ts +196 -0
  304. package/src/synthesis/SamTTS.ts +3 -3
  305. package/src/synthesis/SapiTTS.ts +29 -29
  306. package/src/synthesis/StreamlabsPollyTTS.ts +29 -29
  307. package/src/synthesis/SvoxPicoTTS.ts +67 -67
  308. package/src/synthesis/VitsTTS.ts +380 -380
  309. package/src/tests/Test.ts +4 -4
  310. package/src/utilities/Compression.ts +34 -13
  311. package/src/utilities/FileDownloader.ts +19 -19
  312. package/src/utilities/FileSystem.ts +7 -7
  313. package/src/utilities/Locale.ts +22 -22
  314. package/src/utilities/Logger.ts +4 -4
  315. package/src/utilities/ObjectUtilities.ts +19 -19
  316. package/src/utilities/OpenPromise.ts +2 -2
  317. package/src/utilities/PackageManager.ts +40 -0
  318. package/src/utilities/PathUtilities.ts +8 -8
  319. package/src/utilities/RandomGenerator.ts +3 -3
  320. package/src/utilities/SmoothEstimator.ts +35 -0
  321. package/src/utilities/TarballMaker.ts +9 -9
  322. package/src/utilities/Timeline.ts +15 -13
  323. package/src/utilities/Timer.ts +4 -4
  324. package/src/utilities/Utilities.ts +49 -15
  325. package/src/utilities/WasmMemoryManager.ts +7 -7
  326. package/src/utilities/WebReader.ts +23 -23
  327. package/src/utilities/WikipediaReader.ts +2 -2
  328. package/src/voice-activity-detection/AdaptiveGateVAD.ts +202 -0
  329. package/src/voice-activity-detection/SileroVAD.ts +5 -5
  330. package/src/voice-activity-detection/WebRtcVAD.ts +5 -5
  331. package/dist/synthesis/ElevenLabsTTS.d.ts +0 -8
  332. package/dist/synthesis/ElevenLabsTTS.js +0 -82
  333. package/dist/synthesis/ElevenLabsTTS.js.map +0 -1
  334. package/src/synthesis/ElevenLabsTTS.ts +0 -104
@@ -1,29 +1,29 @@
1
- import { indexOfMax } from "../math/VectorMath.js";
1
+ import { indexOfMax } from '../math/VectorMath.js';
2
2
  import { wordCharacterPattern } from '../nlp/Segmentation.js';
3
3
  import Onnx from 'onnxruntime-node';
4
4
  import { Logger } from '../utilities/Logger.js';
5
- import { logToStderr } from "../utilities/Utilities.js";
6
- import { getRawAudioDuration } from "../audio/AudioUtilities.js";
7
- import { readAndParseJsonFile } from "../utilities/FileSystem.js";
8
- import path from "path";
5
+ import { logToStderr } from '../utilities/Utilities.js';
6
+ import { getRawAudioDuration } from '../audio/AudioUtilities.js';
7
+ import { readAndParseJsonFile } from '../utilities/FileSystem.js';
8
+ import path from 'path';
9
9
  const log = logToStderr;
10
10
  export async function recognize(rawAudio, modelDirectory) {
11
11
  const logger = new Logger();
12
- logger.start("Create ONNX inference session");
13
- const modelPath = path.join(modelDirectory, "model.onnx");
14
- const labelsPath = path.join(modelDirectory, "labels.json");
12
+ logger.start('Create ONNX inference session');
13
+ const modelPath = path.join(modelDirectory, 'model.onnx');
14
+ const labelsPath = path.join(modelDirectory, 'labels.json');
15
15
  const labels = await readAndParseJsonFile(labelsPath);
16
16
  const onnxOptions = {
17
17
  logSeverityLevel: 3
18
18
  };
19
19
  const recognition = await Onnx.InferenceSession.create(modelPath, onnxOptions);
20
- logger.start("Prepare input data");
20
+ logger.start('Prepare input data');
21
21
  const audioSamples = rawAudio.audioChannels[0];
22
22
  const inputTensor = new Onnx.Tensor('float32', audioSamples, [1, audioSamples.length]);
23
23
  const inputs = { input: inputTensor };
24
- logger.start("Recognize with silero model");
24
+ logger.start('Recognize with silero model');
25
25
  const results = await recognition.run(inputs);
26
- const rawResultValues = results["output"].data;
26
+ const rawResultValues = results['output'].data;
27
27
  const tokenResults = [];
28
28
  for (let i = 0; i < rawResultValues.length; i += labels.length) {
29
29
  tokenResults.push(rawResultValues.subarray(i, i + labels.length));
@@ -33,7 +33,7 @@ export async function recognize(rawAudio, modelDirectory) {
33
33
  const bestCandidateIndex = indexOfMax(new Array(...tokenResult));
34
34
  tokens.push(labels[bestCandidateIndex]);
35
35
  }
36
- //log(tokens.join("|"))
36
+ //log(tokens.join('|'))
37
37
  const result = processTokens(tokens, getRawAudioDuration(rawAudio));
38
38
  logger.end();
39
39
  return result;
@@ -44,35 +44,35 @@ function processTokens(tokens, totalDuration) {
44
44
  let tokenGroupIndexes = [[]];
45
45
  for (let i = 0; i < tokenCount; i++) {
46
46
  const token = tokens[i];
47
- if (token == "2") {
47
+ if (token == '2') {
48
48
  if (decodedTokens.length > 0) {
49
49
  const previousDecodedToken = decodedTokens[decodedTokens.length - 1];
50
- decodedTokens.push("$");
50
+ decodedTokens.push('$');
51
51
  decodedTokens.push(previousDecodedToken);
52
52
  tokenGroupIndexes[tokenGroupIndexes.length - 1].push(i);
53
53
  }
54
54
  else {
55
- decodedTokens.push(" ");
55
+ decodedTokens.push(' ');
56
56
  tokenGroupIndexes.push([]);
57
57
  }
58
58
  continue;
59
59
  }
60
- if (token == "_") {
60
+ if (token == '_') {
61
61
  continue;
62
62
  }
63
63
  decodedTokens.push(token);
64
- if (token == " ") {
64
+ if (token == ' ') {
65
65
  tokenGroupIndexes.push([]);
66
66
  }
67
67
  else {
68
68
  tokenGroupIndexes[tokenGroupIndexes.length - 1].push(i);
69
69
  }
70
70
  }
71
- let decodedString = "";
71
+ let decodedString = '';
72
72
  for (let i = 0; i < decodedTokens.length; i++) {
73
73
  const currentToken = decodedTokens[i];
74
74
  const previousToken = decodedTokens[i - 1];
75
- if (currentToken != "$" && (previousToken != currentToken || previousToken == undefined)) {
75
+ if (currentToken != '$' && (previousToken != currentToken || previousToken == undefined)) {
76
76
  decodedString += currentToken;
77
77
  }
78
78
  }
@@ -95,7 +95,7 @@ function processTokens(tokens, totalDuration) {
95
95
  group[group.length - 1] += currentCorrection;
96
96
  }
97
97
  }
98
- const words = decodedString.split(" ");
98
+ const words = decodedString.split(' ');
99
99
  const timeMultiplier = totalDuration / tokenCount;
100
100
  const timeline = [];
101
101
  for (let i = 0; i < words.length; i++) {
@@ -107,7 +107,7 @@ function processTokens(tokens, totalDuration) {
107
107
  const startTime = group[0] * timeMultiplier;
108
108
  const endTime = group[group.length - 1] * timeMultiplier;
109
109
  timeline.push({
110
- type: "word",
110
+ type: 'word',
111
111
  text: text,
112
112
  startTime,
113
113
  endTime,
@@ -117,9 +117,9 @@ function processTokens(tokens, totalDuration) {
117
117
  return { transcript: decodedString, timeline };
118
118
  }
119
119
  export const languageCodeToPackageName = {
120
- "en": "silero-en-v5",
121
- "es": "silero-es-v1",
122
- "de": "silero-de-v1",
123
- "uk": "silero-ua-v3",
120
+ 'en': 'silero-en-v5',
121
+ 'es': 'silero-es-v1',
122
+ 'de': 'silero-de-v1',
123
+ 'uk': 'silero-ua-v3',
124
124
  };
125
125
  //# sourceMappingURL=SileroSTT.js.map
@@ -1,5 +1,5 @@
1
- import { Timeline } from "../utilities/Timeline.js";
2
- import { RawAudio } from "../audio/AudioUtilities.js";
1
+ import { Timeline } from '../utilities/Timeline.js';
2
+ import { RawAudio } from '../audio/AudioUtilities.js';
3
3
  export declare function recognizeFile(filename: string, modelPath: string, verbose?: boolean): Promise<{
4
4
  transcript: string;
5
5
  timeline: Timeline;
@@ -1,7 +1,7 @@
1
- import * as FFMpegTranscoder from "../codecs/FFMpegTranscoder.js";
1
+ import * as FFMpegTranscoder from '../codecs/FFMpegTranscoder.js';
2
2
  import * as AudioBufferConversion from '../audio/AudioBufferConversion.js';
3
- import { Logger } from "../utilities/Logger.js";
4
- import { logToStderr } from "../utilities/Utilities.js";
3
+ import { Logger } from '../utilities/Logger.js';
4
+ import { logToStderr } from '../utilities/Utilities.js';
5
5
  const log = logToStderr;
6
6
  export async function recognizeFile(filename, modelPath, verbose = true) {
7
7
  const rawAudio = await FFMpegTranscoder.decodeToChannels(filename, 16000, 1);
@@ -9,7 +9,7 @@ export async function recognizeFile(filename, modelPath, verbose = true) {
9
9
  }
10
10
  export async function recognize(rawAudio, modelPath, verbose = true) {
11
11
  const logger = new Logger();
12
- logger.start("Initialize vosk recognizer");
12
+ logger.start('Initialize vosk recognizer');
13
13
  const audioChannels = rawAudio.audioChannels;
14
14
  const sampleRate = rawAudio.sampleRate;
15
15
  let Vosk = await import('@echogarden/vosk');
@@ -19,14 +19,14 @@ export async function recognize(rawAudio, modelPath, verbose = true) {
19
19
  recognizer.setMaxAlternatives(0);
20
20
  recognizer.setWords(true);
21
21
  recognizer.setPartialWords(true);
22
- logger.start("Recognize with vosk");
22
+ logger.start('Recognize with vosk');
23
23
  const recognitionStartTimestamp = logger.getTimestamp();
24
24
  const pcmAudio = AudioBufferConversion.encodeToAudioBuffer(audioChannels, 16);
25
25
  const trailingSilence = Buffer.alloc(sampleRate * 4);
26
26
  const pcmAudioWithTrailingSilence = Buffer.concat([pcmAudio, trailingSilence]);
27
27
  const pcmAudioByteCount = pcmAudioWithTrailingSilence.length;
28
28
  const maxChunkSize = sampleRate * 2.0;
29
- let previousResultText = "";
29
+ let previousResultText = '';
30
30
  for (let readOffset = 0; readOffset < pcmAudioByteCount; readOffset += maxChunkSize) {
31
31
  const chunkSize = Math.min(maxChunkSize, pcmAudioByteCount - readOffset);
32
32
  const chunk = pcmAudioWithTrailingSilence.subarray(readOffset, readOffset + chunkSize);
@@ -35,7 +35,7 @@ export async function recognize(rawAudio, modelPath, verbose = true) {
35
35
  const partialResultText = recognizer.partialResult().partial;
36
36
  if (partialResultText != previousResultText) {
37
37
  //logger.log(partialResultText)
38
- //logger.log("")
38
+ //logger.log('')
39
39
  previousResultText = partialResultText;
40
40
  }
41
41
  }
@@ -58,7 +58,7 @@ export async function recognize(rawAudio, modelPath, verbose = true) {
58
58
  const eventEnd = event.end;
59
59
  const eventConfidence = event.conf;
60
60
  timeline.push({
61
- type: "word",
61
+ type: 'word',
62
62
  text: eventText,
63
63
  startTime: eventStart,
64
64
  endTime: eventEnd,
@@ -0,0 +1,88 @@
1
+ import { RawAudio } from '../audio/AudioUtilities.js';
2
+ import { type WhisperTask, type WhisperModelName } from './WhisperSTT.js';
3
+ import { Timeline } from '../utilities/Timeline.js';
4
+ export declare function recognize(sourceRawAudio: RawAudio, task: WhisperTask, sourceLanguage: string | undefined, modelName: WhisperModelName, modelPath: string, options: WhisperCppOptions): Promise<RecognitionResult>;
5
+ export declare function detectLanguage(sourceRawAudio: RawAudio, modelName: WhisperModelName, modelPath: string): Promise<import("../api/LanguageDetection.js").LanguageDetectionResults>;
6
+ export declare function loadModelPackage(modelId: WhisperCppModelId | undefined, languageCode: string | undefined): Promise<{
7
+ modelName: WhisperModelName;
8
+ modelPath: string;
9
+ }>;
10
+ export type WhisperCppBuild = 'cpu' | 'cublas-11.8.0' | 'cublas-12.4.0' | 'custom';
11
+ export declare function loadExecutablePackage(buildKind: WhisperCppBuild): Promise<string>;
12
+ export interface WhisperCppVerboseResult {
13
+ model: {
14
+ type: string;
15
+ multilingual: boolean;
16
+ ftype: number;
17
+ mels: number;
18
+ vocab: number;
19
+ text: {
20
+ ctx: number;
21
+ state: number;
22
+ head: number;
23
+ layer: number;
24
+ };
25
+ audio: {
26
+ ctx: number;
27
+ state: number;
28
+ head: number;
29
+ layer: number;
30
+ };
31
+ };
32
+ params: {
33
+ language: string;
34
+ model: string;
35
+ translate: boolean;
36
+ };
37
+ result: {
38
+ language: string;
39
+ };
40
+ systeminfo: string;
41
+ transcription: {
42
+ text: string;
43
+ timestamps: {
44
+ from: string;
45
+ to: string;
46
+ };
47
+ offsets: {
48
+ from: number;
49
+ to: number;
50
+ };
51
+ tokens: {
52
+ text: string;
53
+ timestamps: {
54
+ from: string;
55
+ to: string;
56
+ };
57
+ offsets: {
58
+ from: number;
59
+ to: number;
60
+ };
61
+ t_dtw: number;
62
+ p: number;
63
+ id: number;
64
+ }[];
65
+ }[];
66
+ }
67
+ interface RecognitionResult {
68
+ transcript: string;
69
+ timeline: Timeline;
70
+ language?: string;
71
+ }
72
+ export interface WhisperCppOptions {
73
+ build?: WhisperCppBuild;
74
+ executablePath?: string;
75
+ enableGPU?: boolean;
76
+ model?: WhisperCppModelId;
77
+ threadCount?: number;
78
+ splitCount?: number;
79
+ topCandidateCount?: number;
80
+ beamCount?: number;
81
+ repetitionThreshold?: number;
82
+ prompt?: string;
83
+ enableDTW?: boolean;
84
+ verbose?: boolean;
85
+ }
86
+ export declare const defaultWhisperCppOptions: WhisperCppOptions;
87
+ export type WhisperCppModelId = 'tiny' | 'tiny-q5_1' | 'tiny.en' | 'tiny.en-q5_1' | 'tiny.en-q8_0' | 'base' | 'base-q5_1' | 'base.en' | 'base.en-q5_1' | 'small' | 'small-q5_1' | 'small.en' | 'small.en-q5_1' | 'medium' | 'medium-q5_0' | 'medium.en' | 'medium.en-q5_0' | 'large' | 'large-v1' | 'large-v2' | 'large-v2-q5_0' | 'large-v3' | 'large-v3-q5_0';
88
+ export {};
@@ -0,0 +1,332 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { encodeRawAudioToWave, getRawAudioDuration } from '../audio/AudioUtilities.js';
3
+ import { Logger } from '../utilities/Logger.js';
4
+ import { getRandomHexString } from '../utilities/Utilities.js';
5
+ import { tryParseTimeRangePatternWithHours } from '../subtitles/Subtitles.js';
6
+ import { getAppTempDir } from '../utilities/PathUtilities.js';
7
+ import { appName } from '../api/Common.js';
8
+ import path from 'node:path';
9
+ import { readAndParseJsonFile, remove } from '../utilities/FileSystem.js';
10
+ import { splitToLines } from '../nlp/Segmentation.js';
11
+ import { extendDeep } from '../utilities/ObjectUtilities.js';
12
+ import { formatLanguageCodeWithName, getShortLanguageCode } from '../utilities/Locale.js';
13
+ import { loadPackage } from '../utilities/PackageManager.js';
14
+ import { detectSpeechLanguageByParts } from '../api/LanguageDetection.js';
15
+ export async function recognize(sourceRawAudio, task, sourceLanguage, modelName, modelPath, options) {
16
+ return new Promise(async (resolve, reject) => {
17
+ const logger = new Logger();
18
+ if (sourceRawAudio.sampleRate != 16000) {
19
+ throw new Error('Source audio must have a sample rate of 16000 Hz');
20
+ }
21
+ options = extendDeep(defaultWhisperCppOptions, options);
22
+ let buildKind;
23
+ let executablePath;
24
+ if (options.executablePath) {
25
+ buildKind = 'custom';
26
+ executablePath = options.executablePath;
27
+ if (options.enableGPU == null) {
28
+ options.enableGPU = true;
29
+ }
30
+ }
31
+ else {
32
+ if (options.build) {
33
+ buildKind = options.build;
34
+ if (options.enableGPU == null) {
35
+ options.enableGPU = buildKind.startsWith('cublas-');
36
+ }
37
+ else if (options.enableGPU === true && !buildKind.startsWith('cublas-')) {
38
+ throw new Error('GPU support is only available for CUDA builds');
39
+ }
40
+ }
41
+ else {
42
+ if (options.enableGPU) {
43
+ buildKind = 'cublas-11.8.0';
44
+ }
45
+ else {
46
+ buildKind = 'cpu';
47
+ }
48
+ }
49
+ executablePath = await loadExecutablePackage(buildKind);
50
+ }
51
+ logger.start(`Recognize with command-line whisper.cpp (build: ${buildKind}, model: ${options.model || modelName})`);
52
+ logger.log('');
53
+ logger.log('');
54
+ const sourceAsWave = encodeRawAudioToWave(sourceRawAudio);
55
+ const tempDirPath = getAppTempDir(appName);
56
+ const outJsonFilePathWithoutExtension = path.join(tempDirPath, `${getRandomHexString(16)}`);
57
+ const outJsonFilePath = `${outJsonFilePathWithoutExtension}.json`;
58
+ const args = [
59
+ '--output-json-full',
60
+ '--output-file',
61
+ outJsonFilePathWithoutExtension,
62
+ '--model',
63
+ modelPath,
64
+ '--language',
65
+ sourceLanguage || 'auto',
66
+ '--threads',
67
+ `${options.threadCount}`,
68
+ '--processors',
69
+ `${options.splitCount}`,
70
+ '--best-of',
71
+ `${options.topCandidateCount}`,
72
+ '--beam-size',
73
+ `${options.beamCount}`,
74
+ '--entropy-thold',
75
+ `${options.repetitionThreshold}`
76
+ ];
77
+ if (options.prompt) {
78
+ args.push('--prompt', options.prompt);
79
+ }
80
+ if (!options.enableGPU) {
81
+ args.push('--no-gpu');
82
+ }
83
+ if (options.enableDTW) {
84
+ args.push('--max-len', '0', '--dtw', modelName.replaceAll('-', '.'));
85
+ }
86
+ else {
87
+ args.push('--max-len', '0');
88
+ }
89
+ if (task === 'translate') {
90
+ args.push('--translate');
91
+ }
92
+ else if (task === 'detect-language') {
93
+ args.push('--detect-language');
94
+ }
95
+ const argsString = args.join(' ');
96
+ const process = spawn(executablePath, [...args, '-']);
97
+ const stdoutLines = [];
98
+ let stderrOutput = '';
99
+ process.stdout.setEncoding('utf8');
100
+ process.stdout.on('data', (str) => {
101
+ if (task === 'detect-language') {
102
+ return;
103
+ }
104
+ const parts = splitToLines(str)
105
+ .map(line => line.trim())
106
+ .filter(line => line.length > 0);
107
+ logger.log(parts.join('\n'));
108
+ stdoutLines.push(...parts);
109
+ });
110
+ process.stderr.setEncoding('utf8');
111
+ process.stderr.on('data', (str) => {
112
+ if (options.verbose) {
113
+ logger.log(str);
114
+ }
115
+ stderrOutput += str;
116
+ });
117
+ process.on('error', (e) => {
118
+ reject(e);
119
+ });
120
+ process.on('close', async (exitCode) => {
121
+ logger.end();
122
+ if (exitCode === 0) {
123
+ const parsedStdOut = parseStdOutLinesToTimeline(stdoutLines, 'word');
124
+ const resultObject = await readAndParseJsonFile(outJsonFilePath);
125
+ await remove(outJsonFilePath);
126
+ if (task === 'detect-language') {
127
+ resolve({ timeline: [], transcript: '', language: resultObject.result.language });
128
+ }
129
+ else {
130
+ const parsedResultObject = await parseResultObject(resultObject, modelName, getRawAudioDuration(sourceRawAudio), options.enableDTW);
131
+ resolve(parsedResultObject);
132
+ }
133
+ }
134
+ else {
135
+ reject(`whisper.cpp exited with code ${exitCode}`);
136
+ logger.log(stderrOutput);
137
+ }
138
+ });
139
+ //writeToStdinInChunks(process, sourceAsWave, 2 ** 10)
140
+ process.stdin.end(sourceAsWave);
141
+ });
142
+ }
143
+ export async function detectLanguage(sourceRawAudio, modelName, modelPath) {
144
+ if (sourceRawAudio.sampleRate != 16000) {
145
+ throw new Error('Source audio must have a sampling rate of 16000');
146
+ }
147
+ async function detectLanguageForPart(partAudio) {
148
+ const { language } = await recognize(partAudio, 'detect-language', undefined, modelName, modelPath, {});
149
+ const partResults = [{
150
+ language: language,
151
+ languageName: formatLanguageCodeWithName(language),
152
+ probability: 1.0,
153
+ }];
154
+ return partResults;
155
+ }
156
+ const results = await detectSpeechLanguageByParts(sourceRawAudio, detectLanguageForPart);
157
+ results.sort((entry1, entry2) => entry2.probability - entry1.probability);
158
+ return results;
159
+ }
160
+ async function parseResultObject(resultObject, modelName, totalDuration, enableDTW) {
161
+ const { Whisper } = await import('../recognition/WhisperSTT.js');
162
+ const whisper = new Whisper(modelName, '');
163
+ await whisper.initializeTokenizerIfNeeded();
164
+ const tokenTimeline = [];
165
+ let currentCorrectionTimeOffset = 0;
166
+ for (let segmentIndex = 0; segmentIndex < resultObject.transcription.length; segmentIndex++) {
167
+ const segmentObject = resultObject.transcription[segmentIndex];
168
+ const tokens = segmentObject.tokens;
169
+ for (let tokenIndex = 0; tokenIndex < tokens.length; tokenIndex++) {
170
+ const tokenObject = tokens[tokenIndex];
171
+ if (tokenIndex === 0 && tokenObject.text === '[_BEG_]' && tokenObject.offsets.from === 0) {
172
+ currentCorrectionTimeOffset = segmentObject.offsets.from / 1000;
173
+ }
174
+ const tokenId = tokenObject.id;
175
+ const tokenText = whisper.tokenToText(tokenId, true);
176
+ const tokenConfidence = tokenObject.p;
177
+ let startTime;
178
+ let endTime;
179
+ if (enableDTW) {
180
+ const nextTokenEntry = tokens[tokenIndex + 1];
181
+ const tokenEntryDtwStartTime = tokenObject.t_dtw / 100;
182
+ const nextTokenEntryDtwStartTime = nextTokenEntry ? nextTokenEntry.t_dtw / 100 : totalDuration;
183
+ startTime = Math.max(tokenEntryDtwStartTime, 0);
184
+ endTime = nextTokenEntryDtwStartTime;
185
+ }
186
+ else {
187
+ startTime = tokenObject.offsets.from / 1000;
188
+ endTime = tokenObject.offsets.to / 1000;
189
+ }
190
+ startTime += currentCorrectionTimeOffset;
191
+ endTime += currentCorrectionTimeOffset;
192
+ tokenTimeline.push({
193
+ type: 'token',
194
+ text: tokenText,
195
+ id: tokenId,
196
+ startTime,
197
+ endTime,
198
+ confidence: tokenConfidence
199
+ });
200
+ }
201
+ }
202
+ const allTokenIds = tokenTimeline.map(entry => entry.id);
203
+ const transcript = whisper.tokensToText(allTokenIds).trim();
204
+ let timeline = whisper.tokenTimelineToWordTimeline(tokenTimeline);
205
+ return {
206
+ transcript,
207
+ timeline,
208
+ language: resultObject.result.language
209
+ };
210
+ }
211
+ function parseStdOutLinesToTimeline(lines, entryType) {
212
+ let transcript = '';
213
+ const timeline = [];
214
+ for (const line of lines) {
215
+ const openingSquareBracketIndex = line.indexOf('[');
216
+ const closingSquareBracketIndex = line.indexOf(']', openingSquareBracketIndex + 1);
217
+ const timeRangeString = line.substring(openingSquareBracketIndex + 1, closingSquareBracketIndex);
218
+ const { startTime, endTime, succeeded } = tryParseTimeRangePatternWithHours(timeRangeString);
219
+ if (!succeeded) {
220
+ continue;
221
+ }
222
+ const text = line.substring(closingSquareBracketIndex + 1 + 2);
223
+ if (text.length === 0) {
224
+ continue;
225
+ }
226
+ transcript += text;
227
+ if (timeline.length === 0 || text.startsWith(' ')) {
228
+ timeline.push({
229
+ type: entryType,
230
+ text: text.trim(),
231
+ startTime: startTime,
232
+ endTime: endTime,
233
+ });
234
+ }
235
+ else {
236
+ const previousEntry = timeline[timeline.length - 1];
237
+ previousEntry.text += text;
238
+ previousEntry.endTime = endTime;
239
+ }
240
+ }
241
+ return { transcript, timeline };
242
+ }
243
+ export async function loadModelPackage(modelId, languageCode) {
244
+ if (modelId === 'large') {
245
+ modelId = 'large-v2';
246
+ }
247
+ if (modelId) {
248
+ const modelName = getModelNameFromModelId(modelId);
249
+ if (languageCode != 'en' && modelName.endsWith('.en')) {
250
+ throw new Error(`The English-only model '${modelName}' cannot be used with a non-English language '${languageCode}'.`);
251
+ }
252
+ }
253
+ else {
254
+ if (languageCode) {
255
+ const shortLanguageCode = getShortLanguageCode(languageCode);
256
+ modelId = shortLanguageCode == 'en' ? 'base.en' : 'base';
257
+ }
258
+ else {
259
+ modelId = 'base';
260
+ }
261
+ }
262
+ const packageName = `whisper.cpp-${modelId}`;
263
+ const modelDir = await loadPackage(packageName);
264
+ const modelPath = path.join(modelDir, `ggml-${modelId}.bin`);
265
+ const modelName = getModelNameFromModelId(modelId);
266
+ return { modelName, modelPath };
267
+ }
268
+ export async function loadExecutablePackage(buildKind) {
269
+ if (buildKind === 'custom') {
270
+ throw new Error(`A 'custom' build kind requires providing a custom path to the whisper.cpp binary in the 'executablePath' option.`);
271
+ }
272
+ const platform = process.platform;
273
+ const arch = process.arch;
274
+ let packageName;
275
+ if (buildKind.startsWith('cublas-')) {
276
+ if (platform === 'win32' && arch === 'x64') {
277
+ packageName = `whisper.cpp-binaries-windows-x64-${buildKind}-latest-patched`;
278
+ }
279
+ else {
280
+ throw new Error(`GPU builds (NVIDIA CUDA only) are currently only available as packages for Windows x64. Please specify a custom path to the binary in the 'executablePath' option.`);
281
+ }
282
+ }
283
+ else if (buildKind === 'cpu') {
284
+ if (platform === 'win32' && arch === 'x64') {
285
+ packageName = `whisper.cpp-binaries-windows-x64-cpu-latest-patched`;
286
+ }
287
+ else if (platform === 'linux' && arch === 'x64') {
288
+ packageName = `whisper.cpp-binaries-linux-x64-cpu-latest-patched`;
289
+ }
290
+ else {
291
+ throw new Error(`Couldn't find a matching whisper.cpp binary package. Please specify a custom path to the binary in the 'executablePath' option.`);
292
+ }
293
+ }
294
+ else {
295
+ throw new Error(`Unknown build kind '${buildKind}'`);
296
+ }
297
+ const packagePath = await loadPackage(packageName);
298
+ let filename = 'main';
299
+ if (platform === 'win32') {
300
+ filename += '.exe';
301
+ }
302
+ return path.join(packagePath, filename);
303
+ }
304
+ function getModelNameFromModelId(modelId) {
305
+ let lastDashIndex = modelId.lastIndexOf('-');
306
+ if (modelId.startsWith('large-v') && lastDashIndex === 5) {
307
+ lastDashIndex = -1;
308
+ }
309
+ let modelName;
310
+ if (lastDashIndex >= 0) {
311
+ modelName = modelId.substring(0, lastDashIndex);
312
+ }
313
+ else {
314
+ modelName = modelId;
315
+ }
316
+ return modelName;
317
+ }
318
+ export const defaultWhisperCppOptions = {
319
+ build: undefined,
320
+ executablePath: undefined,
321
+ model: undefined,
322
+ threadCount: 4,
323
+ splitCount: 1,
324
+ enableGPU: undefined,
325
+ topCandidateCount: 5,
326
+ beamCount: 5,
327
+ repetitionThreshold: 2.4,
328
+ prompt: undefined,
329
+ enableDTW: false,
330
+ verbose: false,
331
+ };
332
+ //# sourceMappingURL=WhisperCppSTT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WhisperCppSTT.js","sourceRoot":"","sources":["../../src/recognition/WhisperCppSTT.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAY,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChG,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9D,OAAO,EAAE,iCAAiC,EAAE,MAAM,2BAA2B,CAAA;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAC5D,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAC5D,OAAO,EAAE,2BAA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