节点JS的 Aristech TTS 客户端
这是Aristech TTS-Server的NodeJS客户端执行.
安装
npm install @aristech-org/tts-client
使用量
import { TtsClient } from '@aristech-org/tts-client'
import fs from 'fs'
const client = new TtsClient({ host: 'tts.example.com' })
const buffer = await client.synthesize({
text: 'Hello, world!',
options: { voiceId: 'anne_en_GB' },
})
fs.writeFileSync('path/to/output/file.wav', buffer)
报告有好几个例子 examples 目录 :
- file.ts 存档:与上例大致相同.
- 流出中.ts: 演示如何将音频流到播放音频的袜子进程.
- 声音.ts: 演示如何从服务器获取可用的声音.
- 电话集.ts:演示如何获得一个声音的电话集.
- 转写.ts: 演示如何获得一个声音如何发出一个给定的单词.
您可以直接使用 tsx 像这样:
- 创建一个
.env文档中 节点 目录 :
HOST=tts.example.com
# The credentials are optional but probably required for most servers:
TOKEN=your-token
SECRET=your-secret
# The following are optional:
# ROOT_CERT=your-root-cert.pem # If the server uses a self-signed certificate
# SSL=true # Set to true if credentials are provided or if a ROOT_CERT is provided
# VOICE_ID=some-available-voice-id
- 运行实例,例如:
npx tsx examples/streaming.ts
构建
要重建原始文件中生成的打字符文件, 运行 :
npm run generate
要建立图书馆,运行:
npm run build