feat: add ttsc CLI tool for TTS streaming
This commit is contained in:
parent
4112295144
commit
6b75836647
2 changed files with 10 additions and 4 deletions
7
tts.ts
7
tts.ts
|
|
@ -1,12 +1,15 @@
|
|||
import os from "node:os";
|
||||
import chalk from "chalk";
|
||||
|
||||
const text = await Bun.stdin.text();
|
||||
|
||||
if (!text) process.exit(1);
|
||||
|
||||
const home = os.homedir();
|
||||
|
||||
const koko = Bun.spawn({
|
||||
cmd: ["uv", "run", "--", "python", "-u", "main.py"],
|
||||
cwd: "./tts/",
|
||||
cwd: `${home}/.ttsc/`,
|
||||
stdin: Buffer.from(text),
|
||||
stdout: "pipe",
|
||||
stderr: "inherit",
|
||||
|
|
@ -29,7 +32,7 @@ for await (const line of koko.stdout) {
|
|||
|
||||
await Bun.spawn({
|
||||
cmd: ["mpv", `${info.file}.wav`],
|
||||
cwd: "./tts/",
|
||||
cwd: `${home}/.ttsc/`,
|
||||
stdin: "ignore",
|
||||
stdout: "inherit",
|
||||
stderr: "inherit",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue