File size: 13,272 Bytes
bf13828 1df74c6 bf13828 1df74c6 bf13828 1df74c6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
class LocalizationVars:
def __init__(self):
self.DEFAULT_TTS_TEXT = ""
self.DEFAULT_SPEAKER_TEST_TEXT = ""
self.DEFAULT_SPEAKER_MERAGE_TEXT = ""
self.DEFAULT_SSML_TEXT = ""
self.ssml_examples = []
self.tts_examples = []
self.podcast_default = []
class ZHLocalizationVars(LocalizationVars):
def __init__(self):
super().__init__()
self.DEFAULT_TTS_TEXT = "chat T T S 是一款强大的对话式文本转语音模型。它有中英混读和多说话人的能力。"
self.DEFAULT_SPEAKER_TEST_TEXT = (
"说话人测试 123456789 [uv_break] ok, test done [lbreak]"
)
self.DEFAULT_SPEAKER_MERAGE_TEXT = (
"说话人合并测试 123456789 [uv_break] ok, test done [lbreak]"
)
self.DEFAULT_SSML_TEXT = """
<speak version="0.1">
<voice spk="Bob" seed="42" style="narration-relaxed">
这里是一个简单的 SSML 示例 [lbreak]
</voice>
</speak>
""".strip()
self.ssml_examples = [
"""
<speak version="0.1">
<voice spk="Bob" seed="42" style="narration-relaxed">
下面是一个 ChatTTS 用于合成多角色多情感的有声书示例[lbreak]
</voice>
<voice spk="Bob" seed="42" style="narration-relaxed">
黛玉冷笑道:[lbreak]
</voice>
<voice spk="female2" seed="42" style="angry">
我说呢 [uv_break] ,亏了绊住,不然,早就飞起来了[lbreak]
</voice>
<voice spk="Bob" seed="42" style="narration-relaxed">
宝玉道:[lbreak]
</voice>
<voice spk="Alice" seed="42" style="unfriendly">
“只许和你玩 [uv_break] ,替你解闷。不过偶然到他那里,就说这些闲话。”[lbreak]
</voice>
<voice spk="female2" seed="42" style="angry">
“好没意思的话![uv_break] 去不去,关我什么事儿? 又没叫你替我解闷儿 [uv_break],还许你不理我呢” [lbreak]
</voice>
<voice spk="Bob" seed="42" style="narration-relaxed">
说着,便赌气回房去了 [lbreak]
</voice>
</speak>
""",
"""
<speak version="0.1">
<voice spk="Bob" seed="42" style="narration-relaxed">
使用 prosody 控制生成文本的语速语调和音量,示例如下 [lbreak]
<prosody>
无任何限制将会继承父级voice配置进行生成 [lbreak]
</prosody>
<prosody rate="1.5">
设置 rate 大于1表示加速,小于1为减速 [lbreak]
</prosody>
<prosody pitch="6">
设置 pitch 调整音调,设置为6表示提高6个半音 [lbreak]
</prosody>
<prosody volume="2">
设置 volume 调整音量,设置为2表示提高2个分贝 [lbreak]
</prosody>
在 voice 中无prosody包裹的文本即为默认生成状态下的语音 [lbreak]
</voice>
</speak>
""",
"""
<speak version="0.1">
<voice spk="Bob" seed="42" style="narration-relaxed">
使用 break 标签将会简单的 [lbreak]
<break time="500" />
插入一段空白到生成结果中 [lbreak]
</voice>
</speak>
""",
]
self.tts_examples = [
{
"text": "大🍌,一条大🍌,嘿,你的感觉真的很奇妙 [lbreak]",
},
{
"text": "Big 🍌, a big 🍌, hey, your feeling is really wonderful [lbreak]"
},
{
"text": """
# 这是 markdown 标题
```
代码块将跳过
```
- **文本标准化**:
- **Markdown**: 自动检测处理 markdown 格式文本。
- **数字转写**: 自动将数字转为模型可识别的文本。
- **Emoji 适配**: 自动翻译 emoji 为可读文本。
- **基于分词器**: 基于 tokenizer 预处理文本,覆盖模型所有不支持字符范围。
- **中英文识别**: 适配英文环境。
"""
},
{
"text": "天气预报显示,今天会有小雨,请大家出门时记得带伞。降温的天气也提醒我们要适时添衣保暖 [lbreak]",
},
{
"text": "公司的年度总结会议将在下周三举行,请各部门提前准备好相关材料,确保会议顺利进行 [lbreak]",
},
{
"text": "今天的午餐菜单包括烤鸡、沙拉和蔬菜汤,大家可以根据自己的口味选择适合的菜品 [lbreak]",
},
{
"text": "请注意,电梯将在下午两点进行例行维护,预计需要一个小时的时间,请大家在此期间使用楼梯 [lbreak]",
},
{
"text": "图书馆新到了一批书籍,涵盖了文学、科学和历史等多个领域,欢迎大家前来借阅 [lbreak]",
},
{
"text": "电影中梁朝伟扮演的陈永仁的编号27149 [lbreak]",
},
{
"text": "这块黄金重达324.75克 [lbreak]",
},
{
"text": "我们班的最高总分为583分 [lbreak]",
},
{
"text": "12~23 [lbreak]",
},
{
"text": "-1.5~2 [lbreak]",
},
{
"text": "她出生于86年8月18日,她弟弟出生于1995年3月1日 [lbreak]",
},
{
"text": "等会请在12:05请通知我 [lbreak]",
},
{
"text": "今天的最低气温达到-10°C [lbreak]",
},
{
"text": "现场有7/12的观众投出了赞成票 [lbreak]",
},
{
"text": "明天有62%的概率降雨 [lbreak]",
},
{
"text": "随便来几个价格12块5,34.5元,20.1万 [lbreak]",
},
{
"text": "这是固话0421-33441122 [lbreak]",
},
{
"text": "这是手机+86 18544139121 [lbreak]",
},
]
self.podcast_default = [
[
1,
"female2",
"你好,欢迎收听今天的播客内容。今天我们要聊的是中华料理。",
"podcast",
],
[
2,
"Alice",
"嗨,我特别期待这个话题!中华料理真的是博大精深。",
"podcast",
],
[
3,
"Bob",
"没错,中华料理有着几千年的历史,而且每个地区都有自己的特色菜。",
"podcast",
],
[
4,
"female2",
"那我们先从最有名的川菜开始吧。川菜以其麻辣著称,是很多人的最爱。",
"podcast",
],
[
5,
"Alice",
"对,我特别喜欢吃麻婆豆腐和辣子鸡。那种麻辣的感觉真是让人难以忘怀。",
"podcast",
],
[
6,
"Bob",
"除了川菜,粤菜也是很受欢迎的。粤菜讲究鲜美,像是白切鸡和蒸鱼都是经典。",
"podcast",
],
[
7,
"female2",
"对啊,粤菜的烹饪方式比较清淡,更注重食材本身的味道。",
"podcast",
],
[
8,
"Alice",
"还有北京的京菜,像北京烤鸭,那可是来北京必吃的美食。",
"podcast",
],
[
9,
"Bob",
"不仅如此,还有淮扬菜、湘菜、鲁菜等等,每个菜系都有其独特的风味。",
"podcast",
],
[
10,
"female2",
"对对对,像淮扬菜的狮子头,湘菜的剁椒鱼头,都是让人垂涎三尺的美味。",
"podcast",
],
]
class ENLocalizationVars(LocalizationVars):
def __init__(self):
super().__init__()
self.DEFAULT_TTS_TEXT = "Chat T T S is a powerful conversational text-to-speech model. It has the ability to mix Chinese and English and multiple speakers."
self.DEFAULT_SPEAKER_TEST_TEXT = (
"Speaker test 123456789 [uv_break] ok, test done [lbreak]"
)
self.DEFAULT_SPEAKER_MERAGE_TEXT = (
"Speaker merge test 123456789 [uv_break] ok, test done [lbreak]"
)
self.DEFAULT_SSML_TEXT = """
<speak version="0.1">
<voice spk="Bob" seed="42" style="narration-relaxed">
Here is a simple SSML example [lbreak]
</voice>
</speak>
""".strip()
self.ssml_examples = [
"""
<speak version="0.1">
<voice spk="Bob" seed="42" style="narration-relaxed">
Below is an example of ChatTTS synthesizing an audiobook with multiple roles and emotions [lbreak]
</voice>
<voice spk="Bob" seed="42" style="narration-relaxed">
Daiyu sneered: [lbreak]
</voice>
<voice spk="female2" seed="42" style="angry">
I said [uv_break], it's a loss to trip, otherwise, I would have flown up long ago [lbreak]
</voice>
<voice spk="Bob" seed="42" style="narration-relaxed">
Bao Yu said: [lbreak]
</voice>
<voice spk="Alice" seed="42" style="unfriendly">
"Only play with you [uv_break], to relieve your boredom. But occasionally go to his place, just say these idle words." [lbreak]
</voice>
<voice spk="female2" seed="42" style="angry">
"What a boring thing! [uv_break] Go or not, it's none of my business? I didn't ask you to relieve my boredom [uv_break], and you don't even care about me." [lbreak]
</voice>
<voice spk="Bob" seed="42" style="narration-relaxed">
Saying that, he went back to the room in anger [lbreak]
</voice>
</speak>""",
]
self.tts_examples = [
{
"text": "I guess it comes down a simple choice. Get busy living or get busy dying.",
},
{
"text": "You got a dream, you gotta protect it. People can't do something themselves, they wanna tell you you can't do it. If you want something, go get it.",
},
{
"text": "Don't ever let somebody tell you you can't do something. Not even me. Alright? You got a dream, you gotta protect it. When people can't do something themselves, they're gonna tell you that you can't do it. You want something, go get it. Period.",
},
]
self.podcast_default = [
[
1,
"female2",
"Hello, welcome to today's podcast. Today, we're going to talk about global cuisine.",
"podcast",
],
[
2,
"Alice",
"Hi, I'm really excited about this topic! Global cuisine is incredibly diverse and fascinating.",
"podcast",
],
[
3,
"Bob",
"Absolutely, every country has its own unique culinary traditions and specialties.",
"podcast",
],
[
4,
"female2",
"Let's start with Italian cuisine. Italian food is loved worldwide, especially for its pasta and pizza.",
"podcast",
],
[
5,
"Alice",
"Yes, I especially love a good Margherita pizza and a hearty plate of spaghetti carbonara. The flavors are simply amazing.",
"podcast",
],
[
6,
"Bob",
"Besides Italian cuisine, Japanese cuisine is also very popular. Dishes like sushi and ramen have become global favorites.",
"podcast",
],
[
7,
"female2",
"Exactly, Japanese cuisine is known for its emphasis on fresh ingredients and delicate presentation.",
"podcast",
],
[
8,
"Alice",
"And then there's Mexican cuisine, with its bold flavors and colorful dishes like tacos and guacamole.",
"podcast",
],
[
9,
"Bob",
"Not to mention, there's also Indian cuisine, Thai cuisine, French cuisine, and so many more, each with its own distinctive flavors and techniques.",
"podcast",
],
[
10,
"female2",
"Yes, like Indian curry, Thai tom yum soup, and French croissants, these are all mouth-watering dishes that are loved by people all over the world.",
"podcast",
],
]
|