echogarden 1.1.0 → 1.2.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 (56) hide show
  1. package/data/schemas/options.json +56 -1
  2. package/dist/alignment/DTWSequenceAlignmentWindowed.js +6 -1
  3. package/dist/alignment/DTWSequenceAlignmentWindowed.js.map +1 -1
  4. package/dist/alignment/SpeechAlignment.js +1 -1
  5. package/dist/alignment/SpeechAlignment.js.map +1 -1
  6. package/dist/api/APIOptions.d.ts +3 -0
  7. package/dist/api/Alignment.js +2 -1
  8. package/dist/api/Alignment.js.map +1 -1
  9. package/dist/api/GlobalOptions.d.ts +10 -0
  10. package/dist/api/GlobalOptions.js +21 -3
  11. package/dist/api/GlobalOptions.js.map +1 -1
  12. package/dist/cli/CLI.js +224 -191
  13. package/dist/cli/CLI.js.map +1 -1
  14. package/dist/cli/CLIConfigFile.js +7 -7
  15. package/dist/cli/CLIConfigFile.js.map +1 -1
  16. package/dist/cli/CLIOptions.d.ts +7 -0
  17. package/dist/cli/CLIOptions.js +2 -0
  18. package/dist/cli/CLIOptions.js.map +1 -0
  19. package/dist/cli/CLIParser.d.ts +5 -6
  20. package/dist/cli/CLIParser.js +16 -12
  21. package/dist/cli/CLIParser.js.map +1 -1
  22. package/dist/recognition/WhisperSTT.js +34 -17
  23. package/dist/recognition/WhisperSTT.js.map +1 -1
  24. package/dist/utilities/FileDownloader.js +3 -1
  25. package/dist/utilities/FileDownloader.js.map +1 -1
  26. package/dist/utilities/Logger.d.ts +5 -4
  27. package/dist/utilities/Logger.js +19 -8
  28. package/dist/utilities/Logger.js.map +1 -1
  29. package/dist/utilities/PackageManager.js +3 -2
  30. package/dist/utilities/PackageManager.js.map +1 -1
  31. package/dist/utilities/Utilities.d.ts +1 -1
  32. package/dist/utilities/Utilities.js +9 -9
  33. package/dist/utilities/Utilities.js.map +1 -1
  34. package/docs/API.md +3 -10
  35. package/docs/CLI.md +88 -77
  36. package/docs/Contributing.md +4 -4
  37. package/docs/Engines.md +1 -1
  38. package/docs/Options.md +25 -2
  39. package/docs/Releases.md +8 -8
  40. package/docs/Tasklist.md +17 -19
  41. package/docs/Technical.md +2 -2
  42. package/package.json +3 -3
  43. package/src/alignment/DTWSequenceAlignmentWindowed.ts +7 -1
  44. package/src/alignment/SpeechAlignment.ts +1 -1
  45. package/src/api/APIOptions.ts +3 -0
  46. package/src/api/Alignment.ts +4 -2
  47. package/src/api/GlobalOptions.ts +33 -5
  48. package/src/cli/CLI.ts +257 -205
  49. package/src/cli/CLIConfigFile.ts +7 -7
  50. package/src/cli/CLIOptions.ts +8 -0
  51. package/src/cli/CLIParser.ts +20 -17
  52. package/src/recognition/WhisperSTT.ts +38 -17
  53. package/src/utilities/FileDownloader.ts +5 -1
  54. package/src/utilities/Logger.ts +22 -8
  55. package/src/utilities/PackageManager.ts +4 -3
  56. package/src/utilities/Utilities.ts +9 -9
@@ -1,3 +1,5 @@
1
+ import chalk from 'chalk'
2
+ import { Logger } from '../utilities/Logger.js'
1
3
  import { logToStderr } from '../utilities/Utilities.js'
2
4
  import { AlignmentPath } from './SpeechAlignment.js'
3
5
 
@@ -164,7 +166,11 @@ function computeBestPathTransposed(accumulatedCostMatrixTransposed: Float32Array
164
166
  }
165
167
 
166
168
  if (upCost == Infinity && leftCost == Infinity && upAndLeftCost == Infinity) {
167
- log(`computeBestPath: Unexpected - all cost directions are equal to infinity (${columnIndex}, ${rowIndex}).`)
169
+ const logger = new Logger()
170
+
171
+ logger.setAsActiveLogger()
172
+ logger.logTitledMessage(`computeBestPath`, `unexpected - all cost directions are equal to infinity (${columnIndex}, ${rowIndex}).`, chalk.yellowBright, 'warning')
173
+ logger.unsetAsActiveLogger()
168
174
  }
169
175
 
170
176
  const smallestCostDirection = argIndexOfMinimumOf3(upCost, leftCost, upAndLeftCost)
@@ -63,7 +63,7 @@ export async function alignUsingDtw(
63
63
  const minRecommendedWindowDuration = 0.2 * rawAudioDuration
64
64
 
65
65
  if (windowDuration < minRecommendedWindowDuration) {
66
- logger.logTitledMessage('Warning', `Maximum DTW window duration is set to ${windowDuration.toFixed(1)}s, which is smaller than 20% of the source audio duration of ${rawAudioDuration.toFixed(1)}s. This may lead to suboptimal results in some cases. Consider increasing window duration if needed.`, chalk.yellowBright)
66
+ logger.logTitledMessage('Warning', `Maximum DTW window duration is set to ${windowDuration.toFixed(1)}s, which is smaller than 20% of the source audio duration of ${rawAudioDuration.toFixed(1)}s. This may lead to suboptimal results in some cases. Consider increasing window duration if needed.`, chalk.yellowBright, 'warning')
67
67
  }
68
68
  }
69
69
 
@@ -1,5 +1,6 @@
1
1
  import * as API from './API.js'
2
2
  import type { ServerOptions } from '../server/Server.js'
3
+ import { CLIOptions } from '../cli/CLIOptions.js'
3
4
 
4
5
  export interface APIOptions {
5
6
  VoiceListRequestOptions: API.VoiceListRequestOptions
@@ -14,4 +15,6 @@ export interface APIOptions {
14
15
  DenoisingOptions: API.DenoisingOptions
15
16
  SourceSeparationOptions: API.SourceSeparationOptions
16
17
  ServerOptions: ServerOptions
18
+ GlobalOptions: API.GlobalOptions
19
+ CLIOptions: CLIOptions
17
20
  }
@@ -125,6 +125,8 @@ export async function align(input: AudioSourceParam, transcript: string, options
125
125
 
126
126
  switch (options.engine) {
127
127
  case 'dtw': {
128
+ logger.end()
129
+
128
130
  const {
129
131
  referenceRawAudio,
130
132
  referenceTimeline
@@ -140,11 +142,11 @@ export async function align(input: AudioSourceParam, transcript: string, options
140
142
  }
141
143
 
142
144
  case 'dtw-ra': {
145
+ logger.end()
146
+
143
147
  const recognitionOptions: API.RecognitionOptions =
144
148
  extendDeep({ crop: options.crop, language }, options.recognition)
145
149
 
146
- logger.end()
147
-
148
150
  // Recognize source audio
149
151
  let { wordTimeline: recognitionTimeline } = await API.recognize(sourceRawAudio, recognitionOptions)
150
152
 
@@ -1,5 +1,5 @@
1
1
  export function getGlobalOption<K extends keyof GlobalOptions>(key: K): GlobalOptions[K] {
2
- if (!Object.keys(globalOptions).includes(key)) {
2
+ if (!listGlobalOptions().includes(key)) {
3
3
  throw new Error(`Unknown global option key '${key}'`)
4
4
  }
5
5
 
@@ -7,19 +7,47 @@ export function getGlobalOption<K extends keyof GlobalOptions>(key: K): GlobalOp
7
7
  }
8
8
 
9
9
  export function setGlobalOption<K extends keyof GlobalOptions>(key: K, value: GlobalOptions[K]) {
10
- if (!Object.keys(globalOptions).includes(key)) {
10
+ if (!listGlobalOptions().includes(key)) {
11
11
  throw new Error(`Unknown global option key '${key}'`)
12
12
  }
13
13
 
14
- globalOptions[key] = value as any
14
+ globalOptions[key] = value
15
15
  }
16
16
 
17
+ export function listGlobalOptions() {
18
+ return Object.keys(globalOptions)
19
+ }
20
+
21
+ export function logLevelToNumber(logLevel: LogLevel) {
22
+ return logLevels.indexOf(logLevel)
23
+ }
24
+
25
+ export function getLogLevel() {
26
+ return globalOptions.logLevel ?? 'info'
27
+ }
28
+
29
+ export function logLevelGreaterOrEqualTo(referenceLevel: LogLevel) {
30
+ return !logLevelSmallerThan(referenceLevel)
31
+ }
32
+
33
+ export function logLevelSmallerThan(referenceLevel: LogLevel) {
34
+ return logLevelToNumber(getLogLevel()) < logLevelToNumber(referenceLevel)
35
+ }
36
+
37
+ const logLevels = ['silent', 'output', 'error', 'warning', 'info', 'trace'] as const
38
+
39
+ export type LogLevel = typeof logLevels[number]
40
+
17
41
  export interface GlobalOptions {
18
42
  ffmpegPath?: string
19
43
  soxPath?: string
44
+ packageBaseURL?: string
45
+ logLevel?: LogLevel
20
46
  }
21
47
 
22
- const globalOptions = {
48
+ const globalOptions: GlobalOptions = {
23
49
  ffmpegPath: undefined,
24
- soxPath: undefined
50
+ soxPath: undefined,
51
+ packageBaseURL: 'https://huggingface.co/echogarden/echogarden-packages/resolve/main/',
52
+ logLevel: 'info',
25
53
  }