You've already forked HeurAMS-Legacy
更新 providers
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
# 音频播放器, 必须基于文件操作
|
||||
from .termux_audio import player as termux_player
|
||||
|
||||
__all__ = [
|
||||
"termux_player"
|
||||
]
|
||||
|
||||
players = {
|
||||
"termux": termux_player
|
||||
}
|
||||
4
src/heurams/providers/audio/system_audio.py
Normal file
4
src/heurams/providers/audio/system_audio.py
Normal file
@@ -0,0 +1,4 @@
|
||||
""" 通用音频适配器
|
||||
基于 playsound 库的音频播放器, 在绝大多数 python 环境上提供音频服务
|
||||
注意: 在未配置 pulseaudio 的 termux 不可用
|
||||
"""
|
||||
@@ -0,0 +1,10 @@
|
||||
""" Termux 音频适配
|
||||
适配 Termux 的 play-audio 命令, 以在 android 上提供可用的播放体验
|
||||
无需配置 pulseaudio
|
||||
"""
|
||||
|
||||
import os
|
||||
import pathlib
|
||||
|
||||
def player(path: pathlib.Path):
|
||||
os.system(f"play-audio {path}")
|
||||
@@ -0,0 +1 @@
|
||||
# 大语言模型
|
||||
@@ -0,0 +1,12 @@
|
||||
from .base import BaseTTS
|
||||
from .edge_tts import EdgeTTS
|
||||
|
||||
__all__ = [
|
||||
"BaseTTS",
|
||||
"EdgeTTS",
|
||||
]
|
||||
|
||||
TTSs = {
|
||||
"BaseTTS": BaseTTS,
|
||||
"EdgeTTS": EdgeTTS,
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import pathlib
|
||||
|
||||
class BaseTTS:
|
||||
name = "BaseTTS"
|
||||
|
||||
@classmethod
|
||||
def convert(cls, text: str, path: pathlib.Path | str = "") -> pathlib.Path:
|
||||
"""path 是可选参数, 不填则自动返回生成文件路径"""
|
||||
return path # type: ignore
|
||||
@@ -0,0 +1,15 @@
|
||||
from .base import BaseTTS
|
||||
import pathlib
|
||||
import edge_tts
|
||||
|
||||
class EdgeTTS(BaseTTS):
|
||||
name = "EdgeTTS"
|
||||
|
||||
@classmethod
|
||||
def convert(cls, text, path: pathlib.Path | str = "") -> pathlib.Path:
|
||||
communicate = edge_tts.Communicate(
|
||||
text,
|
||||
"zh-CN-YunjianNeural",
|
||||
)
|
||||
communicate.save_sync(str(path))
|
||||
return path # type: ignore
|
||||
Reference in New Issue
Block a user