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.
- package/data/schemas/options.json +56 -1
- package/dist/alignment/DTWSequenceAlignmentWindowed.js +6 -1
- package/dist/alignment/DTWSequenceAlignmentWindowed.js.map +1 -1
- package/dist/alignment/SpeechAlignment.js +1 -1
- package/dist/alignment/SpeechAlignment.js.map +1 -1
- package/dist/api/APIOptions.d.ts +3 -0
- package/dist/api/Alignment.js +2 -1
- package/dist/api/Alignment.js.map +1 -1
- package/dist/api/GlobalOptions.d.ts +10 -0
- package/dist/api/GlobalOptions.js +21 -3
- package/dist/api/GlobalOptions.js.map +1 -1
- package/dist/cli/CLI.js +224 -191
- package/dist/cli/CLI.js.map +1 -1
- package/dist/cli/CLIConfigFile.js +7 -7
- package/dist/cli/CLIConfigFile.js.map +1 -1
- package/dist/cli/CLIOptions.d.ts +7 -0
- package/dist/cli/CLIOptions.js +2 -0
- package/dist/cli/CLIOptions.js.map +1 -0
- package/dist/cli/CLIParser.d.ts +5 -6
- package/dist/cli/CLIParser.js +16 -12
- package/dist/cli/CLIParser.js.map +1 -1
- package/dist/recognition/WhisperSTT.js +34 -17
- package/dist/recognition/WhisperSTT.js.map +1 -1
- package/dist/utilities/FileDownloader.js +3 -1
- package/dist/utilities/FileDownloader.js.map +1 -1
- package/dist/utilities/Logger.d.ts +5 -4
- package/dist/utilities/Logger.js +19 -8
- package/dist/utilities/Logger.js.map +1 -1
- package/dist/utilities/PackageManager.js +3 -2
- package/dist/utilities/PackageManager.js.map +1 -1
- package/dist/utilities/Utilities.d.ts +1 -1
- package/dist/utilities/Utilities.js +9 -9
- package/dist/utilities/Utilities.js.map +1 -1
- package/docs/API.md +3 -10
- package/docs/CLI.md +88 -77
- package/docs/Contributing.md +4 -4
- package/docs/Engines.md +1 -1
- package/docs/Options.md +25 -2
- package/docs/Releases.md +8 -8
- package/docs/Tasklist.md +17 -19
- package/docs/Technical.md +2 -2
- package/package.json +3 -3
- package/src/alignment/DTWSequenceAlignmentWindowed.ts +7 -1
- package/src/alignment/SpeechAlignment.ts +1 -1
- package/src/api/APIOptions.ts +3 -0
- package/src/api/Alignment.ts +4 -2
- package/src/api/GlobalOptions.ts +33 -5
- package/src/cli/CLI.ts +257 -205
- package/src/cli/CLIConfigFile.ts +7 -7
- package/src/cli/CLIOptions.ts +8 -0
- package/src/cli/CLIParser.ts +20 -17
- package/src/recognition/WhisperSTT.ts +38 -17
- package/src/utilities/FileDownloader.ts +5 -1
- package/src/utilities/Logger.ts +22 -8
- package/src/utilities/PackageManager.ts +4 -3
- 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
|
-
|
|
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
|
|
package/src/api/APIOptions.ts
CHANGED
|
@@ -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
|
}
|
package/src/api/Alignment.ts
CHANGED
|
@@ -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
|
|
package/src/api/GlobalOptions.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function getGlobalOption<K extends keyof GlobalOptions>(key: K): GlobalOptions[K] {
|
|
2
|
-
if (!
|
|
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 (!
|
|
10
|
+
if (!listGlobalOptions().includes(key)) {
|
|
11
11
|
throw new Error(`Unknown global option key '${key}'`)
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
globalOptions[key] = value
|
|
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
|
}
|