mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-29 05:09:46 +01:00
双向流tts 在TTS server中 先npm install,然后在evn里 配置豆包或者阿里KEY,然后启动服务器,配置TTS为双向流
This commit is contained in:
parent
6897b813a6
commit
3a73152e8a
17 changed files with 2169 additions and 8 deletions
|
|
@ -595,3 +595,6 @@ TTS:
|
||||||
# Authorization: Bearer xxxx
|
# Authorization: Bearer xxxx
|
||||||
format: wav # 接口返回的音频格式
|
format: wav # 接口返回的音频格式
|
||||||
output_dir: tmp/
|
output_dir: tmp/
|
||||||
|
DidirectionalFlowTTS:
|
||||||
|
voice: longjielidou
|
||||||
|
url: ws://127.0.0.1:8083
|
||||||
|
|
@ -10,6 +10,7 @@ import traceback
|
||||||
import threading
|
import threading
|
||||||
import websockets
|
import websockets
|
||||||
from typing import Dict, Any
|
from typing import Dict, Any
|
||||||
|
from core.websocket_client import WebSocketClient
|
||||||
from plugins_func.loadplugins import auto_import_modules
|
from plugins_func.loadplugins import auto_import_modules
|
||||||
from config.logger import setup_logging
|
from config.logger import setup_logging
|
||||||
from core.utils.dialogue import Message, Dialogue
|
from core.utils.dialogue import Message, Dialogue
|
||||||
|
|
@ -86,6 +87,11 @@ class ConnectionHandler:
|
||||||
self.client_no_voice_last_time = 0.0
|
self.client_no_voice_last_time = 0.0
|
||||||
self.client_voice_stop = False
|
self.client_voice_stop = False
|
||||||
|
|
||||||
|
# tts双向流
|
||||||
|
if self.config["selected_module"]["TTS"]=="DidirectionalFlowTTS":
|
||||||
|
self.ttsClient = WebSocketClient(self.config["TTS"]["DidirectionalFlowTTS"]["url"],self)
|
||||||
|
self.ttsClient.connect()
|
||||||
|
|
||||||
# asr相关变量
|
# asr相关变量
|
||||||
self.asr_audio = []
|
self.asr_audio = []
|
||||||
self.asr_server_receive = True
|
self.asr_server_receive = True
|
||||||
|
|
@ -667,6 +673,156 @@ class ConnectionHandler:
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def chat_with_tts_function_calling(self, query, tool_call=False):
|
||||||
|
self.logger.bind(tag=TAG).debug(f"Chat with function calling start: {query}")
|
||||||
|
"""Chat with function calling for intent detection using streaming"""
|
||||||
|
|
||||||
|
if not tool_call:
|
||||||
|
self.dialogue.put(Message(role="user", content=query))
|
||||||
|
self.ttsClient.send(json.dumps( { "type":"start" }))
|
||||||
|
self.logger.bind(tag=TAG).info(f"双向流开始")
|
||||||
|
|
||||||
|
# Define intent functions
|
||||||
|
functions = None
|
||||||
|
if hasattr(self, "func_handler"):
|
||||||
|
functions = self.func_handler.get_functions()
|
||||||
|
response_message = []
|
||||||
|
processed_chars = 0 # 跟踪已处理的字符位置
|
||||||
|
|
||||||
|
try:
|
||||||
|
start_time = time.time()
|
||||||
|
|
||||||
|
# 使用带记忆的对话
|
||||||
|
future = asyncio.run_coroutine_threadsafe(
|
||||||
|
self.memory.query_memory(query), self.loop
|
||||||
|
)
|
||||||
|
memory_str = future.result()
|
||||||
|
|
||||||
|
# self.logger.bind(tag=TAG).info(f"对话记录: {self.dialogue.get_llm_dialogue_with_memory(memory_str)}")
|
||||||
|
|
||||||
|
# 使用支持functions的streaming接口
|
||||||
|
llm_responses = self.llm.response_with_functions(
|
||||||
|
self.session_id,
|
||||||
|
self.dialogue.get_llm_dialogue_with_memory(memory_str),
|
||||||
|
functions=functions,
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
self.logger.bind(tag=TAG).error(f"LLM 处理出错 {query}: {e}")
|
||||||
|
return None
|
||||||
|
|
||||||
|
self.llm_finish_task = False
|
||||||
|
text_index = 0
|
||||||
|
|
||||||
|
# 处理流式响应
|
||||||
|
tool_call_flag = False
|
||||||
|
function_name = None
|
||||||
|
function_id = None
|
||||||
|
function_arguments = ""
|
||||||
|
content_arguments = ""
|
||||||
|
|
||||||
|
for response in llm_responses:
|
||||||
|
content, tools_call = response
|
||||||
|
|
||||||
|
if "content" in response:
|
||||||
|
content = response["content"]
|
||||||
|
tools_call = None
|
||||||
|
if content is not None and len(content) > 0:
|
||||||
|
content_arguments += content
|
||||||
|
|
||||||
|
if not tool_call_flag and content_arguments.startswith("<tool_call>"):
|
||||||
|
# print("content_arguments", content_arguments)
|
||||||
|
tool_call_flag = True
|
||||||
|
|
||||||
|
if tools_call is not None:
|
||||||
|
tool_call_flag = True
|
||||||
|
if tools_call[0].id is not None:
|
||||||
|
function_id = tools_call[0].id
|
||||||
|
if tools_call[0].function.name is not None:
|
||||||
|
function_name = tools_call[0].function.name
|
||||||
|
if tools_call[0].function.arguments is not None:
|
||||||
|
function_arguments += tools_call[0].function.arguments
|
||||||
|
|
||||||
|
if content is not None and len(content) > 0:
|
||||||
|
if not tool_call_flag:
|
||||||
|
response_message.append(content)
|
||||||
|
|
||||||
|
if self.client_abort:
|
||||||
|
break
|
||||||
|
|
||||||
|
end_time = time.time()
|
||||||
|
# self.logger.bind(tag=TAG).debug(f"大模型返回时间: {end_time - start_time} 秒, 生成token={content}")
|
||||||
|
|
||||||
|
# 提取最后一个片段
|
||||||
|
last_chunk = response_message[-1]
|
||||||
|
|
||||||
|
json_data = {
|
||||||
|
"type": "text",
|
||||||
|
"text": last_chunk
|
||||||
|
}
|
||||||
|
self.logger.bind(tag=TAG).info(f"tts流文字: {last_chunk}")
|
||||||
|
self.ttsClient.send(json.dumps(json_data))
|
||||||
|
|
||||||
|
|
||||||
|
# 处理function call
|
||||||
|
if tool_call_flag:
|
||||||
|
bHasError = False
|
||||||
|
if function_id is None:
|
||||||
|
a = extract_json_from_string(content_arguments)
|
||||||
|
if a is not None:
|
||||||
|
try:
|
||||||
|
content_arguments_json = json.loads(a)
|
||||||
|
function_name = content_arguments_json["name"]
|
||||||
|
function_arguments = json.dumps(
|
||||||
|
content_arguments_json["arguments"], ensure_ascii=False
|
||||||
|
)
|
||||||
|
function_id = str(uuid.uuid4().hex)
|
||||||
|
except Exception as e:
|
||||||
|
bHasError = True
|
||||||
|
response_message.append(a)
|
||||||
|
else:
|
||||||
|
bHasError = True
|
||||||
|
response_message.append(content_arguments)
|
||||||
|
if bHasError:
|
||||||
|
self.logger.bind(tag=TAG).error(
|
||||||
|
f"function call error: {content_arguments}"
|
||||||
|
)
|
||||||
|
if not bHasError:
|
||||||
|
response_message.clear()
|
||||||
|
self.logger.bind(tag=TAG).debug(
|
||||||
|
f"function_name={function_name}, function_id={function_id}, function_arguments={function_arguments}"
|
||||||
|
)
|
||||||
|
function_call_data = {
|
||||||
|
"name": function_name,
|
||||||
|
"id": function_id,
|
||||||
|
"arguments": function_arguments,
|
||||||
|
}
|
||||||
|
|
||||||
|
# 处理MCP工具调用
|
||||||
|
if self.mcp_manager.is_mcp_tool(function_name):
|
||||||
|
result = self._handle_mcp_tool_call(function_call_data)
|
||||||
|
else:
|
||||||
|
# 处理系统函数
|
||||||
|
result = self.func_handler.handle_llm_function_call(
|
||||||
|
self, function_call_data
|
||||||
|
)
|
||||||
|
self._handle_function_result(result, function_call_data, text_index + 1)
|
||||||
|
|
||||||
|
|
||||||
|
# 存储对话内容
|
||||||
|
if len(response_message) > 0:
|
||||||
|
self.dialogue.put(
|
||||||
|
Message(role="assistant", content="".join(response_message))
|
||||||
|
)
|
||||||
|
|
||||||
|
self.ttsClient.send(json.dumps( { "type": 'finish' }))
|
||||||
|
self.logger.bind(tag=TAG).info("TTS流结束")
|
||||||
|
self.llm_finish_task = True
|
||||||
|
self.logger.bind(tag=TAG).debug(
|
||||||
|
json.dumps(self.dialogue.get_llm_dialogue(), indent=4, ensure_ascii=False)
|
||||||
|
)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def _handle_mcp_tool_call(self, function_call_data):
|
def _handle_mcp_tool_call(self, function_call_data):
|
||||||
function_arguments = function_call_data["arguments"]
|
function_arguments = function_call_data["arguments"]
|
||||||
function_name = function_call_data["name"]
|
function_name = function_call_data["name"]
|
||||||
|
|
@ -742,7 +898,10 @@ class ConnectionHandler:
|
||||||
self.dialogue.put(
|
self.dialogue.put(
|
||||||
Message(role="tool", tool_call_id=function_id, content=text)
|
Message(role="tool", tool_call_id=function_id, content=text)
|
||||||
)
|
)
|
||||||
self.chat_with_function_calling(text, tool_call=True)
|
if self.config["selected_module"]["TTS"]=="DidirectionalFlowTTS":
|
||||||
|
self.chat_with_tts_function_calling(text, tool_call=True)
|
||||||
|
else:
|
||||||
|
self.chat_with_function_calling(text, tool_call=True)
|
||||||
elif result.action == Action.NOTFOUND or result.action == Action.ERROR:
|
elif result.action == Action.NOTFOUND or result.action == Action.ERROR:
|
||||||
text = result.result
|
text = result.result
|
||||||
self.recode_first_last_text(text, text_index)
|
self.recode_first_last_text(text, text_index)
|
||||||
|
|
@ -886,6 +1045,8 @@ class ConnectionHandler:
|
||||||
|
|
||||||
# 清空任务队列
|
# 清空任务队列
|
||||||
self._clear_queues()
|
self._clear_queues()
|
||||||
|
if self.config["selected_module"]["TTS"]=="DidirectionalFlowTTS":
|
||||||
|
self.ttsClient.close()
|
||||||
|
|
||||||
if ws:
|
if ws:
|
||||||
await ws.close()
|
await ws.close()
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,10 @@ async def handleAbortMessage(conn):
|
||||||
logger.bind(tag=TAG).info("Abort message received")
|
logger.bind(tag=TAG).info("Abort message received")
|
||||||
# 设置成打断状态,会自动打断llm、tts任务
|
# 设置成打断状态,会自动打断llm、tts任务
|
||||||
conn.client_abort = True
|
conn.client_abort = True
|
||||||
|
|
||||||
|
if conn.config["selected_module"]["TTS"]=="DidirectionalFlowTTS":
|
||||||
|
conn.ttsClient.send( json.dumps( { "type": 'abort' } ))
|
||||||
|
|
||||||
# 打断客户端说话状态
|
# 打断客户端说话状态
|
||||||
await conn.websocket.send(json.dumps({"type": "tts", "state": "stop", "session_id": conn.session_id}))
|
await conn.websocket.send(json.dumps({"type": "tts", "state": "stop", "session_id": conn.session_id}))
|
||||||
conn.clearSpeakStatus()
|
conn.clearSpeakStatus()
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,8 @@ async def wakeupWordsResponse(conn):
|
||||||
|
|
||||||
"""唤醒词响应"""
|
"""唤醒词响应"""
|
||||||
wakeup_word = random.choice(WAKEUP_CONFIG["words"])
|
wakeup_word = random.choice(WAKEUP_CONFIG["words"])
|
||||||
|
if conn.config["selected_module"]["TTS"]=="DidirectionalFlowTTS":
|
||||||
|
return
|
||||||
result = conn.llm.response_no_stream(conn.config["prompt"], wakeup_word)
|
result = conn.llm.response_no_stream(conn.config["prompt"], wakeup_word)
|
||||||
if result is None or result == "":
|
if result is None or result == "":
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,9 @@ async def startToChat(conn, text):
|
||||||
|
|
||||||
# 意图未被处理,继续常规聊天流程
|
# 意图未被处理,继续常规聊天流程
|
||||||
await send_stt_message(conn, text)
|
await send_stt_message(conn, text)
|
||||||
|
if conn.config["selected_module"]["TTS"]=="DidirectionalFlowTTS":
|
||||||
|
conn.executor.submit(conn.chat_with_tts_function_calling, text)
|
||||||
|
return
|
||||||
if conn.use_function_call_mode:
|
if conn.use_function_call_mode:
|
||||||
# 使用支持function calling的聊天方法
|
# 使用支持function calling的聊天方法
|
||||||
conn.executor.submit(conn.chat_with_function_calling, text)
|
conn.executor.submit(conn.chat_with_function_calling, text)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
import os
|
||||||
|
import uuid
|
||||||
|
import requests
|
||||||
|
from config.logger import setup_logging
|
||||||
|
from datetime import datetime
|
||||||
|
from core.providers.tts.base import TTSProviderBase
|
||||||
|
|
||||||
|
TAG = __name__
|
||||||
|
logger = setup_logging()
|
||||||
|
|
||||||
|
class TTSProvider(TTSProviderBase):
|
||||||
|
def __init__(self, config, delete_audio_file):
|
||||||
|
super().__init__(config, delete_audio_file)
|
||||||
|
self.format = config.get("format", "wav")
|
||||||
|
self.output_file = config.get("output_dir", "tmp/")
|
||||||
|
|
||||||
|
def generate_filename(self):
|
||||||
|
return os.path.join(self.output_file, f"tts-{datetime.now().date()}@{uuid.uuid4().hex}.{self.format}")
|
||||||
|
|
||||||
|
async def text_to_speak(self, text, output_file):
|
||||||
|
pass
|
||||||
94
main/xiaozhi-server/core/websocket_client.py
Normal file
94
main/xiaozhi-server/core/websocket_client.py
Normal file
|
|
@ -0,0 +1,94 @@
|
||||||
|
import websocket
|
||||||
|
import websockets
|
||||||
|
import asyncio
|
||||||
|
import threading
|
||||||
|
import time
|
||||||
|
import json
|
||||||
|
class WebSocketClient:
|
||||||
|
def __init__(self, url, conn=None):
|
||||||
|
"""
|
||||||
|
初始化 WebSocket 客户端
|
||||||
|
:param url: WebSocket 服务器地址 (例如 ws://example.com/websocket)
|
||||||
|
:param conn: 可选的连接对象
|
||||||
|
"""
|
||||||
|
self.url = url
|
||||||
|
self.ws = None
|
||||||
|
self.conn = conn
|
||||||
|
|
||||||
|
def on_message(self,ws, message):
|
||||||
|
"""当收到消息时调用"""
|
||||||
|
if self.conn.websocket:
|
||||||
|
try:
|
||||||
|
if isinstance(message, str):
|
||||||
|
print(message)
|
||||||
|
self.conn.clearSpeakStatus()
|
||||||
|
asyncio.run_coroutine_threadsafe(self.conn.websocket.send(message), self.conn.loop)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Failed to send message: {e}")
|
||||||
|
|
||||||
|
def on_error(self, ws, error):
|
||||||
|
"""当发生错误时调用"""
|
||||||
|
print(f"Error: {error}")
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
|
def on_close(self, ws, close_status_code, close_msg):
|
||||||
|
"""当连接关闭时调用"""
|
||||||
|
print("### Connection closed ###")
|
||||||
|
|
||||||
|
def on_open(self, ws):
|
||||||
|
"""当连接成功打开时调用"""
|
||||||
|
def run():
|
||||||
|
# 发送 JSON 消息
|
||||||
|
self.send(json.dumps({"type":'config',"voice":self.conn.config["TTS"]["DidirectionalFlowTTS"]["voice"]}))
|
||||||
|
threading.Thread(target=run).start()
|
||||||
|
|
||||||
|
|
||||||
|
def send(self, message):
|
||||||
|
"""发送消息到 WebSocket 服务器"""
|
||||||
|
if self.ws and self.ws.sock and self.ws.sock.connected:
|
||||||
|
self.ws.send(message)
|
||||||
|
else:
|
||||||
|
print("WebSocket is not connected.")
|
||||||
|
|
||||||
|
def connect(self):
|
||||||
|
"""连接到 WebSocket 服务器"""
|
||||||
|
print(f"Connecting to WebSocket server at {self.url}...")
|
||||||
|
self.ws = websocket.WebSocketApp(
|
||||||
|
self.url,
|
||||||
|
on_message=self.on_message,
|
||||||
|
on_error=self.on_error,
|
||||||
|
on_close=self.on_close
|
||||||
|
)
|
||||||
|
self.ws.on_open = self.on_open
|
||||||
|
|
||||||
|
# 启动 WebSocket 客户端
|
||||||
|
threading.Thread(target=self.ws.run_forever, daemon=True).start()
|
||||||
|
print("WebSocket client started.")
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
"""关闭 WebSocket 连接"""
|
||||||
|
if self.ws:
|
||||||
|
self.ws.close()
|
||||||
|
print("WebSocket connection closed.")
|
||||||
|
|
||||||
|
# 示例用法
|
||||||
|
if __name__ == "__main__":
|
||||||
|
# 创建 WebSocket 客户端实例
|
||||||
|
client = WebSocketClient("ws://127.0.0.1:8083")
|
||||||
|
|
||||||
|
# 连接到 WebSocket 服务器
|
||||||
|
client.connect()
|
||||||
|
time.sleep(1)
|
||||||
|
client.send(json.dumps({ "type": "start" }))
|
||||||
|
time.sleep(1)
|
||||||
|
client.send(json.dumps({ "type": "text" , "text":'你好呀.'}))
|
||||||
|
time.sleep(1)
|
||||||
|
client.send(json.dumps({ "type": "finish"}))
|
||||||
|
# 模拟运行一段时间后关闭连接
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
time.sleep(1) # 主线程保持运行
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("Closing WebSocket connection...")
|
||||||
|
client.close()
|
||||||
|
|
@ -10,7 +10,7 @@ from pathlib import Path
|
||||||
from core.utils import p3
|
from core.utils import p3
|
||||||
from core.handle.sendAudioHandle import send_stt_message
|
from core.handle.sendAudioHandle import send_stt_message
|
||||||
from plugins_func.register import register_function, ToolType, ActionResponse, Action
|
from plugins_func.register import register_function, ToolType, ActionResponse, Action
|
||||||
|
import json
|
||||||
|
|
||||||
TAG = __name__
|
TAG = __name__
|
||||||
logger = setup_logging()
|
logger = setup_logging()
|
||||||
|
|
@ -217,12 +217,16 @@ async def play_local_music(conn, specific_file=None):
|
||||||
conn.tts_first_text_index = 0
|
conn.tts_first_text_index = 0
|
||||||
conn.tts_last_text_index = 0
|
conn.tts_last_text_index = 0
|
||||||
|
|
||||||
tts_file = await asyncio.to_thread(conn.tts.to_tts, text)
|
if conn.config["selected_module"]["TTS"]!="DidirectionalFlowTTS":
|
||||||
if tts_file is not None and os.path.exists(tts_file):
|
tts_file = await asyncio.to_thread(conn.tts.to_tts, text)
|
||||||
conn.tts_last_text_index = 1
|
if tts_file is not None and os.path.exists(tts_file):
|
||||||
opus_packets, _ = conn.tts.audio_to_opus_data(tts_file)
|
conn.tts_last_text_index = 1
|
||||||
conn.audio_play_queue.put((opus_packets, None, 0))
|
opus_packets, _ = conn.tts.audio_to_opus_data(tts_file)
|
||||||
os.remove(tts_file)
|
conn.audio_play_queue.put((opus_packets, None, 0))
|
||||||
|
os.remove(tts_file)
|
||||||
|
# else:
|
||||||
|
# conn.ttsClient.send(json.dumps({ "type": 'text',"text": text }))
|
||||||
|
# conn.ttsClient.send(json.dumps( { "type": 'finish' }))
|
||||||
|
|
||||||
conn.llm_finish_task = True
|
conn.llm_finish_task = True
|
||||||
|
|
||||||
|
|
|
||||||
3
main/xiaozhi-server/tts-server/.env
Normal file
3
main/xiaozhi-server/tts-server/.env
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
DASHSCOPE_TTS_APP_KEY=""
|
||||||
|
BYTEDANCE_TTS_APP_ID=""
|
||||||
|
BYTEDANCE_TTS_APP_KEY=""
|
||||||
275
main/xiaozhi-server/tts-server/app.js
Normal file
275
main/xiaozhi-server/tts-server/app.js
Normal file
|
|
@ -0,0 +1,275 @@
|
||||||
|
const WebSocket = require('ws');
|
||||||
|
const config = require('./config');
|
||||||
|
const { OpusEncoder } = require('@discordjs/opus');
|
||||||
|
const { ttsList } = require('./tts-list');
|
||||||
|
const { BytedanceTtsClient } = require('./bytedance_tts');
|
||||||
|
const { DashscopeTtsClient } = require('./dashscope_tts');
|
||||||
|
|
||||||
|
const ttsClients = {
|
||||||
|
volcengine: BytedanceTtsClient,
|
||||||
|
dashscope: DashscopeTtsClient,
|
||||||
|
};
|
||||||
|
|
||||||
|
const DEFAULT_SAMPLE_RATE = 24000;
|
||||||
|
const DEFAULT_FRAME_DURATION = 60;
|
||||||
|
|
||||||
|
class RateControlSender {
|
||||||
|
constructor(ws) {
|
||||||
|
this.ws = ws;
|
||||||
|
this.sampleRate = DEFAULT_SAMPLE_RATE;
|
||||||
|
this.frameDuration = DEFAULT_FRAME_DURATION;
|
||||||
|
this.queue = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
setSampleRate(sampleRate) {
|
||||||
|
this.sampleRate = sampleRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
setFrameDuration(frameDuration) {
|
||||||
|
this.frameDuration = frameDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
reset() {
|
||||||
|
if (this.rateControlTimeout) {
|
||||||
|
clearTimeout(this.rateControlTimeout);
|
||||||
|
this.rateControlTimeout = null;
|
||||||
|
}
|
||||||
|
if (this.queue.length > 0) {
|
||||||
|
this.queue = [];
|
||||||
|
this.sendStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.encoder = new OpusEncoder(this.sampleRate, 1);
|
||||||
|
this.encoder.applyEncoderCTL(4000, 2048); // VOIP
|
||||||
|
this.encodeFrameSize = this.sampleRate / 1000 * this.frameDuration;
|
||||||
|
this.audioBuffer = Buffer.alloc(0);
|
||||||
|
this.audioPosition = 0;
|
||||||
|
this.startTimestamp = Date.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
encodeAudio() {
|
||||||
|
const pieceLength = this.encodeFrameSize * 2;
|
||||||
|
while (this.audioBuffer.length - this.audioPosition >= pieceLength) {
|
||||||
|
const frame = this.audioBuffer.subarray(this.audioPosition, this.audioPosition + pieceLength);
|
||||||
|
this.audioPosition += pieceLength;
|
||||||
|
const opus = this.encoder.encode(frame);
|
||||||
|
this.ws.send(opus, { binary: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkQueue() {
|
||||||
|
if (this.ws.readyState !== WebSocket.OPEN) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
while (this.queue.length > 0) {
|
||||||
|
// check if the first item is JSON object or Buffer
|
||||||
|
if (this.queue[0] instanceof Buffer) {
|
||||||
|
// check if it's time to send audio
|
||||||
|
if (this.rateControlTimeout) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const elapsedMs = Date.now() - this.startTimestamp;
|
||||||
|
const outputMs = this.audioPosition / 2 * 1000 / this.sampleRate;
|
||||||
|
if (elapsedMs < outputMs) {
|
||||||
|
if (false) {
|
||||||
|
console.log('[TTS] rate control, waiting', outputMs - elapsedMs, 'ms');
|
||||||
|
}
|
||||||
|
this.rateControlTimeout = setTimeout(() => {
|
||||||
|
this.rateControlTimeout = null;
|
||||||
|
this.checkQueue();
|
||||||
|
}, outputMs - elapsedMs);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const pcm = this.queue.shift();
|
||||||
|
this.audioBuffer = Buffer.concat([this.audioBuffer, pcm]);
|
||||||
|
this.encodeAudio();
|
||||||
|
} else {
|
||||||
|
this.ws.send(JSON.stringify(this.queue.shift()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sendAudio(audio) {
|
||||||
|
this.queue.push(audio);
|
||||||
|
this.checkQueue();
|
||||||
|
}
|
||||||
|
|
||||||
|
sendSentenceStart(text) {
|
||||||
|
this.queue.push({ type: 'tts', state: 'sentence_start', text });
|
||||||
|
this.checkQueue();
|
||||||
|
}
|
||||||
|
|
||||||
|
sendSentenceEnd(text) {
|
||||||
|
this.queue.push({ type: 'tts', state: 'sentence_end', text });
|
||||||
|
this.checkQueue();
|
||||||
|
}
|
||||||
|
|
||||||
|
sendStart(sampleRate) {
|
||||||
|
this.queue.push({ type: 'tts', state: 'start', sample_rate: sampleRate });
|
||||||
|
this.checkQueue();
|
||||||
|
}
|
||||||
|
|
||||||
|
sendStop() {
|
||||||
|
this.queue.push({ type: 'tts', state: 'stop' });
|
||||||
|
this.checkQueue();
|
||||||
|
}
|
||||||
|
|
||||||
|
close() {
|
||||||
|
this.ws.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TtsSessionHandler {
|
||||||
|
constructor(sender) {
|
||||||
|
this.sender = sender;
|
||||||
|
this.queueEvents = [];
|
||||||
|
this.voice = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
reset(force=false) {
|
||||||
|
this.sender.reset();
|
||||||
|
if (this.session) {
|
||||||
|
if (!this.finished) {
|
||||||
|
if (this.session.cancel) {
|
||||||
|
this.session.cancel();
|
||||||
|
} else {
|
||||||
|
this.session.finish(force);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.session = null;
|
||||||
|
}
|
||||||
|
this.ttsErrorCount = 0;
|
||||||
|
this.finished = false;
|
||||||
|
this.replyText = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
async setupTtsSession() {
|
||||||
|
const session = this.client.newSession(this.voice, this.sender.sampleRate);
|
||||||
|
session.on('sentence_start', (text) => {
|
||||||
|
console.log('[TTS]', text);
|
||||||
|
this.sender.sendSentenceStart(text);
|
||||||
|
});
|
||||||
|
session.on('sentence_end', (text) => {
|
||||||
|
this.sender.sendSentenceEnd(text);
|
||||||
|
});
|
||||||
|
session.on('audio', (pcm) => {
|
||||||
|
this.sender.sendAudio(pcm);
|
||||||
|
});
|
||||||
|
session.on('finished', () => {
|
||||||
|
this.sender.sendStop();
|
||||||
|
console.log('[TTS] finished voice_id', this.voice, 'sample_rate', this.sender.sampleRate);
|
||||||
|
this.session = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this.replyText.length > 0) {
|
||||||
|
console.log('[TTS] setup with text:', this.replyText);
|
||||||
|
session.write(this.replyText);
|
||||||
|
if (this.finished) {
|
||||||
|
session.finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.session = session;
|
||||||
|
}
|
||||||
|
|
||||||
|
handleMessage(message) {
|
||||||
|
const data = JSON.parse(message);
|
||||||
|
if (data.type === 'start') {
|
||||||
|
this.reset();
|
||||||
|
this.sender.sendStart();
|
||||||
|
if (this.client && this.client.connectionReady) {
|
||||||
|
this.setupTtsSession();
|
||||||
|
} else {
|
||||||
|
this.queueEvents.push({
|
||||||
|
resolve: () => this.setupTtsSession(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (data.type === 'text') {
|
||||||
|
this.replyText += data.text;
|
||||||
|
if (this.session) {
|
||||||
|
this.session.write(data.text);
|
||||||
|
}
|
||||||
|
} else if (data.type === 'finish') {
|
||||||
|
this.finished = true;
|
||||||
|
if (this.session) {
|
||||||
|
this.session.finish();
|
||||||
|
}
|
||||||
|
} else if (data.type === 'config') {
|
||||||
|
const ttsItem = ttsList.find(item => item.voice_id === data.voice);
|
||||||
|
if (!ttsItem) {
|
||||||
|
console.error(`无效的语音: ${data.voice}`);
|
||||||
|
this.sender.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.ttsItem = ttsItem;
|
||||||
|
this.voice = data.voice;
|
||||||
|
this.sender.setSampleRate(data.sampleRate || DEFAULT_SAMPLE_RATE);
|
||||||
|
this.sender.setFrameDuration(data.frameDuration || DEFAULT_FRAME_DURATION);
|
||||||
|
this.startClient();
|
||||||
|
} else if (data.type === 'abort') {
|
||||||
|
if (this.session) {
|
||||||
|
this.reset(true);
|
||||||
|
if (this.client) {
|
||||||
|
this.client.close();
|
||||||
|
}
|
||||||
|
console.log('[TTS] aborted, starting new client');
|
||||||
|
this.startClient();
|
||||||
|
} else {
|
||||||
|
this.reset(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
startClient() {
|
||||||
|
this.client = new ttsClients[this.ttsItem.voice_source]();
|
||||||
|
this.client.on('ready', () => {
|
||||||
|
while (this.queueEvents.length > 0) {
|
||||||
|
const event = this.queueEvents.shift();
|
||||||
|
event.resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.client.on('error', (error) => {
|
||||||
|
console.error('[TTS] client error', error);
|
||||||
|
});
|
||||||
|
this.client.on('close', () => {
|
||||||
|
console.log('[TTS] client closed');
|
||||||
|
});
|
||||||
|
this.client.on('error', () => {
|
||||||
|
this.ttsErrorCount++;
|
||||||
|
if (this.ttsErrorCount > 3) {
|
||||||
|
this.sender.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 如果 TTS session 出错,重新创建 TTS 会话,并重新发送文本
|
||||||
|
if (this.client && this.client.connectionReady && this.session) {
|
||||||
|
console.log('[TTS] client error, retrying');
|
||||||
|
this.queueEvents.push({
|
||||||
|
resolve: () => this.setupTtsSession(),
|
||||||
|
});
|
||||||
|
this.startClient();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handleClose() {
|
||||||
|
this.reset();
|
||||||
|
if (this.client) {
|
||||||
|
this.client.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const wss = new WebSocket.Server({ port: config.ttsFrontendPort , host: '0.0.0.0' });
|
||||||
|
|
||||||
|
wss.on('connection', (ws) => {
|
||||||
|
const sender = new RateControlSender(ws);
|
||||||
|
const handler = new TtsSessionHandler(sender);
|
||||||
|
|
||||||
|
ws.on('message', (message) => handler.handleMessage(message));
|
||||||
|
ws.on('close', () => handler.handleClose());
|
||||||
|
});
|
||||||
|
|
||||||
|
wss.on('listening', () => {
|
||||||
|
console.log(`TTS 前端服务已启动,监听端口 ${config.ttsFrontendPort}`);
|
||||||
|
});
|
||||||
314
main/xiaozhi-server/tts-server/bytedance_tts.js
Normal file
314
main/xiaozhi-server/tts-server/bytedance_tts.js
Normal file
|
|
@ -0,0 +1,314 @@
|
||||||
|
// terrence@tenclass.com
|
||||||
|
// 2024-08-27
|
||||||
|
// 大模型语音合成双向流式 API
|
||||||
|
// (https://www.volcengine.com/docs/6561/1329505)
|
||||||
|
|
||||||
|
require('dotenv').config();
|
||||||
|
const { WebSocket } = require('ws');
|
||||||
|
const { v4: uuidv4 } = require('uuid');
|
||||||
|
const EventEmitter = require('events');
|
||||||
|
|
||||||
|
class TtsSession extends EventEmitter {
|
||||||
|
constructor(client, speaker, sampleRate = 24000) {
|
||||||
|
super();
|
||||||
|
this.client = client;
|
||||||
|
this.sessionId = uuidv4();
|
||||||
|
this.params = this.initParams(speaker, sampleRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
initParams(speaker, sampleRate) {
|
||||||
|
return {
|
||||||
|
speaker: speaker || 'zh_female_shuangkuaisisi_moon_bigtts',
|
||||||
|
audio_params: {
|
||||||
|
format: 'pcm',
|
||||||
|
sample_rate: sampleRate
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
this.sendRequest(100, { ...this.params });
|
||||||
|
}
|
||||||
|
|
||||||
|
write(text) {
|
||||||
|
this.sendRequest(200, { ...this.params, text });
|
||||||
|
}
|
||||||
|
|
||||||
|
cancel() {
|
||||||
|
this.sendRequest(101, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
finish() {
|
||||||
|
this.sendRequest(102, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
sendRequest(event, reqParams) {
|
||||||
|
const payload = {
|
||||||
|
namespace: 'BidirectionalTTS',
|
||||||
|
event,
|
||||||
|
req_params: reqParams
|
||||||
|
};
|
||||||
|
this.client.sendFullClientRequest(event, payload, this.sessionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class BytedanceTtsClient extends EventEmitter {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.sessions = new Map();
|
||||||
|
this.reqId = uuidv4();
|
||||||
|
this.initWebSocket();
|
||||||
|
console.log('reqId', this.reqId);
|
||||||
|
}
|
||||||
|
|
||||||
|
initWebSocket() {
|
||||||
|
this.socket = new WebSocket('wss://openspeech.bytedance.com/api/v3/tts/bidirection', {
|
||||||
|
headers: this.getHeaders()
|
||||||
|
});
|
||||||
|
|
||||||
|
this.socket.on('open', this.onOpen.bind(this));
|
||||||
|
this.socket.on('message', this.onMessage.bind(this));
|
||||||
|
this.socket.on('error', this.onError.bind(this));
|
||||||
|
this.socket.on('close', this.onClose.bind(this));
|
||||||
|
this.socket.on('upgrade', this.onUpgrade.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
close() {
|
||||||
|
if (this.connectionReady) {
|
||||||
|
this.finishConnection();
|
||||||
|
} else {
|
||||||
|
this.socket.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onUpgrade(req) {
|
||||||
|
console.log('TTS LogId', req.headers['x-tt-logid']);
|
||||||
|
}
|
||||||
|
|
||||||
|
getHeaders() {
|
||||||
|
return {
|
||||||
|
'X-Api-App-Key': process.env.BYTEDANCE_TTS_APP_ID,
|
||||||
|
'X-Api-Access-Key': process.env.BYTEDANCE_TTS_APP_KEY,
|
||||||
|
'X-Api-Resource-Id': 'volc.service_type.10029',
|
||||||
|
'X-Api-Request-Id': this.reqId
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
onOpen() {
|
||||||
|
this.sendFullClientRequest(1, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
onMessage(data) {
|
||||||
|
const messageType = data.readUInt8(1);
|
||||||
|
const handlers = {
|
||||||
|
0xF0: this.parseErrorResponse,
|
||||||
|
0x94: this.parseFullServerResponse,
|
||||||
|
0xB4: this.parseAudioResponse
|
||||||
|
};
|
||||||
|
|
||||||
|
const handler = handlers[messageType];
|
||||||
|
if (handler) {
|
||||||
|
handler.call(this, data);
|
||||||
|
} else {
|
||||||
|
console.error('Unknown message type:', messageType, data.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onError(err) {
|
||||||
|
this.emit('error', err);
|
||||||
|
}
|
||||||
|
|
||||||
|
onClose() {
|
||||||
|
this.sessions.forEach(session => session.emit('cancelled'));
|
||||||
|
this.sessions.clear();
|
||||||
|
this.emit('close');
|
||||||
|
}
|
||||||
|
|
||||||
|
newSession(speaker, sampleRate) {
|
||||||
|
const session = new TtsSession(this, speaker, sampleRate);
|
||||||
|
this.sessions.set(session.sessionId, session);
|
||||||
|
session.start();
|
||||||
|
return session;
|
||||||
|
}
|
||||||
|
|
||||||
|
parseErrorResponse(data) {
|
||||||
|
const errorCode = data.readUInt32BE(4);
|
||||||
|
const errorMessageLength = data.readUInt32BE(8);
|
||||||
|
const errorMessage = data.toString('utf8', 12, 12 + errorMessageLength);
|
||||||
|
console.error(`Error code: ${errorCode}, message: ${errorMessage}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
sendFullClientRequest(eventCode, payload, sessionId) {
|
||||||
|
const header = Buffer.from('11141000', 'hex');
|
||||||
|
const optional = Buffer.alloc(4);
|
||||||
|
optional.writeUInt32BE(eventCode);
|
||||||
|
const payloadBuffer = Buffer.from(JSON.stringify(payload));
|
||||||
|
const payloadLengthBuffer = Buffer.alloc(4);
|
||||||
|
payloadLengthBuffer.writeUInt32BE(payloadBuffer.length);
|
||||||
|
|
||||||
|
let fullRequest;
|
||||||
|
if (sessionId) {
|
||||||
|
const sessionIdBuffer = Buffer.alloc(4 + sessionId.length);
|
||||||
|
sessionIdBuffer.writeUInt32BE(sessionId.length);
|
||||||
|
sessionIdBuffer.write(sessionId, 4);
|
||||||
|
fullRequest = Buffer.concat([header, optional, sessionIdBuffer, payloadLengthBuffer, payloadBuffer]);
|
||||||
|
} else {
|
||||||
|
fullRequest = Buffer.concat([header, optional, payloadLengthBuffer, payloadBuffer]);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.socket.send(fullRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
parseFullServerResponse(data) {
|
||||||
|
const eventCode = data.readUInt32BE(4);
|
||||||
|
if (eventCode <= 52) {
|
||||||
|
this.handleConnectionEvents(eventCode);
|
||||||
|
} else {
|
||||||
|
this.handleSessionEvents(data, eventCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handleConnectionEvents(eventCode) {
|
||||||
|
switch (eventCode) {
|
||||||
|
case 50:
|
||||||
|
this.connectionReady = true;
|
||||||
|
this.emit('ready');
|
||||||
|
break;
|
||||||
|
case 51:
|
||||||
|
this.connectionReady = false;
|
||||||
|
this.emit('error', 'Failed to connect to TTS server.');
|
||||||
|
break;
|
||||||
|
case 52:
|
||||||
|
this.connectionReady = false;
|
||||||
|
this.sessions.clear();
|
||||||
|
this.socket.close();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSessionEvents(data, eventCode) {
|
||||||
|
let offset = 8;
|
||||||
|
const sessionIdLength = data.readUInt32BE(offset);
|
||||||
|
offset += 4;
|
||||||
|
const sessionId = data.toString('utf8', offset, offset + sessionIdLength);
|
||||||
|
offset += sessionIdLength;
|
||||||
|
const payloadLength = data.readUInt32BE(offset);
|
||||||
|
offset += 4;
|
||||||
|
const payload = JSON.parse(data.toString('utf8', offset, offset + payloadLength));
|
||||||
|
|
||||||
|
const session = this.sessions.get(sessionId);
|
||||||
|
if (!session) {
|
||||||
|
console.error('Session not found:', sessionId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const eventHandlers = {
|
||||||
|
150: () => session.emit('started'),
|
||||||
|
151: () => {
|
||||||
|
session.emit('cancelled');
|
||||||
|
this.sessions.delete(sessionId);
|
||||||
|
},
|
||||||
|
152: () => {
|
||||||
|
session.emit('finished');
|
||||||
|
this.sessions.delete(sessionId);
|
||||||
|
},
|
||||||
|
153: () => session.emit('error', payload),
|
||||||
|
350: () => session.emit('sentence_start', payload.text),
|
||||||
|
351: () => session.emit('sentence_end', payload.text)
|
||||||
|
};
|
||||||
|
|
||||||
|
const handler = eventHandlers[eventCode];
|
||||||
|
if (handler) {
|
||||||
|
handler();
|
||||||
|
} else {
|
||||||
|
console.error('Unknown event code:', eventCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
parseAudioResponse(data) {
|
||||||
|
let offset = 8;
|
||||||
|
const sessionIdLength = data.readUInt32BE(offset);
|
||||||
|
offset += 4;
|
||||||
|
const sessionId = data.toString('utf8', offset, offset + sessionIdLength);
|
||||||
|
offset += sessionIdLength;
|
||||||
|
const audioLength = data.readUInt32BE(offset);
|
||||||
|
offset += 4;
|
||||||
|
const audio = data.slice(offset, offset + audioLength);
|
||||||
|
|
||||||
|
const session = this.sessions.get(sessionId);
|
||||||
|
if (session) {
|
||||||
|
session.emit('audio', audio);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
finishConnection() {
|
||||||
|
this.sendFullClientRequest(2, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
static test() {
|
||||||
|
const client = new BytedanceTtsClient();
|
||||||
|
client.on('ready', () => {
|
||||||
|
console.log('TTS服务器就绪。');
|
||||||
|
|
||||||
|
const session = client.newSession();
|
||||||
|
session.on('started', async () => {
|
||||||
|
console.log(new Date(), 'TTS会话已开始。');
|
||||||
|
|
||||||
|
session.write('你好!');
|
||||||
|
console.log(new Date(), '已发送“你好”');
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 500));
|
||||||
|
session.write('世界。');
|
||||||
|
console.log(new Date(), '已发送“世界”');
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 500));
|
||||||
|
session.finish();
|
||||||
|
console.log(new Date(), '已发送 finish');
|
||||||
|
});
|
||||||
|
|
||||||
|
let t = Buffer.alloc(0);
|
||||||
|
session.on('audio', (audio) => {
|
||||||
|
console.log('收到', audio.length, '字节');
|
||||||
|
t = Buffer.concat([t, audio]);
|
||||||
|
});
|
||||||
|
|
||||||
|
session.on('finished', () => {
|
||||||
|
console.log(new Date(), 'TTS会话已结束。');
|
||||||
|
client.finishConnection();
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
fs.writeFileSync('tts.pcm', t);
|
||||||
|
console.log('音频数据已写入 tts.pcm,大小:', t.length);
|
||||||
|
console.log('要播放音频,请运行: ffplay -f s16le -ar 24000 -ac 1 tts.pcm');
|
||||||
|
});
|
||||||
|
|
||||||
|
session.on('sentence_start', (text) => {
|
||||||
|
console.log('句子开始', text);
|
||||||
|
});
|
||||||
|
|
||||||
|
session.on('sentence_end', (text) => {
|
||||||
|
console.log('句子结束', text);
|
||||||
|
});
|
||||||
|
|
||||||
|
session.on('error', (err) => {
|
||||||
|
console.error('TTS会话错误:', err);
|
||||||
|
});
|
||||||
|
|
||||||
|
session.on('cancelled', () => {
|
||||||
|
console.log('TTS会话已取消。');
|
||||||
|
});
|
||||||
|
|
||||||
|
session.on('finished', () => {
|
||||||
|
console.log('TTS会话已结束。');
|
||||||
|
client.finishConnection();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('error', (err) => console.error(new Date(), 'TTS客户端错误:', err));
|
||||||
|
client.on('close', () => console.log('TTS客户端已关闭'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { BytedanceTtsClient };
|
||||||
|
|
||||||
|
if (require.main === module) {
|
||||||
|
BytedanceTtsClient.test();
|
||||||
|
}
|
||||||
4
main/xiaozhi-server/tts-server/config.js
Normal file
4
main/xiaozhi-server/tts-server/config.js
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
module.exports = {
|
||||||
|
// ttsFrontendPort: 8083,
|
||||||
|
ttsFrontendPort: process.env.NODE_ENV=='dev' ? 8183 : 8083,
|
||||||
|
};
|
||||||
254
main/xiaozhi-server/tts-server/dashscope_tts.js
Normal file
254
main/xiaozhi-server/tts-server/dashscope_tts.js
Normal file
|
|
@ -0,0 +1,254 @@
|
||||||
|
// terrence@tenclass.com
|
||||||
|
// 2024-10-03
|
||||||
|
// 大模型语音合成双向流式 API (灵积 CosyVoice)
|
||||||
|
|
||||||
|
require('dotenv').config();
|
||||||
|
const { WebSocket } = require('ws');
|
||||||
|
const { v4: uuidv4 } = require('uuid');
|
||||||
|
const EventEmitter = require('events');
|
||||||
|
|
||||||
|
class TtsSession extends EventEmitter {
|
||||||
|
constructor(client, speaker, sampleRate = 22050) {
|
||||||
|
super();
|
||||||
|
this.client = client;
|
||||||
|
this.sessionId = uuidv4();
|
||||||
|
this.model = 'cosyvoice-v1';
|
||||||
|
this.params = this.initParams(speaker, sampleRate);
|
||||||
|
this.texts = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
initParams(speaker, sampleRate) {
|
||||||
|
return {
|
||||||
|
parameters: {
|
||||||
|
voice: speaker || 'longjielidou',
|
||||||
|
volume: 90,
|
||||||
|
text_type: 'PlainText',
|
||||||
|
format: 'pcm',
|
||||||
|
rate: 1.1,
|
||||||
|
pitch: 1.0,
|
||||||
|
sample_rate: sampleRate
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
this.sendRequest("run-task", {
|
||||||
|
model: this.model,
|
||||||
|
task_group: 'audio',
|
||||||
|
task: 'tts',
|
||||||
|
function: 'SpeechSynthesizer',
|
||||||
|
input: {
|
||||||
|
text: ''
|
||||||
|
},
|
||||||
|
...this.params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
write(text) {
|
||||||
|
this.texts.push(text);
|
||||||
|
this.sendRequest("continue-task", {
|
||||||
|
model: this.model,
|
||||||
|
task_group: 'audio',
|
||||||
|
task: 'tts',
|
||||||
|
function: 'SpeechSynthesizer',
|
||||||
|
input: { text } });
|
||||||
|
}
|
||||||
|
|
||||||
|
finish() {
|
||||||
|
this.emit('sentence_start', this.texts.join(''));
|
||||||
|
this.sendRequest("finish-task", {
|
||||||
|
input: { text: '' }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
sendRequest(action, payload) {
|
||||||
|
const data = {
|
||||||
|
header: {
|
||||||
|
action,
|
||||||
|
task_id: this.sessionId,
|
||||||
|
streaming: 'duplex'
|
||||||
|
},
|
||||||
|
payload
|
||||||
|
};
|
||||||
|
this.client.sendRequest(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DashscopeTtsClient extends EventEmitter {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.reqId = uuidv4();
|
||||||
|
this.sessions = new Map();
|
||||||
|
this.initWebSocket();
|
||||||
|
this.cachedAudioPackets = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
initWebSocket() {
|
||||||
|
this.socket = new WebSocket('wss://dashscope.aliyuncs.com/api-ws/v1/inference', {
|
||||||
|
headers: this.getHeaders()
|
||||||
|
});
|
||||||
|
|
||||||
|
this.socket.on('open', this.onOpen.bind(this));
|
||||||
|
this.socket.on('message', this.onMessage.bind(this));
|
||||||
|
this.socket.on('error', this.onError.bind(this));
|
||||||
|
this.socket.on('close', this.onClose.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
close() {
|
||||||
|
this.socket.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
getHeaders() {
|
||||||
|
return {
|
||||||
|
'user-agent': 'xiaozhi/1.0; nodejs/18.16.0; platform/Linux',
|
||||||
|
'Authorization': process.env.DASHSCOPE_TTS_APP_KEY
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
onOpen() {
|
||||||
|
this.connectionReady = true;
|
||||||
|
this.emit('ready');
|
||||||
|
this.pingInterval = setInterval(() => {
|
||||||
|
this.socket.ping();
|
||||||
|
}, 10000);
|
||||||
|
}
|
||||||
|
|
||||||
|
onMessage(data, isBinary) {
|
||||||
|
if (isBinary) {
|
||||||
|
this.parseAudioResponse(data);
|
||||||
|
} else {
|
||||||
|
this.parseJsonResponse(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onError(err) {
|
||||||
|
this.emit('error', err);
|
||||||
|
}
|
||||||
|
|
||||||
|
onClose() {
|
||||||
|
if (this.pingInterval) {
|
||||||
|
clearInterval(this.pingInterval);
|
||||||
|
this.pingInterval = null;
|
||||||
|
}
|
||||||
|
this.connectionReady = false;
|
||||||
|
this.sessions.forEach(session => session.emit('cancelled'));
|
||||||
|
this.sessions.clear();
|
||||||
|
this.emit('close');
|
||||||
|
}
|
||||||
|
|
||||||
|
newSession(speaker, sampleRate) {
|
||||||
|
const session = new TtsSession(this, speaker, 24000);
|
||||||
|
this.sessions.set(session.sessionId, session);
|
||||||
|
session.start();
|
||||||
|
return session;
|
||||||
|
}
|
||||||
|
|
||||||
|
sendRequest(data) {
|
||||||
|
this.socket.send(JSON.stringify(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
parseAudioResponse(data) {
|
||||||
|
this.cachedAudioPackets.push(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
parseJsonResponse(data) {
|
||||||
|
const { header } = JSON.parse(data);
|
||||||
|
const { task_id, event } = header;
|
||||||
|
const session = this.sessions.get(task_id);
|
||||||
|
if (!session) {
|
||||||
|
console.error('Session not found:', task_id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const duration = 240;
|
||||||
|
const frameSize = session.params.parameters.sample_rate / 1000 * duration;
|
||||||
|
|
||||||
|
if (event === 'result-generated') {
|
||||||
|
if (!session.first) {
|
||||||
|
if (this.cachedAudioPackets.length >= 1) {
|
||||||
|
session.first = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
while (this.cachedAudioPackets.length > 0) {
|
||||||
|
session.emit('audio', this.cachedAudioPackets.shift());
|
||||||
|
}
|
||||||
|
} else if (event === 'task-started') {
|
||||||
|
session.emit('started');
|
||||||
|
} else if (event === 'task-finished') {
|
||||||
|
// add 240ms blank audio to the end of the stream
|
||||||
|
const blankAudio = Buffer.alloc(frameSize * 2, 0);
|
||||||
|
session.emit('audio', blankAudio);
|
||||||
|
session.emit('finished');
|
||||||
|
this.sessions.delete(task_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
finishConnection() {
|
||||||
|
this.socket.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
static test() {
|
||||||
|
const client = new TtsClient();
|
||||||
|
client.on('ready', () => {
|
||||||
|
console.log('TTS服务器就绪。');
|
||||||
|
|
||||||
|
const session = client.newSession();
|
||||||
|
session.on('started', async () => {
|
||||||
|
console.log(new Date(), 'TTS会话已开始。');
|
||||||
|
|
||||||
|
session.write('你好,');
|
||||||
|
session.write('我是小智');
|
||||||
|
session.write('今天的天气真的不错啊');
|
||||||
|
session.finish();
|
||||||
|
console.log(new Date(), '已发送 finish');
|
||||||
|
});
|
||||||
|
|
||||||
|
let t = Buffer.alloc(0);
|
||||||
|
session.on('audio', (audio) => {
|
||||||
|
console.log(new Date(), '收到', audio.length, '字节');
|
||||||
|
t = Buffer.concat([t, audio]);
|
||||||
|
});
|
||||||
|
|
||||||
|
session.on('finished', () => {
|
||||||
|
console.log(new Date(), 'TTS会话已结束。');
|
||||||
|
client.finishConnection();
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
fs.writeFileSync('tts.pcm', t);
|
||||||
|
console.log('音频数据已写入 tts.pcm,大小:', t.length);
|
||||||
|
console.log('要播放音频,请运行: ffplay -f s16le -ar 24000 -ac 1 tts.pcm');
|
||||||
|
});
|
||||||
|
|
||||||
|
session.on('sentence_start', (text) => {
|
||||||
|
console.log('句子开始', text);
|
||||||
|
});
|
||||||
|
|
||||||
|
session.on('sentence_end', (text) => {
|
||||||
|
console.log('句子结束', text);
|
||||||
|
});
|
||||||
|
|
||||||
|
session.on('error', (err) => {
|
||||||
|
console.error('TTS会话错误:', err);
|
||||||
|
});
|
||||||
|
|
||||||
|
session.on('cancelled', () => {
|
||||||
|
console.log('TTS会话已取消。');
|
||||||
|
});
|
||||||
|
|
||||||
|
session.on('finished', () => {
|
||||||
|
console.log('TTS会话已结束。');
|
||||||
|
client.finishConnection();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('error', (err) => console.error(new Date(), 'TTS客户端错误:', err));
|
||||||
|
client.on('close', () => console.log('TTS客户端已关闭'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { DashscopeTtsClient };
|
||||||
|
|
||||||
|
if (require.main === module) {
|
||||||
|
DashscopeTtsClient.test();
|
||||||
|
}
|
||||||
9
main/xiaozhi-server/tts-server/ecosystem.config.js
Normal file
9
main/xiaozhi-server/tts-server/ecosystem.config.js
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
module.exports = {
|
||||||
|
apps: [
|
||||||
|
{
|
||||||
|
name: 'tts-server',
|
||||||
|
script: 'app.js',
|
||||||
|
log_date_format: "YYYY-MM-DD HH:mm:ss.SSS",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
663
main/xiaozhi-server/tts-server/package-lock.json
generated
Normal file
663
main/xiaozhi-server/tts-server/package-lock.json
generated
Normal file
|
|
@ -0,0 +1,663 @@
|
||||||
|
{
|
||||||
|
"name": "tts-server",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "tts-server",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"@discordjs/opus": "github:discordjs/opus",
|
||||||
|
"dotenv": "^16.4.5",
|
||||||
|
"path": "^0.12.7",
|
||||||
|
"uuid": "^10.0.0",
|
||||||
|
"ws": "^8.18.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@discordjs/node-pre-gyp": {
|
||||||
|
"version": "0.4.5",
|
||||||
|
"resolved": "https://registry.npmmirror.com/@discordjs/node-pre-gyp/-/node-pre-gyp-0.4.5.tgz",
|
||||||
|
"integrity": "sha512-YJOVVZ545x24mHzANfYoy0BJX5PDyeZlpiJjDkUBM/V/Ao7TFX9lcUvCN4nr0tbr5ubeaXxtEBILUrHtTphVeQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"detect-libc": "^2.0.0",
|
||||||
|
"https-proxy-agent": "^5.0.0",
|
||||||
|
"make-dir": "^3.1.0",
|
||||||
|
"node-fetch": "^2.6.7",
|
||||||
|
"nopt": "^5.0.0",
|
||||||
|
"npmlog": "^5.0.1",
|
||||||
|
"rimraf": "^3.0.2",
|
||||||
|
"semver": "^7.3.5",
|
||||||
|
"tar": "^6.1.11"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"node-pre-gyp": "bin/node-pre-gyp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@discordjs/opus": {
|
||||||
|
"version": "0.10.0",
|
||||||
|
"resolved": "git+ssh://git@github.com/discordjs/opus.git#679ff3f58e6804b80becc166c7214deb2ca026e2",
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@discordjs/node-pre-gyp": "^0.4.5",
|
||||||
|
"node-addon-api": "^8.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/abbrev": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/abbrev/-/abbrev-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
|
||||||
|
},
|
||||||
|
"node_modules/agent-base": {
|
||||||
|
"version": "6.0.2",
|
||||||
|
"resolved": "https://registry.npmmirror.com/agent-base/-/agent-base-6.0.2.tgz",
|
||||||
|
"integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ansi-regex": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||||
|
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/aproba": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/aproba/-/aproba-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ=="
|
||||||
|
},
|
||||||
|
"node_modules/are-we-there-yet": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==",
|
||||||
|
"deprecated": "This package is no longer supported.",
|
||||||
|
"dependencies": {
|
||||||
|
"delegates": "^1.0.0",
|
||||||
|
"readable-stream": "^3.6.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/balanced-match": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
||||||
|
},
|
||||||
|
"node_modules/brace-expansion": {
|
||||||
|
"version": "1.1.11",
|
||||||
|
"resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
|
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||||
|
"dependencies": {
|
||||||
|
"balanced-match": "^1.0.0",
|
||||||
|
"concat-map": "0.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/chownr": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/chownr/-/chownr-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/color-support": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmmirror.com/color-support/-/color-support-1.1.3.tgz",
|
||||||
|
"integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==",
|
||||||
|
"bin": {
|
||||||
|
"color-support": "bin.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/concat-map": {
|
||||||
|
"version": "0.0.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
|
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
|
||||||
|
},
|
||||||
|
"node_modules/console-control-strings": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/console-control-strings/-/console-control-strings-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ=="
|
||||||
|
},
|
||||||
|
"node_modules/debug": {
|
||||||
|
"version": "4.4.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/debug/-/debug-4.4.0.tgz",
|
||||||
|
"integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
|
||||||
|
"dependencies": {
|
||||||
|
"ms": "^2.1.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"supports-color": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/delegates": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/delegates/-/delegates-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ=="
|
||||||
|
},
|
||||||
|
"node_modules/detect-libc": {
|
||||||
|
"version": "2.0.3",
|
||||||
|
"resolved": "https://registry.npmmirror.com/detect-libc/-/detect-libc-2.0.3.tgz",
|
||||||
|
"integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/dotenv": {
|
||||||
|
"version": "16.5.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/dotenv/-/dotenv-16.5.0.tgz",
|
||||||
|
"integrity": "sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://dotenvx.com"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/emoji-regex": {
|
||||||
|
"version": "8.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||||
|
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
|
||||||
|
},
|
||||||
|
"node_modules/fs-minipass": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/fs-minipass/-/fs-minipass-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",
|
||||||
|
"dependencies": {
|
||||||
|
"minipass": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fs-minipass/node_modules/minipass": {
|
||||||
|
"version": "3.3.6",
|
||||||
|
"resolved": "https://registry.npmmirror.com/minipass/-/minipass-3.3.6.tgz",
|
||||||
|
"integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
|
||||||
|
"dependencies": {
|
||||||
|
"yallist": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fs.realpath": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
|
||||||
|
},
|
||||||
|
"node_modules/gauge": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmmirror.com/gauge/-/gauge-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==",
|
||||||
|
"deprecated": "This package is no longer supported.",
|
||||||
|
"dependencies": {
|
||||||
|
"aproba": "^1.0.3 || ^2.0.0",
|
||||||
|
"color-support": "^1.1.2",
|
||||||
|
"console-control-strings": "^1.0.0",
|
||||||
|
"has-unicode": "^2.0.1",
|
||||||
|
"object-assign": "^4.1.1",
|
||||||
|
"signal-exit": "^3.0.0",
|
||||||
|
"string-width": "^4.2.3",
|
||||||
|
"strip-ansi": "^6.0.1",
|
||||||
|
"wide-align": "^1.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/glob": {
|
||||||
|
"version": "7.2.3",
|
||||||
|
"resolved": "https://registry.npmmirror.com/glob/-/glob-7.2.3.tgz",
|
||||||
|
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
||||||
|
"deprecated": "Glob versions prior to v9 are no longer supported",
|
||||||
|
"dependencies": {
|
||||||
|
"fs.realpath": "^1.0.0",
|
||||||
|
"inflight": "^1.0.4",
|
||||||
|
"inherits": "2",
|
||||||
|
"minimatch": "^3.1.1",
|
||||||
|
"once": "^1.3.0",
|
||||||
|
"path-is-absolute": "^1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/has-unicode": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/has-unicode/-/has-unicode-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ=="
|
||||||
|
},
|
||||||
|
"node_modules/https-proxy-agent": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
|
||||||
|
"integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
|
||||||
|
"dependencies": {
|
||||||
|
"agent-base": "6",
|
||||||
|
"debug": "4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/inflight": {
|
||||||
|
"version": "1.0.6",
|
||||||
|
"resolved": "https://registry.npmmirror.com/inflight/-/inflight-1.0.6.tgz",
|
||||||
|
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
|
||||||
|
"deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.",
|
||||||
|
"dependencies": {
|
||||||
|
"once": "^1.3.0",
|
||||||
|
"wrappy": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/inherits": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
|
},
|
||||||
|
"node_modules/is-fullwidth-code-point": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/make-dir": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/make-dir/-/make-dir-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==",
|
||||||
|
"dependencies": {
|
||||||
|
"semver": "^6.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/make-dir/node_modules/semver": {
|
||||||
|
"version": "6.3.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/semver/-/semver-6.3.1.tgz",
|
||||||
|
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
|
||||||
|
"bin": {
|
||||||
|
"semver": "bin/semver.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/minimatch": {
|
||||||
|
"version": "3.1.2",
|
||||||
|
"resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.2.tgz",
|
||||||
|
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||||
|
"dependencies": {
|
||||||
|
"brace-expansion": "^1.1.7"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/minipass": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/minipass/-/minipass-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/minizlib": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmmirror.com/minizlib/-/minizlib-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
|
||||||
|
"dependencies": {
|
||||||
|
"minipass": "^3.0.0",
|
||||||
|
"yallist": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/minizlib/node_modules/minipass": {
|
||||||
|
"version": "3.3.6",
|
||||||
|
"resolved": "https://registry.npmmirror.com/minipass/-/minipass-3.3.6.tgz",
|
||||||
|
"integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
|
||||||
|
"dependencies": {
|
||||||
|
"yallist": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mkdirp": {
|
||||||
|
"version": "1.0.4",
|
||||||
|
"resolved": "https://registry.npmmirror.com/mkdirp/-/mkdirp-1.0.4.tgz",
|
||||||
|
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
|
||||||
|
"bin": {
|
||||||
|
"mkdirp": "bin/cmd.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ms": {
|
||||||
|
"version": "2.1.3",
|
||||||
|
"resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz",
|
||||||
|
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||||
|
},
|
||||||
|
"node_modules/node-addon-api": {
|
||||||
|
"version": "8.3.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/node-addon-api/-/node-addon-api-8.3.1.tgz",
|
||||||
|
"integrity": "sha512-lytcDEdxKjGJPTLEfW4mYMigRezMlyJY8W4wxJK8zE533Jlb8L8dRuObJFWg2P+AuOIxoCgKF+2Oq4d4Zd0OUA==",
|
||||||
|
"engines": {
|
||||||
|
"node": "^18 || ^20 || >= 21"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/node-fetch": {
|
||||||
|
"version": "2.7.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||||
|
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
||||||
|
"dependencies": {
|
||||||
|
"whatwg-url": "^5.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "4.x || >=6.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"encoding": "^0.1.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"encoding": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/nopt": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/nopt/-/nopt-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"abbrev": "1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"nopt": "bin/nopt.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/npmlog": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/npmlog/-/npmlog-5.0.1.tgz",
|
||||||
|
"integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==",
|
||||||
|
"deprecated": "This package is no longer supported.",
|
||||||
|
"dependencies": {
|
||||||
|
"are-we-there-yet": "^2.0.0",
|
||||||
|
"console-control-strings": "^1.1.0",
|
||||||
|
"gauge": "^3.0.0",
|
||||||
|
"set-blocking": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/object-assign": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/object-assign/-/object-assign-4.1.1.tgz",
|
||||||
|
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/once": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/once/-/once-1.4.0.tgz",
|
||||||
|
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||||
|
"dependencies": {
|
||||||
|
"wrappy": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/path": {
|
||||||
|
"version": "0.12.7",
|
||||||
|
"resolved": "https://registry.npmmirror.com/path/-/path-0.12.7.tgz",
|
||||||
|
"integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==",
|
||||||
|
"dependencies": {
|
||||||
|
"process": "^0.11.1",
|
||||||
|
"util": "^0.10.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/path-is-absolute": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/process": {
|
||||||
|
"version": "0.11.10",
|
||||||
|
"resolved": "https://registry.npmmirror.com/process/-/process-0.11.10.tgz",
|
||||||
|
"integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/readable-stream": {
|
||||||
|
"version": "3.6.2",
|
||||||
|
"resolved": "https://registry.npmmirror.com/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||||
|
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||||
|
"dependencies": {
|
||||||
|
"inherits": "^2.0.3",
|
||||||
|
"string_decoder": "^1.1.1",
|
||||||
|
"util-deprecate": "^1.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/rimraf": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmmirror.com/rimraf/-/rimraf-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
||||||
|
"deprecated": "Rimraf versions prior to v4 are no longer supported",
|
||||||
|
"dependencies": {
|
||||||
|
"glob": "^7.1.3"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"rimraf": "bin.js"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/safe-buffer": {
|
||||||
|
"version": "5.2.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||||
|
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "patreon",
|
||||||
|
"url": "https://www.patreon.com/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "consulting",
|
||||||
|
"url": "https://feross.org/support"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"node_modules/semver": {
|
||||||
|
"version": "7.7.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/semver/-/semver-7.7.1.tgz",
|
||||||
|
"integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==",
|
||||||
|
"bin": {
|
||||||
|
"semver": "bin/semver.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/set-blocking": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw=="
|
||||||
|
},
|
||||||
|
"node_modules/signal-exit": {
|
||||||
|
"version": "3.0.7",
|
||||||
|
"resolved": "https://registry.npmmirror.com/signal-exit/-/signal-exit-3.0.7.tgz",
|
||||||
|
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="
|
||||||
|
},
|
||||||
|
"node_modules/string_decoder": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||||
|
"dependencies": {
|
||||||
|
"safe-buffer": "~5.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/string-width": {
|
||||||
|
"version": "4.2.3",
|
||||||
|
"resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz",
|
||||||
|
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||||
|
"dependencies": {
|
||||||
|
"emoji-regex": "^8.0.0",
|
||||||
|
"is-fullwidth-code-point": "^3.0.0",
|
||||||
|
"strip-ansi": "^6.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/strip-ansi": {
|
||||||
|
"version": "6.0.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||||
|
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-regex": "^5.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/tar": {
|
||||||
|
"version": "6.2.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/tar/-/tar-6.2.1.tgz",
|
||||||
|
"integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==",
|
||||||
|
"dependencies": {
|
||||||
|
"chownr": "^2.0.0",
|
||||||
|
"fs-minipass": "^2.0.0",
|
||||||
|
"minipass": "^5.0.0",
|
||||||
|
"minizlib": "^2.1.1",
|
||||||
|
"mkdirp": "^1.0.3",
|
||||||
|
"yallist": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/tr46": {
|
||||||
|
"version": "0.0.3",
|
||||||
|
"resolved": "https://registry.npmmirror.com/tr46/-/tr46-0.0.3.tgz",
|
||||||
|
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
||||||
|
},
|
||||||
|
"node_modules/util": {
|
||||||
|
"version": "0.10.4",
|
||||||
|
"resolved": "https://registry.npmmirror.com/util/-/util-0.10.4.tgz",
|
||||||
|
"integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
|
||||||
|
"dependencies": {
|
||||||
|
"inherits": "2.0.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/util-deprecate": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmmirror.com/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
||||||
|
},
|
||||||
|
"node_modules/util/node_modules/inherits": {
|
||||||
|
"version": "2.0.3",
|
||||||
|
"resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.3.tgz",
|
||||||
|
"integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw=="
|
||||||
|
},
|
||||||
|
"node_modules/uuid": {
|
||||||
|
"version": "10.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/uuid/-/uuid-10.0.0.tgz",
|
||||||
|
"integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==",
|
||||||
|
"funding": [
|
||||||
|
"https://github.com/sponsors/broofa",
|
||||||
|
"https://github.com/sponsors/ctavan"
|
||||||
|
],
|
||||||
|
"bin": {
|
||||||
|
"uuid": "dist/bin/uuid"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/webidl-conversions": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
|
||||||
|
},
|
||||||
|
"node_modules/whatwg-url": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
||||||
|
"dependencies": {
|
||||||
|
"tr46": "~0.0.3",
|
||||||
|
"webidl-conversions": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/wide-align": {
|
||||||
|
"version": "1.1.5",
|
||||||
|
"resolved": "https://registry.npmmirror.com/wide-align/-/wide-align-1.1.5.tgz",
|
||||||
|
"integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==",
|
||||||
|
"dependencies": {
|
||||||
|
"string-width": "^1.0.2 || 2 || 3 || 4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/wrappy": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
||||||
|
},
|
||||||
|
"node_modules/ws": {
|
||||||
|
"version": "8.18.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/ws/-/ws-8.18.1.tgz",
|
||||||
|
"integrity": "sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"bufferutil": "^4.0.1",
|
||||||
|
"utf-8-validate": ">=5.0.2"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"bufferutil": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"utf-8-validate": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/yallist": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/yallist/-/yallist-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
18
main/xiaozhi-server/tts-server/package.json
Normal file
18
main/xiaozhi-server/tts-server/package.json
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"name": "tts-server",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "app.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"@discordjs/opus": "github:discordjs/opus",
|
||||||
|
"dotenv": "^16.4.5",
|
||||||
|
"path": "^0.12.7",
|
||||||
|
"uuid": "^10.0.0",
|
||||||
|
"ws": "^8.18.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
329
main/xiaozhi-server/tts-server/tts-list.js
Normal file
329
main/xiaozhi-server/tts-server/tts-list.js
Normal file
|
|
@ -0,0 +1,329 @@
|
||||||
|
const ttsList = [
|
||||||
|
{
|
||||||
|
name: "爽快思思/Skye",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_female_shuangkuaisisi_moon_bigtts",
|
||||||
|
languages: ["中文", "英文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/Skye.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "温暖阿虎/Alvin",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_male_wennuanahu_moon_bigtts",
|
||||||
|
languages: ["中文", "英文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/Alvin.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "少年梓辛/Brayan",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_male_shaonianzixin_moon_bigtts",
|
||||||
|
languages: ["中文", "英文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/Brayan.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "かずね(和音)/Javier or Álvaro",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "multi_male_jingqiangkanye_moon_bigtts",
|
||||||
|
languages: ["日语", "西语"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/Javier.wav"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "はるこ(晴子)/Esmeralda",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "multi_female_shuangkuaisisi_moon_bigtts",
|
||||||
|
languages: ["日语", "西语"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/Esmeralda.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "あけみ(朱美)",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "multi_female_gaolengyujie_moon_bigtts",
|
||||||
|
languages: ["日语"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E6%9C%B1%E7%BE%8E.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "ひろし(広志)/Roberto",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "multi_male_wanqudashu_moon_bigtts",
|
||||||
|
languages: ["日语", "西语"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/Roberto.wav"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "邻家女孩",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_female_linjianvhai_moon_bigtts",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E9%82%BB%E5%AE%B6%E5%A5%B3%E5%AD%A9.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "渊博小叔",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_male_yuanboxiaoshu_moon_bigtts",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E6%B8%8A%E5%8D%9A%E5%B0%8F%E5%8F%94.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "阳光青年",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_male_yangguangqingnian_moon_bigtts",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E9%98%B3%E5%85%89%E9%9D%92%E5%B9%B4.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "京腔侃爷/Harmony",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_male_jingqiangkanye_moon_bigtts",
|
||||||
|
languages: ["中文", "英文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/Harmony.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "湾湾小何",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_female_wanwanxiaohe_moon_bigtts",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E6%B9%BE%E6%B9%BE%E5%B0%8F%E4%BD%95.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "湾区大叔",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_female_wanqudashu_moon_bigtts",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E6%B9%BE%E5%8C%BA%E5%A4%A7%E5%8F%94.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "呆萌川妹",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_female_daimengchuanmei_moon_bigtts",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E5%91%86%E8%90%8C%E5%B7%9D%E5%A6%B9.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "广州德哥",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_male_guozhoudege_moon_bigtts",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E5%B9%BF%E5%B7%9E%E5%BE%B7%E5%93%A5.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "北京小爷",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_male_beijingxiaoye_moon_bigtts",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E5%8C%97%E4%BA%AC%E5%B0%8F%E7%88%B7.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "浩宇小哥",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_male_haoyuxiaoge_moon_bigtts",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E6%B5%A9%E5%AE%87%E5%B0%8F%E5%93%A5.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "广西远舟",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_male_guangxiyuanzhou_moon_bigtts",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E5%B9%BF%E8%A5%BF%E8%BF%9C%E8%88%9F.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "妹坨洁儿",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_female_meituojieer_moon_bigtts",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E5%A6%B9%E5%9D%A8%E6%B4%81%E5%84%BF.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "豫州子轩",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_male_yuzhouzixuan_moon_bigtts",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E8%B1%AB%E5%B7%9E%E5%AD%90%E8%BD%A9.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "高冷御姐",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_female_gaolengyujie_moon_bigtts",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E9%AB%98%E5%86%B7%E5%BE%A1%E5%A7%90.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "傲娇霸总",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_male_aojiaobazong_moon_bigtts",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E5%82%B2%E5%A8%87%E9%9C%B8%E6%80%BB.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "魅力女友",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_female_meilinvyou_moon_bigtts",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E9%AD%85%E5%8A%9B%E5%A5%B3%E5%8F%8B.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "深夜播客",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_male_shenyeboke_moon_bigtts",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E6%B7%B1%E5%A4%9C%E6%92%AD%E5%AE%A2.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "柔美女友",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_female_sajiaonvyou_moon_bigtts",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E6%9F%94%E7%BE%8E%E5%A5%B3%E5%8F%8B.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "撒娇学妹",
|
||||||
|
voice_source: "volcengine",
|
||||||
|
voice_id: "zh_female_yuanqinvyou_moon_bigtts",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E6%92%92%E5%A8%87%E5%AD%A6%E5%A6%B9.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "龙婉 女",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "longwan",
|
||||||
|
languages: ["中文普通话"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240830/dzkngm/龙婉.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "龙橙 男",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "longcheng",
|
||||||
|
languages: ["中文普通话"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240830/ggjwfl/龙橙.wav"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "龙华 女童",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "longhua",
|
||||||
|
languages: ["中文普通话"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240830/jpjtvy/龙华.wav"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "龙小淳 女",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "longxiaochun",
|
||||||
|
languages: ["中文", "英文"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240624/rlfvcd/龙小淳.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "龙小夏 女",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "longxiaoxia",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240624/wzywtu/龙小夏.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "龙小诚 男",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "longxiaocheng",
|
||||||
|
languages: ["中文", "英文"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240624/xrqksx/龙小诚.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "龙小白 女",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "longxiaobai",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240624/vusvze/龙小白.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "龙老铁 男",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "longlaotie",
|
||||||
|
languages: ["中文东北口音"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240624/pfsfir/龙老铁.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "龙书 男",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "longshu",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240624/azcerd/龙书.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "龙硕 男",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "longshuo",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240624/lcykpl/龙硕.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "龙婧 女",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "longjing",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240624/ozkbmb/龙婧.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "龙妙 女",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "longmiao",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240624/zjnqis/龙妙.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "龙悦 女",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "longyue",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240624/nrkjqf/龙悦.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "龙媛 女",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "longyuan",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240624/xuboos/龙媛.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "龙飞 男",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "longfei",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240624/bhkjjx/龙飞.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "龙杰力豆 男童",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "longjielidou",
|
||||||
|
languages: ["中文", "英文"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240624/dctiyg/龙杰力豆.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "龙彤 女童",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "longtong",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240624/qyqmvo/龙彤.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "龙祥 男",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "longxiang",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240624/jybshd/龙祥.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Stella 女",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "loongstella",
|
||||||
|
languages: ["中文", "英文"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240624/haffms/Stella.mp3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Bella 女",
|
||||||
|
voice_source: "dashscope",
|
||||||
|
voice_id: "loongbella",
|
||||||
|
languages: ["中文"],
|
||||||
|
voice_demo: "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20240624/tguine/Bella.mp3"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
ttsList
|
||||||
|
};
|
||||||
|
|
||||||
Loading…
Reference in a new issue