简单语音测试(TTS)接口库,支持多种语言和多引擎。

talke的Python项目详细描述


简单文本到语音(TTS)接口库,支持多种语言和多引擎。

https://travis-ci.org/grigi/talkey.svghttps://coveralls.io/repos/grigi/talkey/badge.svg?branch=master&service=github

文档:http://talkey.readthedocs.org/

基本原理

我对jasper的概念非常感兴趣,jasper是一个语音控制接口。 我需要它像我一样多语种,所以这个图书馆是我的尝试 多语种TTS引擎。这段代码的很多灵感来自jasper项目。

基本用法

从pypi安装:

pip install talkey

在最简单的用例中:

importtalkeytts=talkey.Talkey()tts.say('Old McDonald had a farm')

如果出现talkey.base.TTSError: No supported languages错误,则表示没有安装受支持的tts引擎。请看下面。

默认情况下,它将尝试查找并使用以下TTS引擎的本地实例:

  • 飞行
  • 斯沃克斯皮科
  • 节日
  • 埃斯皮克
  • mbrola via espeak

安装其中一个或多个引擎应允许libary运行并生成语音。

它还支持以下联网的TTS引擎:

  • Marytts(需要托管)
  • 谷歌TTS(云托管)

为了获得最佳效果,您应该对其进行配置:

importtalkeytts=talkey.Talkey(# These languages are given better scoring by the language detector# to minimise the chance of it detecting a short string completely incorrectly.# Order is not important herepreferred_languages=['en','af','el','fr'],# The factor by which preferred_languages gets their score increased, defaults to 80.0preferred_factor=80.0,# The order of preference of using a TTS engine for a given language.# Note, that networked engines (Google, Mary) is disabled by default, and so is dummy# default: ['google', 'mary', 'espeak', 'festival', 'pico', 'flite', 'dummy']# This sets eSpeak as the preferred engine, the other engines may still be used#  if eSpeak doesn't support a requested language.engine_preference=['espeak'],# Here you segment the configuration by engine# Key is the engine SLUG, in this case ``espeak``espeak={# Specify the engine options:'options':{'enabled':True,},# Specify some default voice options'defaults':{'words_per_minute':150,'variant':'f4',},# Here you specify language-specific voice options# e.g. for english we prefer the mbrola en1 voice'languages':{'en':{'voice':'english-mb-en1','words_per_minute':130},}})tts.say('Old McDonald had a farm')

安装TTS发动机

ubuntu/debian:

节日:

sudo apt-get install festival

对于飞行物:

sudo apt-get install flite

对于SVox Pico:

sudo apt-get install libttspico-utils

对于espeak:

sudo apt-get install espeak

对于mbrola和en1语音:

sudo apt-get install mbrola-en1

窗口:

安装espeak:

Go to http://espeak.sourceforge.net/download.html and download and install ^{tt2}$

对于mbrola及其声音:

Go to http://espeak.sourceforge.net/mbrola.html and download and install ^{tt3}$ and follow directions to install voices from http://www.tcts.fpms.ac.be/synthesis/mbrola/mbrcopybin.html

对于google tts:

install python package gTTS

Download ffmpeg from http://ffmpeg.zeranoe.com/builds/

Extract with 7Zip, and add the bin folder to the PATH.

e.g.:
extract to C:ffmpeg and add C:ffmpegbin to the PATH

(In cmd.exe you should be able to just run ffmpeg and see it showing information, then it is working right)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何按顺序显示父节点属性值和关联的子节点属性值?   java Zip 2在Spring Webfux中的不同Mono   java Twitter oauth_签名创建   SpringBoot中未标识java自定义依赖项   如何使用Java访问netbeans中的json Post方法值   在Java中查找数字的位数之和   java Hibernate使用date where子句过滤单列数据   java Spring@ExceptionHandler未捕获AccessDeniedException   java如何知道bean是否有一些值   javavaadin谷歌描述   javafx如何修复“java未命名模块从y和z读取程序包x”   Java generictyped方法返回错误的类型   java Android从应用程序发送电子邮件崩溃电子邮件强制关闭   Java与C版本的相同算法   Java编程异常   java动态生成收据   java使用ACRCloud将音频记录保存在文件中   java在注册到web应用程序后激活帐户   Java数组删除最后存储的元素