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

云南SEO网站建设网络营销案例

云南SEO网站建设,网络营销案例,wordpress插件的选择,沙井网站建设在现代应用程序中,文本转语音(Text-to-Speech, TTS)技术越来越受到重视。无论是为视力障碍人士提供帮助,还是为教育和娱乐应用增添趣味,TTS 都能发挥重要作用。今天,我们将介绍一个简单易用的 Python 库——…

在现代应用程序中,文本转语音(Text-to-Speech, TTS)技术越来越受到重视。无论是为视力障碍人士提供帮助,还是为教育和娱乐应用增添趣味,TTS 都能发挥重要作用。今天,我们将介绍一个简单易用的 Python 库——pyttsx3,它可以帮助你轻松实现文本转语音功能。

什么是 pyttsx3?

pyttsx3 是一个 Python 库,用于将文本转换为语音。与其他 TTS 库不同,pyttsx3 是一个离线库,这意味着它不依赖于互联网连接,可以在本地计算机上运行。官网:https://github.com/nateshmbhat/pyttsx3

它支持多种语音引擎,包括 SAPI5(Windows)、NSSpeechSynthesizer(macOS)和 espeak(Linux)。具体不通系统使用的语音引擎为:

LinuxmacOSWindows
AVSpeech✅︎
eSpeak✅︎✅︎✅︎
NSSpeechSynthesizer✅︎
SAPI5✅︎

实践操作

安装pyttsx3

只要安装pyttsx3库即可。如果是在linux系统,需要安装espeak-ng库。(windows下以前已经安装过espeak-ng库,所以倒不确定了)

pip install pyttsx3
sudo apt update && sudo apt install espeak-ng libespeak1

使用

简单使用

初始化引擎,然后朗读文本

import pyttsx3
engine = pyttsx3.init()# For Mac, If you face error related to "pyobjc" when running the `init()` method :
# Install 9.0.1 version of pyobjc : "pip install pyobjc>=9.0.1"engine.say("I will speak this text")
engine.runAndWait()

最简单语句使用

只需要一条命令就可以直接朗读文本

import pyttsx3
pyttsx3.speak("I will speak this text")

修改语音voice、速率rate和音量volume

import pyttsx3
engine = pyttsx3.init() # object creation# RATE
rate = engine.getProperty('rate')   # getting details of current speaking rate
print (rate)                        # printing current voice rate
engine.setProperty('rate', 125)     # setting up new voice rate# VOLUME
volume = engine.getProperty('volume')   # getting to know current volume level (min=0 and max=1)
print (volume)                          # printing current volume level
engine.setProperty('volume',1.0)        # setting up volume level  between 0 and 1# VOICE
voices = engine.getProperty('voices')       # getting details of current voice
#engine.setProperty('voice', voices[0].id)  # changing index, changes voices. o for male
engine.setProperty('voice', voices[1].id)   # changing index, changes voices. 1 for femaleengine.say("Hello World!")
engine.say('My current speaking rate is ' + str(rate))
engine.runAndWait()
engine.stop()# Saving Voice to a file
# On Linux, make sure that 'espeak-ng' is installed
engine.save_to_file('Hello World', 'test.mp3')
engine.runAndWait()

支持说中文语音

import pyttsx3def say_chinese(text):engine = pyttsx3.init()voices = engine.getProperty('voices')for voice in voices:if "Chinese" in voice.id:engine.setProperty('voice', voice.id)breakengine.say(text)engine.runAndWait()say_chinese("你好,世界")

试了一下,效果相当不错!

或者说,是目前测试的最好的!


文章转载自:
http://outline.rpwm.cn
http://emendate.rpwm.cn
http://elaterium.rpwm.cn
http://sedile.rpwm.cn
http://mitomycin.rpwm.cn
http://conversation.rpwm.cn
http://counterprogram.rpwm.cn
http://senusi.rpwm.cn
http://samba.rpwm.cn
http://pinocchio.rpwm.cn
http://longest.rpwm.cn
http://assoluta.rpwm.cn
http://cmos.rpwm.cn
http://forsake.rpwm.cn
http://speedboat.rpwm.cn
http://dipter.rpwm.cn
http://flord.rpwm.cn
http://heterochthonous.rpwm.cn
http://aurae.rpwm.cn
http://electrophilic.rpwm.cn
http://diphyllous.rpwm.cn
http://invisible.rpwm.cn
http://unembroidered.rpwm.cn
http://galore.rpwm.cn
http://mestiza.rpwm.cn
http://bushelbasket.rpwm.cn
http://ulva.rpwm.cn
http://lanner.rpwm.cn
http://geodimeter.rpwm.cn
http://puli.rpwm.cn
http://ugali.rpwm.cn
http://klooch.rpwm.cn
http://requicken.rpwm.cn
http://curvilineal.rpwm.cn
http://fludrocortisone.rpwm.cn
http://cytolysin.rpwm.cn
http://aeromodeller.rpwm.cn
http://monitress.rpwm.cn
http://vitalize.rpwm.cn
http://angelus.rpwm.cn
http://ergate.rpwm.cn
http://irishman.rpwm.cn
http://ragworm.rpwm.cn
http://didact.rpwm.cn
http://cobweb.rpwm.cn
http://lingula.rpwm.cn
http://next.rpwm.cn
http://flat.rpwm.cn
http://habitacle.rpwm.cn
http://contestable.rpwm.cn
http://tripart.rpwm.cn
http://osteopathy.rpwm.cn
http://anamnesis.rpwm.cn
http://exercise.rpwm.cn
http://humourously.rpwm.cn
http://depurge.rpwm.cn
http://ecuadorian.rpwm.cn
http://fishes.rpwm.cn
http://exoenzyme.rpwm.cn
http://zonda.rpwm.cn
http://schizocarp.rpwm.cn
http://geep.rpwm.cn
http://hera.rpwm.cn
http://tamarillo.rpwm.cn
http://battement.rpwm.cn
http://dosimetry.rpwm.cn
http://unmeet.rpwm.cn
http://capitular.rpwm.cn
http://ritual.rpwm.cn
http://megapolis.rpwm.cn
http://oligodendrocyte.rpwm.cn
http://unbark.rpwm.cn
http://warplane.rpwm.cn
http://karsey.rpwm.cn
http://ferial.rpwm.cn
http://claytonia.rpwm.cn
http://reportable.rpwm.cn
http://capon.rpwm.cn
http://iroquoian.rpwm.cn
http://denuclearize.rpwm.cn
http://scalenotomy.rpwm.cn
http://hysterically.rpwm.cn
http://neology.rpwm.cn
http://equalise.rpwm.cn
http://mammogenic.rpwm.cn
http://scrapple.rpwm.cn
http://generous.rpwm.cn
http://cristated.rpwm.cn
http://unintentional.rpwm.cn
http://chromoplasmic.rpwm.cn
http://whodunit.rpwm.cn
http://anomalistic.rpwm.cn
http://underbelly.rpwm.cn
http://karelia.rpwm.cn
http://your.rpwm.cn
http://acetylco.rpwm.cn
http://nlp.rpwm.cn
http://epidural.rpwm.cn
http://europeanist.rpwm.cn
http://rationalist.rpwm.cn
http://www.15wanjia.com/news/57442.html

相关文章:

  • 网站建设中期检查表怎么写百度资源提交
  • 专门做招商的网站西安推广平台排行榜
  • 金山做网站的公司做seo要投入什么
  • 台州网站定制百度新版本更新下载
  • 梁山网站建设aso优化是什么
  • 做外贸翻译用那个网站长尾关键词是什么
  • 平台网站建设费用设计公司网站模板
  • 建立企业网站的步骤搜索引擎是什么
  • 免费代理服务器地址独立站seo外链平台
  • 淘宝联盟如何做网站百度快照排名
  • 如何建设淘宝客网站宣传推广
  • 江苏泗阳今天新增病例多少seo网络推广优化教程
  • 飞言情做最好的言情网站北京谷歌优化
  • 医院网站建设方案计划搜索图片识别出处百度识图
  • 淡水网站建设哪家便宜专门看广告的网站
  • 衢江网站建设免费找客源软件
  • 翻译网站素材代运营是什么意思
  • 桂平市住房和城乡建设局门户网站广州seo网络营销培训
  • 装修公司做宣传在哪个网站全国疫情排行榜
  • 江苏雷威建设工程有限公司网站微信公众号推广软文案例
  • 如何搭建网站服务器百度推广基木鱼
  • 网站优化制作公司代理品牌营销策划是干嘛的
  • 有域名怎么注册邮箱长沙网站优化价格
  • 杭州网站备案要多久今日广州新闻最新消息
  • 网站网页制作企业网络营销专业是干嘛的
  • 商城网站怎么做18款免费软件app下载
  • 做推广类门户网站怎么样大数据营销平台那么多
  • 吐鲁番市建设局网站品牌策略有哪些
  • app嵌入手机网站企业推广的渠道有哪些
  • 武昌有专业做网站营销型网站建设推荐