当前位置: 首页 > news >正文

如何传图片做网站门户制作

如何传图片做网站,门户制作,花灯制作,中国建筑集团edge-tts是一个 Python 模块,允许通过Python代码或命令的方式使用 Microsoft Edge 的在线文本转语音服务。 项目源码 GitHub - rany2/edge-tts: Use Microsoft Edges online text-to-speech service from Python WITHOUT needing Microsoft Edge or Windows or an…

edge-tts是一个 Python 模块,允许通过Python代码或命令的方式使用 Microsoft Edge 的在线文本转语音服务。

项目源码

GitHub - rany2/edge-tts: Use Microsoft Edge's online text-to-speech service from Python WITHOUT needing Microsoft Edge or Windows or an API keyUse Microsoft Edge's online text-to-speech service from Python WITHOUT needing Microsoft Edge or Windows or an API key - rany2/edge-ttsicon-default.png?t=N7T8https://github.com/rany2/edge-tts

安装

pip install edge-tts

用法

命令行方式

  • --write-media:输出音频
  • --write-subtitles:输出字幕
edge-tts --text "Hello, world!" --write-media hello.mp3 --write-subtitles hello.vtt

选项检查可用的声音

edge-tts --list-voices

改变声音

  • --voice:指定声音
edge-tts --voice zh-CN-XiaoxiaoNeural --text "君不见黄河之水天上来" --write-media hello.mp3 --write-subtitles hello.vtt

改变速率、音量和音高

edge-tts --rate=-50% --text "Hello, world!" --write-media hello.mp3 --write-subtitles hello.vtt
edge-tts --volume=-50% --text "Hello, world!" --write-media hello.mp3 --write-subtitles hello.vtt
edge-tts --pitch=-50Hz --text "Hello, world!" --write-media hello.mp3 --write-subtitles hello.vtt

播放音频

edge-playback

edge-playback 用于播放生成的语音。它采用与 edge-tts 相同的参数。

Python代码方式

文字转音频

import asyncio
import edge_ttsTEXT = "Hello World!"
VOICE = "en-GB-SoniaNeural"
OUTPUT_FILE = "test.mp3"async def amain() -> None:"""Main function"""communicate = edge_tts.Communicate(TEXT, VOICE)await communicate.save(OUTPUT_FILE)if __name__ == "__main__":loop = asyncio.get_event_loop_policy().get_event_loop()try:loop.run_until_complete(amain())finally:loop.close()

使用VoicesManager进行动态语音选择的示例

import asyncio
import randomimport edge_tts
from edge_tts import VoicesManagerTEXT = "Hoy es un buen día."
OUTPUT_FILE = "spanish.mp3"async def amain() -> None:"""Main function"""voices = await VoicesManager.create()voice = voices.find(Gender="Male", Language="es")# Also supports Locales# voice = voices.find(Gender="Female", Locale="es-AR")communicate = edge_tts.Communicate(TEXT, random.choice(voice)["Name"])await communicate.save(OUTPUT_FILE)if __name__ == "__main__":loop = asyncio.get_event_loop_policy().get_event_loop()try:loop.run_until_complete(amain())finally:loop.close()

流式传输来自TTS的音频数据

import asyncio
import edge_ttsTEXT = "Hello World!"
VOICE = "en-GB-SoniaNeural"
OUTPUT_FILE = "test.mp3"async def amain() -> None:"""Main function"""communicate = edge_tts.Communicate(TEXT, VOICE)with open(OUTPUT_FILE, "wb") as file:async for chunk in communicate.stream():if chunk["type"] == "audio":file.write(chunk["data"])elif chunk["type"] == "WordBoundary":print(f"WordBoundary: {chunk}")if __name__ == "__main__":loop = asyncio.get_event_loop_policy().get_event_loop()try:loop.run_until_complete(amain())finally:loop.close()

http://www.yayakq.cn/news/794398/

相关文章:

  • 百度网站如何做上海互联网设计公司
  • 佛山建设小学网站企业网站的主要类型有
  • 怎么做切片网站秦皇岛 网站制作
  • 网站模板免费推荐网站建设有没有
  • 网站制作免费网站知识网站
  • 建站公司佛山网站设计高端网站设计
  • 网站页头企业做网站时应注意的事项
  • 申请免费域名邮箱杭州优化网站
  • 谁会制作网站排名推广网站
  • 银行官方网站网址大全最新排行榜
  • 汽车4s网站设计wordpress 4.8 pdf缩略图
  • 网站目录在哪里wordpress字体不能换行
  • 济南专业网站制作公司网站怎么规范管理的
  • 南昌网站搭建服务怎样申请网站空间
  • 网上做网站网站代理网页布局有哪些
  • 工业智能科技网站设计建设一个购物网站需要多少钱
  • 自己做国际网站交流平台网站架构怎么做
  • 胶南做网站灵感设计网站
  • 部队网站建设总结wordpress注册时候卡住
  • 扬州网站建设suteng网络推广营销方法
  • 华亚快印网站开发做旅游网站需要什么
  • 网站栏目建设图全国做旅游开发的公司
  • 做国际网站怎么能快速打开哪个网站做初中英语试题赚钱
  • 临沂住房和城乡建设局网站打不开太原网站seo外包
  • 北京企业建站公司化妆品网站的搭建
  • 咸阳网站设计申请做网站_论坛版主
  • 交互式网站定义网站建设找伟杨科技
  • 番禺建设网站公司排名网站建设项目组织结构图
  • 一站式商家服务平台vr网站建设
  • 外贸公司 如何做公司网站成交型网站建设价格