@oxiaom/adoremix 1.0.13 → 1.0.15
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/package.json +1 -1
- package/src/cli.js +1 -1
- package/src/tts-cli.js +5 -5
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -71,7 +71,7 @@ function buildProgram() {
|
|
|
71
71
|
.command('test [text]')
|
|
72
72
|
.description('用当前 provider 测试 TTS(生成 _cli_test.mp3)')
|
|
73
73
|
.option('--workdir <path>')
|
|
74
|
-
.option('-v, --voice <name>',
|
|
74
|
+
.option('-v, --voice <name>', 'voice 短名(默认 xiaoxiao)')
|
|
75
75
|
.option('--volume <n>', '音量 0-100', '50')
|
|
76
76
|
.option('--speed <n>', '语速 0-100', '50')
|
|
77
77
|
.action(async (text, opts) => {
|
package/src/tts-cli.js
CHANGED
|
@@ -192,12 +192,10 @@ async function cmdTest(workdir, text, opts) {
|
|
|
192
192
|
return 1;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
// 准备文本 +
|
|
195
|
+
// 准备文本 + 输出(都用相对路径,dispatcher 在 cwd=workdir 下跑)
|
|
196
196
|
const ttyDir = path.join(workdir, 'tty');
|
|
197
197
|
if (!fs.existsSync(ttyDir)) fs.mkdirSync(ttyDir, { recursive: true });
|
|
198
|
-
|
|
199
|
-
const outFile = path.join(ttyDir, '_cli_test.mp3');
|
|
200
|
-
fs.writeFileSync(txtFile, text);
|
|
198
|
+
fs.writeFileSync(path.join(ttyDir, '_cli_test.txt'), text);
|
|
201
199
|
|
|
202
200
|
// 调用 dispatcher
|
|
203
201
|
const ttsJs = path.join(workdir, 'tts.js');
|
|
@@ -207,10 +205,12 @@ async function cmdTest(workdir, text, opts) {
|
|
|
207
205
|
}
|
|
208
206
|
logger.info(`provider=${c.provider} voice=${voice} text="${text.slice(0, 40)}${text.length > 40 ? '...' : ''}"`);
|
|
209
207
|
try {
|
|
210
|
-
|
|
208
|
+
// dispatcher 接收:mp3 名(写到 ./tty/)+ txt 路径(cwd 相对)
|
|
209
|
+
execSync(`node "${ttsJs}" ${volume} ${speed} ${voice} _cli_test.mp3 tty/_cli_test.txt`, {
|
|
211
210
|
cwd: workdir,
|
|
212
211
|
stdio: 'inherit'
|
|
213
212
|
});
|
|
213
|
+
const outFile = path.join(ttyDir, '_cli_test.mp3');
|
|
214
214
|
if (fs.existsSync(outFile)) {
|
|
215
215
|
const size = fs.statSync(outFile).size;
|
|
216
216
|
logger.ok(`✓ 生成成功: ${outFile} (${(size / 1024).toFixed(1)} KB)`);
|