echogarden 1.4.4 → 1.6.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 (240) hide show
  1. package/data/schemas/options.json +310 -25
  2. package/dist/alignment/DTWMfccSequenceAlignment.d.ts +1 -1
  3. package/dist/alignment/DTWMfccSequenceAlignment.js +5 -5
  4. package/dist/alignment/DTWSequenceAlignmentWindowed.js +1 -3
  5. package/dist/alignment/DTWSequenceAlignmentWindowed.js.map +1 -1
  6. package/dist/alignment/{TextAlignment.d.ts → SemanticTextAlignment.d.ts} +4 -2
  7. package/dist/alignment/SemanticTextAlignment.js +336 -0
  8. package/dist/alignment/SemanticTextAlignment.js.map +1 -0
  9. package/dist/alignment/SpeechAlignment.d.ts +4 -3
  10. package/dist/alignment/SpeechAlignment.js +130 -39
  11. package/dist/alignment/SpeechAlignment.js.map +1 -1
  12. package/dist/api/API.d.ts +7 -3
  13. package/dist/api/API.js +7 -2
  14. package/dist/api/API.js.map +1 -1
  15. package/dist/api/APIOptions.d.ts +4 -1
  16. package/dist/api/Alignment.d.ts +1 -1
  17. package/dist/api/Alignment.js +13 -5
  18. package/dist/api/Alignment.js.map +1 -1
  19. package/dist/api/LanguageDetectionCommon.d.ts +6 -0
  20. package/dist/api/LanguageDetectionCommon.js +2 -0
  21. package/dist/api/LanguageDetectionCommon.js.map +1 -0
  22. package/dist/api/Recognition.js.map +1 -1
  23. package/dist/api/{LanguageDetection.d.ts → SpeechLanguageDetection.d.ts} +1 -25
  24. package/dist/api/{LanguageDetection.js → SpeechLanguageDetection.js} +1 -68
  25. package/dist/api/SpeechLanguageDetection.js.map +1 -0
  26. package/dist/api/{Translation.js → SpeechTranslation.js} +3 -3
  27. package/dist/api/SpeechTranslation.js.map +1 -0
  28. package/dist/api/Synthesis.d.ts +0 -1
  29. package/dist/api/Synthesis.js +4 -4
  30. package/dist/api/TextLanguageDetection.d.ts +21 -0
  31. package/dist/api/TextLanguageDetection.js +67 -0
  32. package/dist/api/TextLanguageDetection.js.map +1 -0
  33. package/dist/api/TextTranslation.d.ts +25 -0
  34. package/dist/api/TextTranslation.js +101 -0
  35. package/dist/api/TextTranslation.js.map +1 -0
  36. package/dist/api/TimelineTranslationAlignment.d.ts +23 -0
  37. package/dist/api/TimelineTranslationAlignment.js +92 -0
  38. package/dist/api/TimelineTranslationAlignment.js.map +1 -0
  39. package/dist/api/TranscriptAndTranslationAlignment.d.ts +35 -0
  40. package/dist/api/TranscriptAndTranslationAlignment.js +78 -0
  41. package/dist/api/TranscriptAndTranslationAlignment.js.map +1 -0
  42. package/dist/api/TranslationAlignment.d.ts +4 -3
  43. package/dist/api/TranslationAlignment.js +9 -8
  44. package/dist/api/TranslationAlignment.js.map +1 -1
  45. package/dist/api/VoiceActivityDetection.js +16 -1
  46. package/dist/api/VoiceActivityDetection.js.map +1 -1
  47. package/dist/audio/AudioBufferConversion.d.ts +0 -1
  48. package/dist/audio/AudioPlayer.d.ts +0 -1
  49. package/dist/audio/AudioPlayer.js +62 -41
  50. package/dist/audio/AudioPlayer.js.map +1 -1
  51. package/dist/audio/AudioUtilities.d.ts +0 -1
  52. package/dist/cli/CLI.d.ts +28 -7
  53. package/dist/cli/CLI.js +265 -37
  54. package/dist/cli/CLI.js.map +1 -1
  55. package/dist/codecs/FFMpegTranscoder.d.ts +0 -1
  56. package/dist/codecs/FFMpegTranscoder.js +7 -0
  57. package/dist/codecs/FFMpegTranscoder.js.map +1 -1
  58. package/dist/codecs/TIMITCodec.d.ts +0 -1
  59. package/dist/codecs/WaveCodec.d.ts +0 -1
  60. package/dist/dsp/FFT.d.ts +1 -1
  61. package/dist/dsp/FFT.js +6 -0
  62. package/dist/dsp/FFT.js.map +1 -1
  63. package/dist/dsp/KWeightingFilter.js +1 -1
  64. package/dist/dsp/KWeightingFilter.js.map +1 -1
  65. package/dist/dsp/MelSpectogram.d.ts +3 -2
  66. package/dist/dsp/MelSpectogram.js +14 -8
  67. package/dist/dsp/MelSpectogram.js.map +1 -1
  68. package/dist/math/VectorMath.d.ts +9 -9
  69. package/dist/math/VectorMath.js +10 -10
  70. package/dist/math/VectorMath.js.map +1 -1
  71. package/dist/nlp/ChineseSegmentation.js +4 -4
  72. package/dist/nlp/ChineseSegmentation.js.map +1 -1
  73. package/dist/nlp/Segmentation.d.ts +2 -2
  74. package/dist/nlp/Segmentation.js +20 -13
  75. package/dist/nlp/Segmentation.js.map +1 -1
  76. package/dist/recognition/OpenAICloudSTT.d.ts +2 -1
  77. package/dist/recognition/OpenAICloudSTT.js +30 -19
  78. package/dist/recognition/OpenAICloudSTT.js.map +1 -1
  79. package/dist/recognition/SileroSTT.d.ts +0 -1
  80. package/dist/recognition/WhisperCppSTT.d.ts +3 -3
  81. package/dist/recognition/WhisperCppSTT.js +21 -9
  82. package/dist/recognition/WhisperCppSTT.js.map +1 -1
  83. package/dist/recognition/WhisperSTT.d.ts +9 -6
  84. package/dist/recognition/WhisperSTT.js +227 -46
  85. package/dist/recognition/WhisperSTT.js.map +1 -1
  86. package/dist/server/Client.d.ts +3 -4
  87. package/dist/server/Client.js.map +1 -1
  88. package/dist/server/Worker.d.ts +3 -3
  89. package/dist/server/Worker.js +3 -2
  90. package/dist/server/Worker.js.map +1 -1
  91. package/dist/source-separation/MDXNetSourceSeparation.d.ts +0 -1
  92. package/dist/source-separation/MDXNetSourceSeparation.js +1 -1
  93. package/dist/source-separation/MDXNetSourceSeparation.js.map +1 -1
  94. package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.d.ts +12 -0
  95. package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.js +68 -0
  96. package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.js.map +1 -0
  97. package/dist/speech-language-detection/SileroLanguageDetection.d.ts +1 -2
  98. package/dist/speech-language-detection/SileroLanguageDetection.js +1 -1
  99. package/dist/speech-language-detection/SileroLanguageDetection.js.map +1 -1
  100. package/dist/subtitles/Subtitles.js +2 -2
  101. package/dist/subtitles/Subtitles.js.map +1 -1
  102. package/dist/synthesis/GoogleCloudTTS.d.ts +0 -1
  103. package/dist/synthesis/GoogleTranslateTTS.d.ts +0 -1
  104. package/dist/synthesis/GoogleTranslateTTS.js +6 -21
  105. package/dist/synthesis/GoogleTranslateTTS.js.map +1 -1
  106. package/dist/synthesis/StreamlabsPollyTTS.d.ts +0 -1
  107. package/dist/synthesis/VitsTTS.d.ts +0 -1
  108. package/dist/synthesis/VitsTTS.js +30 -0
  109. package/dist/synthesis/VitsTTS.js.map +1 -1
  110. package/dist/tests/Test.js +0 -31
  111. package/dist/tests/Test.js.map +1 -1
  112. package/dist/text-language-detection/FastTextLanguageDetection.d.ts +1 -1
  113. package/dist/text-language-detection/FastTextLanguageDetection.js.map +1 -1
  114. package/dist/text-language-detection/TinyLDLanguageDetection.d.ts +1 -1
  115. package/dist/text-language-detection/TinyLDLanguageDetection.js.map +1 -1
  116. package/dist/text-translation/DeepLTextTranslation.d.ts +2 -0
  117. package/dist/text-translation/DeepLTextTranslation.js +67 -0
  118. package/dist/text-translation/DeepLTextTranslation.js.map +1 -0
  119. package/dist/text-translation/GoogleTranslateTextTranslation.d.ts +10 -0
  120. package/dist/text-translation/GoogleTranslateTextTranslation.js +554 -0
  121. package/dist/text-translation/GoogleTranslateTextTranslation.js.map +1 -0
  122. package/dist/text-translation/NLLBTextTranslation.d.ts +2 -1
  123. package/dist/text-translation/NLLBTextTranslation.js +249 -19
  124. package/dist/text-translation/NLLBTextTranslation.js.map +1 -1
  125. package/dist/utilities/BinaryArrayConversion.d.ts +0 -1
  126. package/dist/utilities/BrowserRequestHeaders.d.ts +6 -0
  127. package/dist/utilities/BrowserRequestHeaders.js +52 -0
  128. package/dist/utilities/BrowserRequestHeaders.js.map +1 -0
  129. package/dist/utilities/BufferFileReadStream.d.ts +20 -0
  130. package/dist/utilities/BufferFileReadStream.js +81 -0
  131. package/dist/utilities/BufferFileReadStream.js.map +1 -0
  132. package/dist/utilities/DynamicUint8Array.d.ts +9 -0
  133. package/dist/utilities/DynamicUint8Array.js +31 -0
  134. package/dist/utilities/DynamicUint8Array.js.map +1 -0
  135. package/dist/utilities/FileSystem.d.ts +0 -2
  136. package/dist/utilities/Hashing.d.ts +3 -10
  137. package/dist/utilities/Hashing.js +10 -127
  138. package/dist/utilities/Hashing.js.map +1 -1
  139. package/dist/utilities/LEB128.d.ts +15 -5
  140. package/dist/utilities/LEB128.js +199 -119
  141. package/dist/utilities/LEB128.js.map +1 -1
  142. package/dist/utilities/LPVarInt.d.ts +11 -0
  143. package/dist/utilities/LPVarInt.js +187 -0
  144. package/dist/utilities/LPVarInt.js.map +1 -0
  145. package/dist/utilities/Locale.d.ts +1 -1
  146. package/dist/utilities/Locale.js +1 -1
  147. package/dist/utilities/OnnxUtilities.d.ts +1 -2
  148. package/dist/utilities/PVarInt.d.ts +4 -0
  149. package/dist/utilities/PVarInt.js +166 -0
  150. package/dist/utilities/PVarInt.js.map +1 -0
  151. package/dist/utilities/PackageManager.js +48 -25
  152. package/dist/utilities/PackageManager.js.map +1 -1
  153. package/dist/utilities/RandomGenerator.d.ts +3 -17
  154. package/dist/utilities/RandomGenerator.js +12 -81
  155. package/dist/utilities/RandomGenerator.js.map +1 -1
  156. package/dist/utilities/Timeline.d.ts +2 -0
  157. package/dist/utilities/Timeline.js +129 -20
  158. package/dist/utilities/Timeline.js.map +1 -1
  159. package/dist/utilities/Utilities.d.ts +1 -3
  160. package/dist/utilities/Utilities.js +30 -3
  161. package/dist/utilities/Utilities.js.map +1 -1
  162. package/dist/utilities/VarInt.d.ts +4 -0
  163. package/dist/utilities/VarInt.js +166 -0
  164. package/dist/utilities/VarInt.js.map +1 -0
  165. package/dist/utilities/VirtualFileReadStream.d.ts +20 -0
  166. package/dist/utilities/VirtualFileReadStream.js +79 -0
  167. package/dist/utilities/VirtualFileReadStream.js.map +1 -0
  168. package/dist/utilities/WebReader.js +7 -23
  169. package/dist/utilities/WebReader.js.map +1 -1
  170. package/dist/voice-activity-detection/SileroVAD.d.ts +0 -1
  171. package/docs/API.md +105 -3
  172. package/docs/CLI.md +51 -1
  173. package/docs/Engines.md +32 -3
  174. package/docs/Options.md +53 -12
  175. package/docs/Tasklist.md +1 -13
  176. package/package.json +20 -24
  177. package/src/alignment/DTWMfccSequenceAlignment.ts +5 -5
  178. package/src/alignment/DTWSequenceAlignmentWindowed.ts +1 -3
  179. package/src/alignment/SemanticTextAlignment.ts +467 -0
  180. package/src/alignment/SpeechAlignment.ts +214 -56
  181. package/src/api/API.ts +18 -2
  182. package/src/api/APIOptions.ts +14 -1
  183. package/src/api/Alignment.ts +31 -9
  184. package/src/api/LanguageDetectionCommon.ts +7 -0
  185. package/src/api/Recognition.ts +2 -0
  186. package/src/api/{LanguageDetection.ts → SpeechLanguageDetection.ts} +1 -119
  187. package/src/api/{Translation.ts → SpeechTranslation.ts} +2 -2
  188. package/src/api/Synthesis.ts +4 -4
  189. package/src/api/TextLanguageDetection.ts +116 -0
  190. package/src/api/TextTranslation.ts +177 -0
  191. package/src/api/TimelineTranslationAlignment.ts +162 -0
  192. package/src/api/TranscriptAndTranslationAlignment.ts +164 -0
  193. package/src/api/TranslationAlignment.ts +12 -10
  194. package/src/api/VoiceActivityDetection.ts +24 -3
  195. package/src/audio/AudioPlayer.ts +2 -0
  196. package/src/cli/CLI.ts +376 -40
  197. package/src/codecs/FFMpegTranscoder.ts +6 -0
  198. package/src/dsp/FFT.ts +8 -2
  199. package/src/dsp/KWeightingFilter.ts +1 -1
  200. package/src/dsp/MelSpectogram.ts +17 -8
  201. package/src/math/VectorMath.ts +15 -15
  202. package/src/nlp/ChineseSegmentation.ts +6 -4
  203. package/src/nlp/Segmentation.ts +18 -13
  204. package/src/recognition/OpenAICloudSTT.ts +47 -29
  205. package/src/recognition/WhisperCppSTT.ts +26 -11
  206. package/src/recognition/WhisperSTT.ts +364 -49
  207. package/src/server/Client.ts +3 -2
  208. package/src/server/Worker.ts +3 -2
  209. package/src/source-separation/MDXNetSourceSeparation.ts +1 -1
  210. package/src/speech-embeddings/WavToVec2BertFeatureEmbeddings.ts +107 -0
  211. package/src/speech-language-detection/SileroLanguageDetection.ts +2 -1
  212. package/src/subtitles/Subtitles.ts +2 -2
  213. package/src/synthesis/GoogleTranslateTTS.ts +7 -21
  214. package/src/synthesis/VitsTTS.ts +31 -3
  215. package/src/tests/Test.ts +1 -38
  216. package/src/text-language-detection/FastTextLanguageDetection.ts +1 -1
  217. package/src/text-language-detection/TinyLDLanguageDetection.ts +1 -1
  218. package/src/text-translation/DeepLTextTranslation.ts +88 -0
  219. package/src/text-translation/GoogleTranslateTextTranslation.ts +667 -0
  220. package/src/text-translation/NLLBTextTranslation.ts +261 -21
  221. package/src/typings/Fillers.d.ts +25 -2
  222. package/src/utilities/BrowserRequestHeaders.ts +59 -0
  223. package/src/utilities/DynamicUint8Array.ts +39 -0
  224. package/src/utilities/Hashing.ts +14 -167
  225. package/src/utilities/LEB128.ts +273 -148
  226. package/src/utilities/LPVarInt.ts +292 -0
  227. package/src/utilities/Locale.ts +1 -1
  228. package/src/utilities/OnnxUtilities.ts +1 -1
  229. package/src/utilities/PackageManager.ts +51 -30
  230. package/src/utilities/RandomGenerator.ts +12 -113
  231. package/src/utilities/Timeline.ts +162 -23
  232. package/src/utilities/Utilities.ts +40 -3
  233. package/src/utilities/VirtualFileReadStream.ts +109 -0
  234. package/src/utilities/WebReader.ts +9 -23
  235. package/dist/alignment/TextAlignment.js +0 -156
  236. package/dist/alignment/TextAlignment.js.map +0 -1
  237. package/dist/api/LanguageDetection.js.map +0 -1
  238. package/dist/api/Translation.js.map +0 -1
  239. package/src/alignment/TextAlignment.ts +0 -234
  240. /package/dist/api/{Translation.d.ts → SpeechTranslation.d.ts} +0 -0
@@ -1,10 +1,10 @@
1
- /// <reference path="../../src/typings/Fillers.d.ts" />
2
1
  import type * as Onnx from 'onnxruntime-node';
2
+ import { Filterbank } from '../dsp/MelSpectogram.js';
3
3
  import { Timeline } from '../utilities/Timeline.js';
4
4
  import { AlignmentPath } from '../alignment/SpeechAlignment.js';
5
5
  import { RawAudio } from '../audio/AudioUtilities.js';
6
6
  import type { LanguageDetectionResults } from '../api/API.js';
7
- import { XorShift32RNG } from '../utilities/RandomGenerator.js';
7
+ import { XorShift32PRNG } from '../utilities/RandomGenerator.js';
8
8
  import { type Tiktoken } from 'tiktoken/lite';
9
9
  import { OnnxExecutionProvider, OnnxLikeFloat32Tensor } from '../utilities/OnnxUtilities.js';
10
10
  export declare function recognize(sourceRawAudio: RawAudio, modelName: WhisperModelName, modelDir: string, task: WhisperTask, sourceLanguage: string, options: WhisperOptions): Promise<{
@@ -39,8 +39,8 @@ export declare class Whisper {
39
39
  timestampTokensStart: number;
40
40
  timestampTokensEnd: number;
41
41
  };
42
- randomGen: XorShift32RNG;
43
- constructor(modelName: WhisperModelName, modelDir: string, encoderExecutionProviders: OnnxExecutionProvider[], decoderExecutionProviders: OnnxExecutionProvider[], rngSeed?: number);
42
+ randomGen: XorShift32PRNG;
43
+ constructor(modelName: WhisperModelName, modelDir: string, encoderExecutionProviders: OnnxExecutionProvider[], decoderExecutionProviders: OnnxExecutionProvider[], prngSeed?: number);
44
44
  recognize(rawAudio: RawAudio, task: WhisperTask, language: string, options: WhisperOptions, logitFilter?: WhisperLogitFilter): Promise<{
45
45
  transcript: string;
46
46
  timeline: Timeline;
@@ -79,7 +79,10 @@ export declare class Whisper {
79
79
  secondsRangeToFrameCount(startSeconds: number, endSeconds: number): number;
80
80
  languageTokenToLanguageIndex(languageToken: number): void;
81
81
  get isEnglishOnlyModel(): boolean;
82
- getAlignmentHeadIndexes(): number[];
82
+ get isLargeModel(): boolean;
83
+ get filterbankCount(): 128 | 80;
84
+ get filterbanks(): Filterbank[];
85
+ get alignmentHeadIndexes(): number[];
83
86
  getSuppressedTokens(): number[];
84
87
  getSuppressedTextTokens(): number[];
85
88
  getSuppressedMetadataTokens(): number[];
@@ -102,7 +105,7 @@ export type WhisperTokenData = {
102
105
  text: string;
103
106
  };
104
107
  export type WhisperLogitFilter = (logits: number[], decodedTokens: number[], isFirstPart: boolean, isFinalPart: boolean) => number[];
105
- export type WhisperModelName = 'tiny' | 'tiny.en' | 'base' | 'base.en' | 'small' | 'small.en' | 'medium' | 'medium.en' | 'large' | 'large-v1' | 'large-v2' | 'large-v3';
108
+ export type WhisperModelName = 'tiny' | 'tiny.en' | 'base' | 'base.en' | 'small' | 'small.en' | 'medium' | 'medium.en' | 'large-v1' | 'large-v2' | 'large-v3' | 'large-v3-turbo';
106
109
  export type WhisperTask = 'transcribe' | 'translate' | 'detect-language';
107
110
  export declare const modelNameToPackageName: {
108
111
  [modelName in WhisperModelName]: string;
@@ -10,16 +10,17 @@ import path from 'path';
10
10
  import { formatLanguageCodeWithName, getShortLanguageCode, languageCodeToName } from '../utilities/Locale.js';
11
11
  import { loadPackage } from '../utilities/PackageManager.js';
12
12
  import chalk from 'chalk';
13
- import { XorShift32RNG } from '../utilities/RandomGenerator.js';
14
- import { detectSpeechLanguageByParts } from '../api/LanguageDetection.js';
13
+ import { XorShift32PRNG } from '../utilities/RandomGenerator.js';
14
+ import { detectSpeechLanguageByParts } from '../api/SpeechLanguageDetection.js';
15
15
  import { isPunctuation, isWhitespace, isWord, splitToSentences, splitToWords } from '../nlp/Segmentation.js';
16
16
  import { medianOf5Filter } from '../math/MedianFilter.js';
17
17
  import { getDeflateCompressionMetricsForString } from '../utilities/Compression.js';
18
18
  import { getOnnxSessionOptions, makeOnnxLikeFloat32Tensor } from '../utilities/OnnxUtilities.js';
19
+ import { murmurHash3_int32Input } from '../utilities/Hashing.js';
19
20
  export async function recognize(sourceRawAudio, modelName, modelDir, task, sourceLanguage, options) {
20
21
  options = extendDeep(defaultWhisperOptions, options);
21
22
  if (sourceRawAudio.sampleRate != 16000) {
22
- throw new Error('Source audio must have a sampling rate of 16000 Hz');
23
+ throw new Error('Source audio must have a sample rate of 16000 Hz');
23
24
  }
24
25
  sourceLanguage = getShortLanguageCode(sourceLanguage);
25
26
  if (!(sourceLanguage in languageIdLookup)) {
@@ -31,12 +32,16 @@ export async function recognize(sourceRawAudio, modelName, modelDir, task, sourc
31
32
  if (options.temperature && options.temperature < 0) {
32
33
  throw new Error(`Temperature can't be negative`);
33
34
  }
34
- let seed = options.seed;
35
- if (seed) {
36
- seed = Math.max(Math.floor(seed), 1) | 0;
35
+ // Workaround issue with large-v3-turbo that produces invalid results when a prompt is passed to it.
36
+ // Always disable autoprompting for that model.
37
+ if (options.autoPromptParts && modelName == 'large-v3-turbo') {
38
+ options.autoPromptParts = false;
37
39
  }
38
- const encoderProviders = options.encoderProvider ? [options.encoderProvider] : ['dml', 'cpu'];
39
- const decoderProviders = options.decoderProvider ? [options.decoderProvider] : [];
40
+ // Select encoder ONNX provider
41
+ const encoderProviders = options.encoderProvider ? [options.encoderProvider] : getDefaultEncoderProvidersForModel(modelName);
42
+ // Select decoder ONNX provider
43
+ const decoderProviders = options.decoderProvider ? [options.decoderProvider] : getDefaultDecoderProvidersForModel(modelName);
44
+ const seed = options.seed;
40
45
  const whisper = new Whisper(modelName, modelDir, encoderProviders, decoderProviders, seed);
41
46
  const result = await whisper.recognize(sourceRawAudio, task, sourceLanguage, options);
42
47
  return result;
@@ -44,7 +49,7 @@ export async function recognize(sourceRawAudio, modelName, modelDir, task, sourc
44
49
  export async function align(sourceRawAudio, transcript, modelName, modelDir, sourceLanguage, options) {
45
50
  options = extendDeep(defaultWhisperAlignmentOptions, options);
46
51
  if (sourceRawAudio.sampleRate != 16000) {
47
- throw new Error('Source audio must have a sampling rate of 16000');
52
+ throw new Error('Source audio must have a sample rate of 16000 Hz');
48
53
  }
49
54
  sourceLanguage = getShortLanguageCode(sourceLanguage);
50
55
  if (!(sourceLanguage in languageIdLookup)) {
@@ -53,8 +58,10 @@ export async function align(sourceRawAudio, transcript, modelName, modelDir, sou
53
58
  if (isEnglishOnlyModel(modelName) && sourceLanguage != 'en') {
54
59
  throw new Error(`The model '${modelName}' can only be used with English inputs. However, the given source language was ${languageCodeToName(sourceLanguage)}.`);
55
60
  }
56
- const encoderProviders = options.encoderProvider ? [options.encoderProvider] : ['dml', 'cpu'];
57
- const decoderProviders = options.decoderProvider ? [options.decoderProvider] : [];
61
+ // Select encoder ONNX provider
62
+ const encoderProviders = options.encoderProvider ? [options.encoderProvider] : getDefaultEncoderProvidersForModel(modelName);
63
+ // Select decoder ONNX provider
64
+ const decoderProviders = options.decoderProvider ? [options.decoderProvider] : getDefaultDecoderProvidersForModel(modelName);
58
65
  const whisper = new Whisper(modelName, modelDir, encoderProviders, decoderProviders);
59
66
  const timeline = await whisper.align(sourceRawAudio, transcript, sourceLanguage, 'transcribe', options);
60
67
  return timeline;
@@ -62,7 +69,7 @@ export async function align(sourceRawAudio, transcript, modelName, modelDir, sou
62
69
  export async function alignEnglishTranslation(sourceRawAudio, translatedTranscript, modelName, modelDir, sourceLanguage, options) {
63
70
  options = extendDeep(defaultWhisperAlignmentOptions, options);
64
71
  if (sourceRawAudio.sampleRate != 16000) {
65
- throw new Error('Source audio must have a sampling rate of 16000');
72
+ throw new Error('Source audio must have a sample rate of 16000 Hz');
66
73
  }
67
74
  sourceLanguage = getShortLanguageCode(sourceLanguage);
68
75
  if (!(sourceLanguage in languageIdLookup)) {
@@ -71,8 +78,10 @@ export async function alignEnglishTranslation(sourceRawAudio, translatedTranscri
71
78
  if (isEnglishOnlyModel(modelName)) {
72
79
  throw new Error(`Translation alignment can only be done with multilingual models.`);
73
80
  }
74
- const encoderProviders = options.encoderProvider ? [options.encoderProvider] : ['dml', 'cpu'];
75
- const decoderProviders = options.decoderProvider ? [options.decoderProvider] : [];
81
+ // Select encoder ONNX provider
82
+ const encoderProviders = options.encoderProvider ? [options.encoderProvider] : getDefaultEncoderProvidersForModel(modelName);
83
+ // Select decoder ONNX provider
84
+ const decoderProviders = options.decoderProvider ? [options.decoderProvider] : getDefaultDecoderProvidersForModel(modelName);
76
85
  const whisper = new Whisper(modelName, modelDir, encoderProviders, decoderProviders);
77
86
  const timeline = await whisper.align(sourceRawAudio, translatedTranscript, sourceLanguage, 'translate', options);
78
87
  return timeline;
@@ -80,7 +89,7 @@ export async function alignEnglishTranslation(sourceRawAudio, translatedTranscri
80
89
  export async function detectLanguage(sourceRawAudio, modelName, modelDir, options) {
81
90
  options = extendDeep(defaultWhisperLanguageDetectionOptions, options);
82
91
  if (sourceRawAudio.sampleRate != 16000) {
83
- throw new Error('Source audio must have a sampling rate of 16000');
92
+ throw new Error('Source audio must have a sample rate of 16000 Hz');
84
93
  }
85
94
  if (!isMultilingualModel(modelName)) {
86
95
  throw new Error(`Language detection is only supported with multilingual models.`);
@@ -88,7 +97,9 @@ export async function detectLanguage(sourceRawAudio, modelName, modelDir, option
88
97
  if (options.temperature < 0) {
89
98
  throw new Error(`Temperature cannot be negative`);
90
99
  }
91
- const encoderProviders = options.encoderProvider ? [options.encoderProvider] : ['dml', 'cpu'];
100
+ // Select encoder ONNX provider
101
+ const encoderProviders = options.encoderProvider ? [options.encoderProvider] : getDefaultEncoderProvidersForModel(modelName);
102
+ // Select decoder ONNX provider
92
103
  const decoderProviders = options.decoderProvider ? [options.decoderProvider] : [];
93
104
  const whisper = new Whisper(modelName, modelDir, encoderProviders, decoderProviders);
94
105
  async function detectLanguageForPart(partAudio) {
@@ -103,7 +114,7 @@ export async function detectLanguage(sourceRawAudio, modelName, modelDir, option
103
114
  export async function detectVoiceActivity(sourceRawAudio, modelName, modelDir, options) {
104
115
  options = extendDeep(defaultWhisperVADOptions, options);
105
116
  if (sourceRawAudio.sampleRate != 16000) {
106
- throw new Error('Source audio must have a sampling rate of 16000');
117
+ throw new Error('Source audio must have a sample rate of 16000 Hz');
107
118
  }
108
119
  if (options.temperature < 0) {
109
120
  throw new Error(`Temperature cannot be negative`);
@@ -111,7 +122,9 @@ export async function detectVoiceActivity(sourceRawAudio, modelName, modelDir, o
111
122
  const audioSamples = sourceRawAudio.audioChannels[0];
112
123
  const partDuration = 5;
113
124
  const maxSamplesCountForPart = sourceRawAudio.sampleRate * partDuration;
114
- const encoderProviders = options.encoderProvider ? [options.encoderProvider] : ['dml', 'cpu'];
125
+ // Select encoder ONNX provider
126
+ const encoderProviders = options.encoderProvider ? [options.encoderProvider] : getDefaultEncoderProvidersForModel(modelName);
127
+ // Select decoder ONNX provider
115
128
  const decoderProviders = options.decoderProvider ? [options.decoderProvider] : [];
116
129
  const whisper = new Whisper(modelName, modelDir, encoderProviders, decoderProviders);
117
130
  const partProbabilities = [];
@@ -143,7 +156,7 @@ export class Whisper {
143
156
  tiktoken;
144
157
  tokenConfig;
145
158
  randomGen;
146
- constructor(modelName, modelDir, encoderExecutionProviders, decoderExecutionProviders, rngSeed = 461845907) {
159
+ constructor(modelName, modelDir, encoderExecutionProviders, decoderExecutionProviders, prngSeed = 1234) {
147
160
  this.modelName = modelName;
148
161
  this.modelDir = modelDir;
149
162
  this.encoderExecutionProviders = encoderExecutionProviders;
@@ -179,7 +192,7 @@ export class Whisper {
179
192
  timestampTokensEnd: 50363 + 1501,
180
193
  };
181
194
  }
182
- this.randomGen = new XorShift32RNG(rngSeed);
195
+ this.randomGen = new XorShift32PRNG(murmurHash3_int32Input(prngSeed));
183
196
  }
184
197
  async recognize(rawAudio, task, language, options, logitFilter) {
185
198
  await this.initializeIfNeeded();
@@ -242,7 +255,11 @@ export class Whisper {
242
255
  partTokensConfidence = partTokensConfidence.slice(initialTokens.length);
243
256
  partCrossAttentionQKs = partCrossAttentionQKs.slice(initialTokens.length);
244
257
  // Find alignment path
245
- const alignmentPath = await this.findAlignmentPathFromQKs(partCrossAttentionQKs, partTokens, 0, segmentFrameCount); //, alignmentHeadsIndexes[this.modelName])
258
+ let alignmentHeads = undefined;
259
+ if (this.modelName.startsWith('small') || this.modelName.startsWith('medium') || this.modelName.startsWith('large')) {
260
+ alignmentHeads = this.alignmentHeadIndexes;
261
+ }
262
+ const alignmentPath = await this.findAlignmentPathFromQKs(partCrossAttentionQKs, partTokens, 0, segmentFrameCount, alignmentHeads);
246
263
  // Generate timeline from alignment path
247
264
  const partTimeline = await this.getTokenTimelineFromAlignmentPath(alignmentPath, partTokens, segmentStartTime, segmentEndTime, partTokensConfidence);
248
265
  // Add tokens to output
@@ -504,14 +521,14 @@ export class Whisper {
504
521
  return false;
505
522
  }
506
523
  // Derive token probabilities
507
- const probabilities = softmax(allTokenLogits, 1.0);
508
- const logProbabilities = logOfVector(probabilities);
509
- const nonTimestampTokenLogProbs = logProbabilities.slice(0, timestampTokensStart);
524
+ const allTokenProbabilities = softmax(allTokenLogits, 1.0);
525
+ const allTokenLogProbabilities = logOfVector(allTokenProbabilities);
526
+ const nonTimestampTokenLogProbs = allTokenLogProbabilities.slice(0, timestampTokensStart);
510
527
  // Find highest non-timestamp token
511
528
  const indexOfMaxNonTimestampLogProb = indexOfMax(nonTimestampTokenLogProbs);
512
529
  const valueOfMaxNonTimestampLogProb = nonTimestampTokenLogProbs[indexOfMaxNonTimestampLogProb];
513
530
  // Find highest timestamp token
514
- const timestampTokenLogProbs = logProbabilities.slice(timestampTokensStart);
531
+ const timestampTokenLogProbs = allTokenLogProbabilities.slice(timestampTokensStart);
515
532
  const indexOfMaxTimestampLogProb = indexOfMax(timestampTokenLogProbs);
516
533
  // Compute the log of the sum of exponentials of the log probabilities
517
534
  // of the timestamp tokens
@@ -534,7 +551,7 @@ export class Whisper {
534
551
  else {
535
552
  // Otherwise decode the highest probability timestamp
536
553
  const timestampToken = timestampTokensStart + indexOfMaxTimestampLogProb;
537
- const confidence = probabilities[timestampToken];
554
+ const confidence = allTokenProbabilities[timestampToken];
538
555
  addToken(timestampToken, timestampTokenLogits, confidence, crossAttentionQKsForToken);
539
556
  }
540
557
  return true;
@@ -715,9 +732,13 @@ export class Whisper {
715
732
  const sampleRate = rawAudio.sampleRate;
716
733
  const fftOrder = 400;
717
734
  const hopLength = 160;
718
- const filterbankCount = 80;
735
+ const filterbankCount = this.filterbankCount;
736
+ const filterbanks = this.filterbanks;
719
737
  const maxAudioSamples = sampleRate * 30;
720
738
  const maxAudioFrames = 3000;
739
+ if (sampleRate != 16000) {
740
+ throw new Error('Audio must have a sample rate of 16000 Hz');
741
+ }
721
742
  if (audioSamples.length > maxAudioSamples) {
722
743
  throw new Error(`Audio part is longer than 30 seconds`);
723
744
  }
@@ -1051,7 +1072,7 @@ export class Whisper {
1051
1072
  else if (modelName == 'medium' || modelName == 'medium.en') {
1052
1073
  return [48, groupCount, length, 1024];
1053
1074
  }
1054
- else if (modelName == 'large' || modelName == 'large-v1' || modelName == 'large-v2' || modelName == 'large-v3') {
1075
+ else if (modelName == 'large-v1' || modelName == 'large-v2' || modelName == 'large-v3' || modelName == 'large-v3-turbo') {
1055
1076
  return [64, groupCount, length, 1280];
1056
1077
  }
1057
1078
  else {
@@ -1146,7 +1167,16 @@ export class Whisper {
1146
1167
  get isEnglishOnlyModel() {
1147
1168
  return this.isMultiligualModel === false;
1148
1169
  }
1149
- getAlignmentHeadIndexes() {
1170
+ get isLargeModel() {
1171
+ return this.modelName.startsWith('large');
1172
+ }
1173
+ get filterbankCount() {
1174
+ return this.isLargeModel ? 128 : 80;
1175
+ }
1176
+ get filterbanks() {
1177
+ return this.isLargeModel ? filterbanks_128 : filterbanks_80;
1178
+ }
1179
+ get alignmentHeadIndexes() {
1150
1180
  return alignmentHeadsIndexes[this.modelName];
1151
1181
  }
1152
1182
  getSuppressedTokens() {
@@ -1232,8 +1262,8 @@ export async function loadPackagesAndGetPaths(modelName, languageCode) {
1232
1262
  modelName = 'tiny';
1233
1263
  }
1234
1264
  }
1235
- if (modelName.startsWith('large')) {
1236
- throw new Error(`Large models are not currently supported by the integrated Whisper engine due to model size restrictions of onnxruntime-node. To use large models, you can select the whisper.cpp engine instead.`);
1265
+ if (modelName.startsWith('large') && modelName !== 'large-v3-turbo') {
1266
+ throw new Error(`Models 'large-v1', 'large-v2', 'large-v3' are not currently supported by the integrated Whisper engine due to model size restrictions of onnxruntime-node. To use large models, you can either select large-v3-turbo use the whisper.cpp engine instead.`);
1237
1267
  }
1238
1268
  const packageName = modelNameToPackageName[modelName];
1239
1269
  const modelDir = await loadPackage(packageName);
@@ -1254,6 +1284,27 @@ export function isMultilingualModel(modelName) {
1254
1284
  export function isEnglishOnlyModel(modelName) {
1255
1285
  return modelName.endsWith('.en');
1256
1286
  }
1287
+ function getDefaultEncoderProvidersForModel(modelName) {
1288
+ if (process.platform === 'win32') {
1289
+ return ['dml', 'cpu'];
1290
+ }
1291
+ else {
1292
+ return [];
1293
+ }
1294
+ }
1295
+ function getDefaultDecoderProvidersForModel(modelName) {
1296
+ if (modelName.startsWith('small') || modelName.startsWith('medium') || modelName.startsWith('large')) {
1297
+ if (process.platform === 'win32') {
1298
+ return ['dml', 'cpu'];
1299
+ }
1300
+ else {
1301
+ return [];
1302
+ }
1303
+ }
1304
+ else {
1305
+ return [];
1306
+ }
1307
+ }
1257
1308
  export const modelNameToPackageName = {
1258
1309
  'tiny': 'whisper-tiny',
1259
1310
  'tiny.en': 'whisper-tiny.en',
@@ -1263,10 +1314,10 @@ export const modelNameToPackageName = {
1263
1314
  'small.en': 'whisper-small.en',
1264
1315
  'medium': 'whisper-medium',
1265
1316
  'medium.en': 'whisper-medium.en',
1266
- 'large': 'whisper-large-v3',
1267
1317
  'large-v1': 'whisper-large-v1',
1268
1318
  'large-v2': 'whisper-large-v2',
1269
- 'large-v3': 'whisper-large-v3'
1319
+ 'large-v3': 'whisper-large-v3',
1320
+ 'large-v3-turbo': 'whisper-large-v3-turbo-fp16',
1270
1321
  };
1271
1322
  export const tokenizerPackageName = 'whisper-tokenizer';
1272
1323
  const languageIdLookup = {
@@ -1371,20 +1422,20 @@ const languageIdLookup = {
1371
1422
  'su': 98,
1372
1423
  };
1373
1424
  const alignmentHeadsIndexes = {
1374
- 'tiny.en': [6, 12, 17, 18, 19, 20, 21, 22],
1375
- 'tiny': [14, 18, 20, 21, 22, 23],
1376
- 'base.en': [27, 39, 41, 45, 47],
1377
- 'base': [25, 34, 35, 39, 41, 42, 44, 46],
1378
- 'small.en': [78, 84, 87, 92, 98, 101, 103, 108, 112, 116, 118, 120, 121, 122, 123, 126, 131, 134, 136],
1379
- 'small': [63, 69, 96, 100, 103, 104, 108, 115, 117, 125],
1380
- 'medium.en': [180, 225, 236, 238, 244, 256, 260, 265, 284, 286, 295, 298, 303, 320, 323, 329, 334, 348],
1381
- 'medium': [223, 244, 255, 257, 320, 372],
1382
- 'large-v1': [199, 222, 224, 237, 447, 451, 457, 462, 475],
1383
- 'large-v2': [212, 277, 331, 332, 333, 355, 356, 364, 371, 379, 391, 422, 423, 443, 449, 452, 465, 467, 473, 505, 521, 532, 555],
1384
- 'large-v3': [212, 277, 331, 332, 333, 355, 356, 364, 371, 379, 391, 422, 423, 443, 449, 452, 465, 467, 473, 505, 521, 532, 555], // Temporary (may not be correct)
1385
- 'large': [212, 277, 331, 332, 333, 355, 356, 364, 371, 379, 391, 422, 423, 443, 449, 452, 465, 467, 473, 505, 521, 532, 555],
1425
+ 'tiny.en': [6, 12, 17, 18, 19, 20, 21, 22,],
1426
+ 'tiny': [14, 18, 20, 21, 22, 23,],
1427
+ 'base.en': [27, 39, 41, 45, 47,],
1428
+ 'base': [25, 34, 35, 39, 41, 42, 44, 46,],
1429
+ 'small.en': [78, 84, 87, 92, 98, 101, 103, 108, 112, 116, 118, 120, 121, 122, 123, 126, 131, 134, 136,],
1430
+ 'small': [63, 69, 96, 100, 103, 104, 108, 115, 117, 125,],
1431
+ 'medium.en': [180, 225, 236, 238, 244, 256, 260, 265, 284, 286, 295, 298, 303, 320, 323, 329, 334, 348,],
1432
+ 'medium': [223, 244, 255, 257, 320, 372,],
1433
+ 'large-v1': [199, 222, 224, 237, 447, 451, 457, 462, 475,],
1434
+ 'large-v2': [212, 277, 331, 332, 333, 355, 356, 364, 371, 379, 391, 422, 423, 443, 449, 452, 465, 467, 473, 505, 521, 532, 555,],
1435
+ 'large-v3': [140, 217, 258, 272, 321, 354, 391, 424, 481, 506,],
1436
+ 'large-v3-turbo': [44, 51, 63, 66, 71, 74,],
1386
1437
  };
1387
- const filterbanks = [
1438
+ const filterbanks_80 = [
1388
1439
  /* 0 */ { startIndex: 1, weights: [0.02486259490251541,] },
1389
1440
  /* 1 */ { startIndex: 1, weights: [0.001990821911022067, 0.022871771827340126,] },
1390
1441
  /* 2 */ { startIndex: 2, weights: [0.003981643822044134, 0.02088095061480999,] },
@@ -1466,6 +1517,136 @@ const filterbanks = [
1466
1517
  /* 78 */ { startIndex: 179, weights: [0.0003849811910185963, 0.0008885387214832008, 0.001392096164636314, 0.0018956535495817661, 0.00239921105094254, 0.002902768552303314, 0.0034063260536640882, 0.003132763085886836, 0.0026481777895241976, 0.0021635922603309155, 0.0016790067311376333, 0.0011944210855290294, 0.0007098356145434082, 0.00022525011445395648,] },
1467
1518
  /* 79 */ { startIndex: 186, weights: [0.000366741674952209, 0.0008330700220540166, 0.0012993983691558242, 0.0017657268326729536, 0.0022320549469441175, 0.002698383294045925, 0.0031647118739783764, 0.003141313325613737, 0.002692554146051407, 0.0022437951993197203, 0.00179503601975739, 0.0013462770730257034, 0.000897518009878695, 0.0004487590049393475,] },
1468
1519
  ];
1520
+ const filterbanks_128 = [
1521
+ /* 0 */ { startIndex: 1, weights: [0.012373986653983593,] },
1522
+ /* 1 */ { startIndex: 1, weights: [0.030392564833164215,] },
1523
+ /* 2 */ { startIndex: 2, weights: [0.024747973307967186,] },
1524
+ /* 3 */ { startIndex: 2, weights: [0.018018579110503197,] },
1525
+ /* 4 */ { startIndex: 3, weights: [0.037121959030628204,] },
1526
+ /* 5 */ { startIndex: 3, weights: [0.005644591990858316, 0.006729394197463989,] },
1527
+ /* 6 */ { startIndex: 4, weights: [0.03603715822100639,] },
1528
+ /* 7 */ { startIndex: 5, weights: [0.019103379920125008,] },
1529
+ /* 8 */ { startIndex: 5, weights: [0.023663168773055077,] },
1530
+ /* 9 */ { startIndex: 6, weights: [0.031477365642786026,] },
1531
+ /* 10 */ { startIndex: 6, weights: [0.011289183981716633, 0.0010848019737750292,] },
1532
+ /* 11 */ { startIndex: 7, weights: [0.04168175160884857,] },
1533
+ /* 12 */ { startIndex: 8, weights: [0.013458788394927979,] },
1534
+ /* 13 */ { startIndex: 8, weights: [0.029307762160897255,] },
1535
+ /* 14 */ { startIndex: 9, weights: [0.025832774117588997,] },
1536
+ /* 15 */ { startIndex: 9, weights: [0.016933776438236237,] },
1537
+ /* 16 */ { startIndex: 10, weights: [0.038206759840250015,] },
1538
+ /* 17 */ { startIndex: 10, weights: [0.004559790249913931, 0.007814195938408375,] },
1539
+ /* 18 */ { startIndex: 11, weights: [0.03495235741138458,] },
1540
+ /* 19 */ { startIndex: 12, weights: [0.020188182592391968,] },
1541
+ /* 20 */ { startIndex: 12, weights: [0.022578367963433266,] },
1542
+ /* 21 */ { startIndex: 13, weights: [0.032562170177698135,] },
1543
+ /* 22 */ { startIndex: 13, weights: [0.010204383172094822, 0.0021696039475500584,] },
1544
+ /* 23 */ { startIndex: 14, weights: [0.04059694707393646,] },
1545
+ /* 24 */ { startIndex: 15, weights: [0.01454358920454979,] },
1546
+ /* 25 */ { startIndex: 15, weights: [0.028222959488630295,] },
1547
+ /* 26 */ { startIndex: 16, weights: [0.026917576789855957,] },
1548
+ /* 27 */ { startIndex: 16, weights: [0.015848975628614426,] },
1549
+ /* 28 */ { startIndex: 17, weights: [0.039291560649871826,] },
1550
+ /* 29 */ { startIndex: 17, weights: [0.0034749882761389017, 0.008898998610675335,] },
1551
+ /* 30 */ { startIndex: 18, weights: [0.03386755287647247,] },
1552
+ /* 31 */ { startIndex: 19, weights: [0.021272985264658928,] },
1553
+ /* 32 */ { startIndex: 19, weights: [0.021493567153811455,] },
1554
+ /* 33 */ { startIndex: 20, weights: [0.033646970987319946,] },
1555
+ /* 34 */ { startIndex: 20, weights: [0.009119580499827862, 0.003254405688494444,] },
1556
+ /* 35 */ { startIndex: 21, weights: [0.03951214626431465,] },
1557
+ /* 36 */ { startIndex: 22, weights: [0.01562839187681675,] },
1558
+ /* 37 */ { startIndex: 22, weights: [0.027138158679008484,] },
1559
+ /* 38 */ { startIndex: 23, weights: [0.028002377599477768,] },
1560
+ /* 39 */ { startIndex: 23, weights: [0.014764172956347466,] },
1561
+ /* 40 */ { startIndex: 24, weights: [0.040376365184783936,] },
1562
+ /* 41 */ { startIndex: 24, weights: [0.0023806870449334383, 0.010202637873589993,] },
1563
+ /* 42 */ { startIndex: 25, weights: [0.03161146119236946,] },
1564
+ /* 43 */ { startIndex: 26, weights: [0.024547001346945763,] },
1565
+ /* 44 */ { startIndex: 26, weights: [0.015329193323850632, 0.001665837480686605,] },
1566
+ /* 45 */ { startIndex: 27, weights: [0.036729052662849426,] },
1567
+ /* 46 */ { startIndex: 28, weights: [0.020097099244594574,] },
1568
+ /* 47 */ { startIndex: 28, weights: [0.016931025311350822, 0.0029026553966104984,] },
1569
+ /* 48 */ { startIndex: 29, weights: [0.032844990491867065,] },
1570
+ /* 49 */ { startIndex: 30, weights: [0.023520048707723618,] },
1571
+ /* 50 */ { startIndex: 30, weights: [0.011038944125175476, 0.010725829750299454,] },
1572
+ /* 51 */ { startIndex: 31, weights: [0.022718291729688644,] },
1573
+ /* 52 */ { startIndex: 32, weights: [0.03227872774004936,] },
1574
+ /* 53 */ { startIndex: 32, weights: [0.00011626833293121308, 0.022853482514619827,] },
1575
+ /* 54 */ { startIndex: 33, weights: [0.008563440293073654, 0.014979788102209568,] },
1576
+ /* 55 */ { startIndex: 34, weights: [0.015513983555138111, 0.008514906279742718,] },
1577
+ /* 56 */ { startIndex: 35, weights: [0.02110680378973484, 0.003326520323753357,] },
1578
+ /* 57 */ { startIndex: 36, weights: [0.02547064796090126,] },
1579
+ /* 58 */ { startIndex: 37, weights: [0.02735907956957817,] },
1580
+ /* 59 */ { startIndex: 37, weights: [0.0006585361552424729, 0.02383812516927719,] },
1581
+ /* 60 */ { startIndex: 38, weights: [0.0034435924608260393, 0.021224552765488625,] },
1582
+ /* 61 */ { startIndex: 39, weights: [0.0053584217093884945, 0.019425557926297188,] },
1583
+ /* 62 */ { startIndex: 40, weights: [0.006493247114121914, 0.018355421721935272,] },
1584
+ /* 63 */ { startIndex: 41, weights: [0.006931380834430456, 0.017935046926140785,] },
1585
+ /* 64 */ { startIndex: 42, weights: [0.0067496825940907, 0.018091518431901932,] },
1586
+ /* 65 */ { startIndex: 43, weights: [0.006018991116434336, 0.018757672980427742,] },
1587
+ /* 66 */ { startIndex: 44, weights: [0.004804528318345547, 0.019871728494763374,] },
1588
+ /* 67 */ { startIndex: 45, weights: [0.0031662785913795233, 0.02137690968811512, 0.001253173453733325,] },
1589
+ /* 68 */ { startIndex: 46, weights: [0.0011593446834012866, 0.02080361731350422, 0.004044868052005768,] },
1590
+ /* 69 */ { startIndex: 48, weights: [0.017553631216287613, 0.007083200383931398,] },
1591
+ /* 70 */ { startIndex: 49, weights: [0.014075386337935925, 0.010326550342142582,] },
1592
+ /* 71 */ { startIndex: 50, weights: [0.010409214533865452, 0.013736963272094727,] },
1593
+ /* 72 */ { startIndex: 51, weights: [0.006591876968741417, 0.017279881983995438, 0.0014680421445518732,] },
1594
+ /* 73 */ { startIndex: 52, weights: [0.0026568188332021236, 0.01809193193912506, 0.005856557283550501,] },
1595
+ /* 74 */ { startIndex: 54, weights: [0.013342779129743576, 0.010282675735652447,] },
1596
+ /* 75 */ { startIndex: 55, weights: [0.00856800377368927, 0.01472230814397335, 0.001040398608893156,] },
1597
+ /* 76 */ { startIndex: 56, weights: [0.003790855873376131, 0.01714678481221199, 0.006116092670708895,] },
1598
+ /* 77 */ { startIndex: 58, weights: [0.011759290471673012, 0.011133937165141106,] },
1599
+ /* 78 */ { startIndex: 59, weights: [0.006438578478991985, 0.01607806235551834, 0.004239172209054232,] },
1600
+ /* 79 */ { startIndex: 60, weights: [0.0011998937698081136, 0.012756715528666973, 0.00965298991650343,] },
1601
+ /* 80 */ { startIndex: 62, weights: [0.007069352548569441, 0.014940546825528145, 0.004190248437225819,] },
1602
+ /* 81 */ { startIndex: 63, weights: [0.0015148338861763477, 0.012008999474346638, 0.009848233312368393,] },
1603
+ /* 82 */ { startIndex: 65, weights: [0.006102240178734064, 0.01533857174217701, 0.005576768424361944,] },
1604
+ /* 83 */ { startIndex: 66, weights: [0.00036827256553806365, 0.00989749375730753, 0.011353404261171818, 0.0020512230694293976,] },
1605
+ /* 84 */ { startIndex: 68, weights: [0.003892971435561776, 0.012973522767424583, 0.00806631613522768,] },
1606
+ /* 85 */ { startIndex: 70, weights: [0.006744932383298874, 0.013858746737241745, 0.005411905236542225,] },
1607
+ /* 86 */ { startIndex: 71, weights: [0.0007422015769407153, 0.008987790904939175, 0.011378713883459568, 0.003329580882564187,] },
1608
+ /* 87 */ { startIndex: 73, weights: [0.0028231353498995304, 0.010680492967367172, 0.00943340640515089, 0.0017632555682212114,] },
1609
+ /* 88 */ { startIndex: 75, weights: [0.0043901861645281315, 0.011877589859068394, 0.007970058359205723, 0.0006610470009036362,] },
1610
+ /* 89 */ { startIndex: 77, weights: [0.005494666751474142, 0.012629535980522633, 0.00693987961858511,] },
1611
+ /* 90 */ { startIndex: 79, weights: [0.006184019148349762, 0.0129347313195467, 0.00629778765141964,] },
1612
+ /* 91 */ { startIndex: 80, weights: [2.3252101527759805e-05, 0.006502066273242235, 0.0123266177251935, 0.006002165377140045,] },
1613
+ /* 92 */ { startIndex: 82, weights: [0.00031548753031529486, 0.006489255465567112, 0.012041302397847176, 0.006014628801494837,] },
1614
+ /* 93 */ { startIndex: 84, weights: [0.00029979555984027684, 0.006182880140841007, 0.012042728252708912, 0.006299811881035566, 0.0005568959750235081,] },
1615
+ /* 94 */ { startIndex: 86, weights: [1.1204706424905453e-05, 0.005617291666567326, 0.011223378591239452, 0.0068251630291342735, 0.0013526449911296368,] },
1616
+ /* 95 */ { startIndex: 89, weights: [0.004824100062251091, 0.010166232474148273, 0.007560755126178265, 0.002345903078094125,] },
1617
+ /* 96 */ { startIndex: 91, weights: [0.003832357469946146, 0.008922962471842766, 0.00847910437732935, 0.003509786445647478,] },
1618
+ /* 97 */ { startIndex: 93, weights: [0.0026687318459153175, 0.007519651670008898, 0.009555005468428135, 0.004819661378860474, 8.431751484749839e-05,] },
1619
+ /* 98 */ { startIndex: 95, weights: [0.001357673667371273, 0.005980195011943579, 0.01060271542519331, 0.0062529849819839, 0.0017405991675332189,] },
1620
+ /* 99 */ { startIndex: 98, weights: [0.004326442256569862, 0.008731318637728691, 0.007789165247231722, 0.003489238675683737,] },
1621
+ /* 100 */ { startIndex: 100, weights: [0.0025783509481698275, 0.006775828544050455, 0.00940941646695137, 0.005311945918947458, 0.0012144759530201554,] },
1622
+ /* 101 */ { startIndex: 102, weights: [0.0007541119121015072, 0.004753957036882639, 0.008753802627325058, 0.007192090153694153, 0.003287544008344412,] },
1623
+ /* 102 */ { startIndex: 105, weights: [0.0026817969046533108, 0.0064933146350085735, 0.009114579297602177, 0.005393873900175095, 0.0016731682699173689,] },
1624
+ /* 103 */ { startIndex: 107, weights: [0.0005739429616369307, 0.0042060003615915775, 0.007838058285415173, 0.007520230021327734, 0.003974708262830973, 0.00042918731924146414,] },
1625
+ /* 104 */ { startIndex: 110, weights: [0.0019046447705477476, 0.005365691613405943, 0.008826738223433495, 0.0062760948203504086, 0.0028975096065551043,] },
1626
+ /* 105 */ { startIndex: 113, weights: [0.0028988525737076998, 0.006196940783411264, 0.008566990494728088, 0.005347481928765774, 0.002127972897142172,] },
1627
+ /* 106 */ { startIndex: 115, weights: [0.0004475022724363953, 0.0035903039388358593, 0.006733105983585119, 0.007770236115902662, 0.004702313803136349, 0.0016343912575393915,] },
1628
+ /* 107 */ { startIndex: 118, weights: [0.0010153602343052626, 0.004010187461972237, 0.007005014456808567, 0.007234429940581322, 0.0043109566904604435, 0.0013874832075089216,] },
1629
+ /* 108 */ { startIndex: 121, weights: [0.0013334885006770492, 0.004187308251857758, 0.007041127886623144, 0.0069318837486207485, 0.004146058112382889, 0.0013602323597297072,] },
1630
+ /* 109 */ { startIndex: 124, weights: [0.0014287971425801516, 0.004148248583078384, 0.006867699790745974, 0.006837052758783102, 0.004182394593954086, 0.0015277357306331396,] },
1631
+ /* 110 */ { startIndex: 127, weights: [0.0013261043932288885, 0.003917513880878687, 0.006508923601359129, 0.006926396861672401, 0.0043967291712760925, 0.0018670617137104273,] },
1632
+ /* 111 */ { startIndex: 130, weights: [0.0010482777142897248, 0.0035176740493625402, 0.0059870705008506775, 0.007178240455687046, 0.004767679143697023, 0.002357117598876357,] },
1633
+ /* 112 */ { startIndex: 133, weights: [0.0006163640646263957, 0.0029694922268390656, 0.005322620272636414, 0.007572650909423828, 0.005275587551295757, 0.0029785241931676865, 0.0006814609514549375,] },
1634
+ /* 113 */ { startIndex: 136, weights: [4.9713995394995436e-05, 0.0022920481860637665, 0.004534382373094559, 0.006776716560125351, 0.0059024072252213955, 0.00371349835768342, 0.0015245892573148012,] },
1635
+ /* 114 */ { startIndex: 140, weights: [0.0015028533525764942, 0.0036396104842424393, 0.005776367150247097, 0.0066315908916294575, 0.004545743577182293, 0.002459896495565772, 0.00037404923932626843,] },
1636
+ /* 115 */ { startIndex: 143, weights: [0.0006179586052894592, 0.00265410915017128, 0.004690259229391813, 0.006726410239934921, 0.005460347048938274, 0.0034727093297988176, 0.0014850713778287172,] },
1637
+ /* 116 */ { startIndex: 147, weights: [0.001592335756868124, 0.0035326166544109583, 0.005472897551953793, 0.0064436825923621655, 0.004549629986286163, 0.002655577613040805, 0.0007615251233801246,] },
1638
+ /* 117 */ { startIndex: 150, weights: [0.00046749351895414293, 0.0023164190351963043, 0.004165344405919313, 0.0060142697766423225, 0.005678446963429451, 0.0038735736161470413, 0.002068700036033988, 0.0002638266596477479,] },
1639
+ /* 118 */ { startIndex: 154, weights: [0.0010534910252317786, 0.002815362298861146, 0.0045772334560751915, 0.006339104846119881, 0.0051281568594276905, 0.0034082632046192884, 0.0016883700154721737,] },
1640
+ /* 119 */ { startIndex: 158, weights: [0.0014335009036585689, 0.0031124167144298553, 0.00479133240878582, 0.00640943692997098, 0.004770522005856037, 0.0031316077802330256, 0.0014926930889487267,] },
1641
+ /* 120 */ { startIndex: 161, weights: [2.9323589842533693e-05, 0.001629189937375486, 0.003229056019335985, 0.00482892245054245, 0.006146714556962252, 0.004584966227412224, 0.0030232176650315523, 0.0014614691026508808,] },
1642
+ /* 121 */ { startIndex: 165, weights: [0.00013601698447018862, 0.001660555717535317, 0.003185094567015767, 0.004709633067250252, 0.006040723994374275, 0.0045525087043643, 0.003064292948693037, 0.001576077425852418, 8.786193211562932e-05,] },
1643
+ /* 122 */ { startIndex: 169, weights: [9.328097075922415e-05, 0.001546038780361414, 0.002998796757310629, 0.004451554734259844, 0.0059043122455477715, 0.0046556610614061356, 0.003237516153603792, 0.0018193712458014488, 0.00040122633799910545,] },
1644
+ /* 123 */ { startIndex: 174, weights: [0.0013026263331994414, 0.002686982974410057, 0.004071339499205351, 0.005455696024000645, 0.004878324922174215, 0.0035269514191895723, 0.0021755779162049294, 0.0008242045878432691,] },
1645
+ /* 124 */ { startIndex: 178, weights: [0.0009459502762183547, 0.002265126211568713, 0.0035843022633343935, 0.0049034785479307175, 0.005205697845667601, 0.0039179520681500435, 0.00263020652346313, 0.001342460629530251, 5.471494296216406e-05,] },
1646
+ /* 125 */ { startIndex: 182, weights: [0.0004903789376839995, 0.0017474433407187462, 0.003004507627338171, 0.004261571913957596, 0.005518636200577021, 0.004397072363644838, 0.0031699584797024727, 0.001942844595760107, 0.0007157306536100805,] },
1647
+ /* 126 */ { startIndex: 187, weights: [0.0011469805613160133, 0.002344857668504119, 0.0035427347756922245, 0.004740611650049686, 0.0049519846215844154, 0.003782647429034114, 0.002613310469314456, 0.0014439737424254417, 0.0002746368118096143,] },
1648
+ /* 127 */ { startIndex: 191, weights: [0.0004756950947921723, 0.0016171716852113605, 0.002758648479357362, 0.0039001251570880413, 0.005041601601988077, 0.004457120783627033, 0.003342840587720275, 0.0022285603918135166, 0.0011142801959067583,] },
1649
+ ];
1469
1650
  export const defaultWhisperOptions = {
1470
1651
  model: undefined,
1471
1652
  temperature: 0.1,