程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Pythons third-party library pyttsx3

編輯:Python

pyttsx3's official website address on pypi is https://pypi.org/project/pyttsx3/

The documentation address of the pyttsx3 project: https://pyttsx3.readthedocs.io/en/latest/

pyttsx3 is a text-to-speech library in Python that, unlike other libraries, works offline and is compatible with both Python 2 and 3.

The sample code is as follows:

import pyttsx3engine = pyttsx3.init()"""Language rate"""rate = engine.getProperty('rate') # Get the current speech rate, the default is 200print (rate) # print the current speech rateengine.setProperty('rate', 100) # Set the new voice rate"""Volume level"""volume = engine.getProperty('volume') # Get the current volume level (min=0, max=1), the default is 1.0print (volume) # print the current volume levelengine.setProperty('volume',1) # set the new current 

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved