echogarden 1.4.4 → 1.5.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 (139) hide show
  1. package/data/schemas/options.json +267 -19
  2. package/dist/alignment/{TextAlignment.d.ts → SemanticTextAlignment.d.ts} +4 -2
  3. package/dist/alignment/SemanticTextAlignment.js +336 -0
  4. package/dist/alignment/SemanticTextAlignment.js.map +1 -0
  5. package/dist/alignment/SpeechAlignment.d.ts +2 -1
  6. package/dist/alignment/SpeechAlignment.js +105 -37
  7. package/dist/alignment/SpeechAlignment.js.map +1 -1
  8. package/dist/api/API.d.ts +7 -2
  9. package/dist/api/API.js +7 -2
  10. package/dist/api/API.js.map +1 -1
  11. package/dist/api/APIOptions.d.ts +4 -1
  12. package/dist/api/Alignment.d.ts +1 -1
  13. package/dist/api/Alignment.js +13 -5
  14. package/dist/api/Alignment.js.map +1 -1
  15. package/dist/api/LanguageDetectionCommon.d.ts +6 -0
  16. package/dist/api/LanguageDetectionCommon.js +2 -0
  17. package/dist/api/LanguageDetectionCommon.js.map +1 -0
  18. package/dist/api/Recognition.js.map +1 -1
  19. package/dist/api/{LanguageDetection.d.ts → SpeechLanguageDetection.d.ts} +1 -25
  20. package/dist/api/{LanguageDetection.js → SpeechLanguageDetection.js} +1 -68
  21. package/dist/api/SpeechLanguageDetection.js.map +1 -0
  22. package/dist/api/{Translation.js → SpeechTranslation.js} +3 -3
  23. package/dist/api/SpeechTranslation.js.map +1 -0
  24. package/dist/api/Synthesis.js +4 -4
  25. package/dist/api/TextLanguageDetection.d.ts +21 -0
  26. package/dist/api/TextLanguageDetection.js +67 -0
  27. package/dist/api/TextLanguageDetection.js.map +1 -0
  28. package/dist/api/TextTranslation.d.ts +5 -0
  29. package/dist/api/TextTranslation.js +4 -0
  30. package/dist/api/TextTranslation.js.map +1 -0
  31. package/dist/api/TimelineTranslationAlignment.d.ts +23 -0
  32. package/dist/api/TimelineTranslationAlignment.js +92 -0
  33. package/dist/api/TimelineTranslationAlignment.js.map +1 -0
  34. package/dist/api/TranscriptAndTranslationAlignment.d.ts +35 -0
  35. package/dist/api/TranscriptAndTranslationAlignment.js +78 -0
  36. package/dist/api/TranscriptAndTranslationAlignment.js.map +1 -0
  37. package/dist/api/TranslationAlignment.d.ts +4 -3
  38. package/dist/api/TranslationAlignment.js +9 -8
  39. package/dist/api/TranslationAlignment.js.map +1 -1
  40. package/dist/api/VoiceActivityDetection.js +16 -1
  41. package/dist/api/VoiceActivityDetection.js.map +1 -1
  42. package/dist/cli/CLI.d.ts +27 -7
  43. package/dist/cli/CLI.js +205 -34
  44. package/dist/cli/CLI.js.map +1 -1
  45. package/dist/codecs/FFMpegTranscoder.js +7 -0
  46. package/dist/codecs/FFMpegTranscoder.js.map +1 -1
  47. package/dist/dsp/FFT.d.ts +1 -1
  48. package/dist/dsp/FFT.js +6 -0
  49. package/dist/dsp/FFT.js.map +1 -1
  50. package/dist/dsp/KWeightingFilter.js +1 -1
  51. package/dist/dsp/KWeightingFilter.js.map +1 -1
  52. package/dist/dsp/MelSpectogram.d.ts +3 -2
  53. package/dist/dsp/MelSpectogram.js +14 -8
  54. package/dist/dsp/MelSpectogram.js.map +1 -1
  55. package/dist/math/VectorMath.d.ts +5 -5
  56. package/dist/math/VectorMath.js +4 -4
  57. package/dist/math/VectorMath.js.map +1 -1
  58. package/dist/recognition/WhisperCppSTT.d.ts +1 -1
  59. package/dist/recognition/WhisperCppSTT.js +2 -2
  60. package/dist/recognition/WhisperCppSTT.js.map +1 -1
  61. package/dist/recognition/WhisperSTT.js +9 -6
  62. package/dist/recognition/WhisperSTT.js.map +1 -1
  63. package/dist/server/Client.d.ts +3 -2
  64. package/dist/server/Client.js.map +1 -1
  65. package/dist/server/Worker.d.ts +3 -2
  66. package/dist/server/Worker.js +3 -2
  67. package/dist/server/Worker.js.map +1 -1
  68. package/dist/source-separation/MDXNetSourceSeparation.js +1 -1
  69. package/dist/source-separation/MDXNetSourceSeparation.js.map +1 -1
  70. package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.d.ts +13 -0
  71. package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.js +68 -0
  72. package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.js.map +1 -0
  73. package/dist/speech-language-detection/SileroLanguageDetection.d.ts +1 -1
  74. package/dist/speech-language-detection/SileroLanguageDetection.js +1 -1
  75. package/dist/speech-language-detection/SileroLanguageDetection.js.map +1 -1
  76. package/dist/tests/Test.js +0 -31
  77. package/dist/tests/Test.js.map +1 -1
  78. package/dist/text-language-detection/FastTextLanguageDetection.d.ts +1 -1
  79. package/dist/text-language-detection/FastTextLanguageDetection.js.map +1 -1
  80. package/dist/text-language-detection/TinyLDLanguageDetection.d.ts +1 -1
  81. package/dist/text-language-detection/TinyLDLanguageDetection.js.map +1 -1
  82. package/dist/text-translation/NLLBTextTranslation.js +1 -1
  83. package/dist/text-translation/NLLBTextTranslation.js.map +1 -1
  84. package/dist/utilities/Locale.d.ts +1 -1
  85. package/dist/utilities/Locale.js +1 -1
  86. package/dist/utilities/OnnxUtilities.d.ts +1 -1
  87. package/dist/utilities/PackageManager.js +6 -4
  88. package/dist/utilities/PackageManager.js.map +1 -1
  89. package/dist/utilities/Timeline.d.ts +1 -0
  90. package/dist/utilities/Timeline.js +12 -0
  91. package/dist/utilities/Timeline.js.map +1 -1
  92. package/docs/API.md +81 -3
  93. package/docs/CLI.md +51 -1
  94. package/docs/Engines.md +24 -0
  95. package/docs/Options.md +33 -1
  96. package/package.json +8 -8
  97. package/src/alignment/SemanticTextAlignment.ts +467 -0
  98. package/src/alignment/SpeechAlignment.ts +179 -52
  99. package/src/api/API.ts +18 -2
  100. package/src/api/APIOptions.ts +14 -1
  101. package/src/api/Alignment.ts +31 -9
  102. package/src/api/LanguageDetectionCommon.ts +7 -0
  103. package/src/api/Recognition.ts +2 -0
  104. package/src/api/{LanguageDetection.ts → SpeechLanguageDetection.ts} +1 -119
  105. package/src/api/{Translation.ts → SpeechTranslation.ts} +2 -2
  106. package/src/api/Synthesis.ts +4 -4
  107. package/src/api/TextLanguageDetection.ts +116 -0
  108. package/src/api/TextTranslation.ts +9 -0
  109. package/src/api/TimelineTranslationAlignment.ts +162 -0
  110. package/src/api/TranscriptAndTranslationAlignment.ts +164 -0
  111. package/src/api/TranslationAlignment.ts +12 -10
  112. package/src/api/VoiceActivityDetection.ts +24 -3
  113. package/src/cli/CLI.ts +276 -34
  114. package/src/codecs/FFMpegTranscoder.ts +6 -0
  115. package/src/dsp/FFT.ts +8 -2
  116. package/src/dsp/KWeightingFilter.ts +1 -1
  117. package/src/dsp/MelSpectogram.ts +17 -8
  118. package/src/math/VectorMath.ts +9 -9
  119. package/src/recognition/WhisperCppSTT.ts +2 -2
  120. package/src/recognition/WhisperSTT.ts +10 -6
  121. package/src/server/Client.ts +3 -2
  122. package/src/server/Worker.ts +3 -2
  123. package/src/source-separation/MDXNetSourceSeparation.ts +1 -1
  124. package/src/speech-embeddings/WavToVec2BertFeatureEmbeddings.ts +107 -0
  125. package/src/speech-language-detection/SileroLanguageDetection.ts +2 -1
  126. package/src/tests/Test.ts +1 -38
  127. package/src/text-language-detection/FastTextLanguageDetection.ts +1 -1
  128. package/src/text-language-detection/TinyLDLanguageDetection.ts +1 -1
  129. package/src/text-translation/NLLBTextTranslation.ts +1 -1
  130. package/src/utilities/Locale.ts +1 -1
  131. package/src/utilities/OnnxUtilities.ts +1 -1
  132. package/src/utilities/PackageManager.ts +7 -4
  133. package/src/utilities/Timeline.ts +14 -0
  134. package/dist/alignment/TextAlignment.js +0 -156
  135. package/dist/alignment/TextAlignment.js.map +0 -1
  136. package/dist/api/LanguageDetection.js.map +0 -1
  137. package/dist/api/Translation.js.map +0 -1
  138. package/src/alignment/TextAlignment.ts +0 -234
  139. /package/dist/api/{Translation.d.ts → SpeechTranslation.d.ts} +0 -0
@@ -5,12 +5,12 @@
5
5
  "APIOptions": {
6
6
  "type": "object",
7
7
  "properties": {
8
- "VoiceListRequestOptions": {
9
- "$ref": "#/definitions/VoiceListRequestOptions"
10
- },
11
8
  "SynthesisOptions": {
12
9
  "$ref": "#/definitions/SynthesisOptions"
13
10
  },
11
+ "VoiceListRequestOptions": {
12
+ "$ref": "#/definitions/VoiceListRequestOptions"
13
+ },
14
14
  "RecognitionOptions": {
15
15
  "$ref": "#/definitions/RecognitionOptions"
16
16
  },
@@ -20,9 +20,18 @@
20
20
  "TranslationAlignmentOptions": {
21
21
  "$ref": "#/definitions/TranslationAlignmentOptions"
22
22
  },
23
+ "TranscriptAndTranslationAlignmentOptions": {
24
+ "$ref": "#/definitions/TranscriptAndTranslationAlignmentOptions"
25
+ },
26
+ "TimelineTranslationAlignmentOptions": {
27
+ "$ref": "#/definitions/TimelineTranslationAlignmentOptions"
28
+ },
23
29
  "SpeechTranslationOptions": {
24
30
  "$ref": "#/definitions/SpeechTranslationOptions"
25
31
  },
32
+ "TextTranslationOptions": {
33
+ "$ref": "#/definitions/TextTranslationOptions"
34
+ },
26
35
  "SpeechLanguageDetectionOptions": {
27
36
  "$ref": "#/definitions/SpeechLanguageDetectionOptions"
28
37
  },
@@ -49,12 +58,15 @@
49
58
  }
50
59
  },
51
60
  "required": [
52
- "VoiceListRequestOptions",
53
61
  "SynthesisOptions",
62
+ "VoiceListRequestOptions",
54
63
  "RecognitionOptions",
55
64
  "AlignmentOptions",
56
65
  "TranslationAlignmentOptions",
66
+ "TranscriptAndTranslationAlignmentOptions",
67
+ "TimelineTranslationAlignmentOptions",
57
68
  "SpeechTranslationOptions",
69
+ "TextTranslationOptions",
58
70
  "SpeechLanguageDetectionOptions",
59
71
  "TextLanguageDetectionOptions",
60
72
  "VADOptions",
@@ -66,7 +78,7 @@
66
78
  ],
67
79
  "additionalProperties": false
68
80
  },
69
- "VoiceListRequestOptions": {
81
+ "SynthesisOptions": {
70
82
  "type": "object",
71
83
  "properties": {
72
84
  "engine": {
@@ -356,18 +368,6 @@
356
368
  "streamlabsPolly": {
357
369
  "type": "object",
358
370
  "additionalProperties": false
359
- },
360
- "cache": {
361
- "type": "object",
362
- "properties": {
363
- "path": {
364
- "type": "string"
365
- },
366
- "duration": {
367
- "type": "number"
368
- }
369
- },
370
- "additionalProperties": false
371
371
  }
372
372
  },
373
373
  "additionalProperties": false
@@ -513,6 +513,7 @@
513
513
  "enum": [
514
514
  "dtw",
515
515
  "dtw-ra",
516
+ "dtw-ea",
516
517
  "whisper"
517
518
  ]
518
519
  },
@@ -614,7 +615,8 @@
614
615
  "type": "string",
615
616
  "enum": [
616
617
  "cpu",
617
- "dml"
618
+ "dml",
619
+ "cuda"
618
620
  ]
619
621
  },
620
622
  "WhisperVADOptions": {
@@ -1306,7 +1308,7 @@
1306
1308
  },
1307
1309
  "additionalProperties": false
1308
1310
  },
1309
- "SynthesisOptions": {
1311
+ "VoiceListRequestOptions": {
1310
1312
  "type": "object",
1311
1313
  "properties": {
1312
1314
  "engine": {
@@ -1596,6 +1598,18 @@
1596
1598
  "streamlabsPolly": {
1597
1599
  "type": "object",
1598
1600
  "additionalProperties": false
1601
+ },
1602
+ "cache": {
1603
+ "type": "object",
1604
+ "properties": {
1605
+ "path": {
1606
+ "type": "string"
1607
+ },
1608
+ "duration": {
1609
+ "type": "number"
1610
+ }
1611
+ },
1612
+ "additionalProperties": false
1599
1613
  }
1600
1614
  },
1601
1615
  "additionalProperties": false
@@ -1643,6 +1657,236 @@
1643
1657
  "type": "string",
1644
1658
  "const": "whisper"
1645
1659
  },
1660
+ "TranscriptAndTranslationAlignmentOptions": {
1661
+ "type": "object",
1662
+ "properties": {
1663
+ "engine": {
1664
+ "$ref": "#/definitions/TranscriptAndTranslationAlignmentEngine"
1665
+ },
1666
+ "sourceLanguage": {
1667
+ "type": "string"
1668
+ },
1669
+ "targetLanguage": {
1670
+ "type": "string"
1671
+ },
1672
+ "isolate": {
1673
+ "type": "boolean"
1674
+ },
1675
+ "crop": {
1676
+ "type": "boolean"
1677
+ },
1678
+ "alignment": {
1679
+ "$ref": "#/definitions/AlignmentOptions"
1680
+ },
1681
+ "timelineAlignment": {
1682
+ "$ref": "#/definitions/TimelineTranslationAlignmentOptions"
1683
+ },
1684
+ "languageDetection": {
1685
+ "$ref": "#/definitions/TextLanguageDetectionOptions"
1686
+ },
1687
+ "vad": {
1688
+ "$ref": "#/definitions/VADOptions"
1689
+ },
1690
+ "plainText": {
1691
+ "$ref": "#/definitions/PlainTextOptions"
1692
+ },
1693
+ "subtitles": {
1694
+ "$ref": "#/definitions/SubtitlesConfig"
1695
+ },
1696
+ "sourceSeparation": {
1697
+ "$ref": "#/definitions/SourceSeparationOptions"
1698
+ }
1699
+ },
1700
+ "additionalProperties": false
1701
+ },
1702
+ "TranscriptAndTranslationAlignmentEngine": {
1703
+ "type": "string",
1704
+ "const": "two-stage"
1705
+ },
1706
+ "TimelineTranslationAlignmentOptions": {
1707
+ "type": "object",
1708
+ "properties": {
1709
+ "engine": {
1710
+ "type": "string",
1711
+ "const": "e5"
1712
+ },
1713
+ "sourceLanguage": {
1714
+ "type": "string"
1715
+ },
1716
+ "targetLanguage": {
1717
+ "type": "string"
1718
+ },
1719
+ "audio": {
1720
+ "$ref": "#/definitions/AudioSourceParam"
1721
+ },
1722
+ "languageDetection": {
1723
+ "$ref": "#/definitions/TextLanguageDetectionOptions"
1724
+ },
1725
+ "subtitles": {
1726
+ "$ref": "#/definitions/SubtitlesConfig"
1727
+ },
1728
+ "e5": {
1729
+ "type": "object",
1730
+ "properties": {
1731
+ "model": {
1732
+ "type": "string",
1733
+ "const": "small-fp16"
1734
+ }
1735
+ },
1736
+ "required": [
1737
+ "model"
1738
+ ],
1739
+ "additionalProperties": false
1740
+ }
1741
+ },
1742
+ "additionalProperties": false
1743
+ },
1744
+ "AudioSourceParam": {
1745
+ "anyOf": [
1746
+ {
1747
+ "type": "string"
1748
+ },
1749
+ {
1750
+ "$ref": "#/definitions/global.Buffer"
1751
+ },
1752
+ {
1753
+ "type": "object",
1754
+ "properties": {
1755
+ "BYTES_PER_ELEMENT": {
1756
+ "type": "number"
1757
+ },
1758
+ "buffer": {
1759
+ "type": "object",
1760
+ "properties": {
1761
+ "byteLength": {
1762
+ "type": "number"
1763
+ }
1764
+ },
1765
+ "required": [
1766
+ "byteLength"
1767
+ ],
1768
+ "additionalProperties": false
1769
+ },
1770
+ "byteLength": {
1771
+ "type": "number"
1772
+ },
1773
+ "byteOffset": {
1774
+ "type": "number"
1775
+ },
1776
+ "length": {
1777
+ "type": "number"
1778
+ }
1779
+ },
1780
+ "required": [
1781
+ "BYTES_PER_ELEMENT",
1782
+ "buffer",
1783
+ "byteLength",
1784
+ "byteOffset",
1785
+ "length"
1786
+ ],
1787
+ "additionalProperties": {
1788
+ "type": "number"
1789
+ }
1790
+ },
1791
+ {
1792
+ "$ref": "#/definitions/RawAudio"
1793
+ }
1794
+ ]
1795
+ },
1796
+ "global.Buffer": {
1797
+ "type": "object",
1798
+ "additionalProperties": {
1799
+ "type": "number"
1800
+ },
1801
+ "properties": {
1802
+ "BYTES_PER_ELEMENT": {
1803
+ "type": "number"
1804
+ },
1805
+ "buffer": {
1806
+ "type": "object",
1807
+ "properties": {
1808
+ "byteLength": {
1809
+ "type": "number"
1810
+ }
1811
+ },
1812
+ "required": [
1813
+ "byteLength"
1814
+ ],
1815
+ "additionalProperties": false
1816
+ },
1817
+ "byteLength": {
1818
+ "type": "number"
1819
+ },
1820
+ "byteOffset": {
1821
+ "type": "number"
1822
+ },
1823
+ "length": {
1824
+ "type": "number"
1825
+ }
1826
+ },
1827
+ "required": [
1828
+ "BYTES_PER_ELEMENT",
1829
+ "buffer",
1830
+ "byteLength",
1831
+ "byteOffset",
1832
+ "length"
1833
+ ]
1834
+ },
1835
+ "RawAudio": {
1836
+ "type": "object",
1837
+ "properties": {
1838
+ "audioChannels": {
1839
+ "type": "array",
1840
+ "items": {
1841
+ "type": "object",
1842
+ "properties": {
1843
+ "BYTES_PER_ELEMENT": {
1844
+ "type": "number"
1845
+ },
1846
+ "buffer": {
1847
+ "type": "object",
1848
+ "properties": {
1849
+ "byteLength": {
1850
+ "type": "number"
1851
+ }
1852
+ },
1853
+ "required": [
1854
+ "byteLength"
1855
+ ],
1856
+ "additionalProperties": false
1857
+ },
1858
+ "byteLength": {
1859
+ "type": "number"
1860
+ },
1861
+ "byteOffset": {
1862
+ "type": "number"
1863
+ },
1864
+ "length": {
1865
+ "type": "number"
1866
+ }
1867
+ },
1868
+ "required": [
1869
+ "BYTES_PER_ELEMENT",
1870
+ "buffer",
1871
+ "byteLength",
1872
+ "byteOffset",
1873
+ "length"
1874
+ ],
1875
+ "additionalProperties": {
1876
+ "type": "number"
1877
+ }
1878
+ }
1879
+ },
1880
+ "sampleRate": {
1881
+ "type": "number"
1882
+ }
1883
+ },
1884
+ "required": [
1885
+ "audioChannels",
1886
+ "sampleRate"
1887
+ ],
1888
+ "additionalProperties": false
1889
+ },
1646
1890
  "SpeechTranslationOptions": {
1647
1891
  "type": "object",
1648
1892
  "properties": {
@@ -1693,6 +1937,10 @@
1693
1937
  "openai-cloud"
1694
1938
  ]
1695
1939
  },
1940
+ "TextTranslationOptions": {
1941
+ "type": "object",
1942
+ "additionalProperties": false
1943
+ },
1696
1944
  "DenoisingOptions": {
1697
1945
  "type": "object",
1698
1946
  "properties": {
@@ -1,6 +1,7 @@
1
1
  import { type PreTrainedModel, type PreTrainedTokenizer } from '@echogarden/transformers-nodejs-lite';
2
- export declare function alignText(text1: string, langCode1: string, text2: string, langCode2: string): Promise<void>;
3
- export declare function alignWords(words1: string[], words2: string[]): Promise<WordMapping[]>;
2
+ import { Timeline } from '../utilities/Timeline.js';
3
+ export declare function alignTimelineToTextSemantically(timeline: Timeline, text: string, textLangCode: string): Promise<Timeline>;
4
+ export declare function alignWordsToWordsSemantically(wordsGroups1: string[][], wordsGroups2: string[][], windowTokenCount?: number): Promise<WordMapping[]>;
4
5
  export declare class E5TextEmbedding {
5
6
  readonly modelPath: string;
6
7
  tokenizer?: PreTrainedTokenizer;
@@ -21,3 +22,4 @@ export interface WordMapping {
21
22
  wordIndex2: number;
22
23
  word2: string;
23
24
  }
25
+ export declare const e5SupportedLanguages: string[];