Speak.js中的女声 [英] Female voice in Speak.js

查看:1561
本文介绍了Speak.js中的女声的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用speak.js库进行文本语音转换。我们需要通过本地化实现女性声音。
我们将其发言功能称为 meSpeak.speak('Hello Thomas); 但是我们无法用女性的声音来表达它。
我们观察到我们需要传递一些arg作为参数但是也不能传递它。
你能指导我如何使用speak.js lib获得女声?

We are using speak.js library for Text to speech purpose. And we need to implement female voice with localization in this. We are calling its speak function as meSpeak.speak('Hello Thomas"); but we could not able to make it's op in female voice. We have observed that we need to pass some arg as parameter but not able to pass this too. Can you please guide how can i get female voice op using speak.js lib ?

非常感谢提前

推荐答案

假设你在谈论mespeak.js:

Supposing you're talking about mespeak.js:

http://www.masswerk.at/mespeak下载最新版本

使用所选语言复制一个语音文件(json)并在编辑器中打开它。

Make a copy of a voice-file (json) in the language of choice and open it in an editor.

语音文件具有以下结构:

The voice-files are of the following structure:

{
  "voice_id": "<filename>",
  "dict_id":  "<filename>",
  "dict":     "<base64-encoded octet stream>",
  "voice":    "<base64-encoded octet stream>"
}

首先,提供唯一的voice_id(例如en-us-f,ids实际上是unix-filenames。)

First, provide a unique "voice_id" (e.g. "en-us-f", the ids are actually unix-filenames).

编码的语音数据实际上是一个文本文件,可以在eSpeak的数据目录中找到(参见 http://espeak.sourceforge.net/ )。虽然文件表示为base64编码的八位字节流,但您也可以通过提供另一个属性voice_encoding来使用文本字符串:

The encoded voice data is actually a text-file to be found in eSpeak's data-directory (see http://espeak.sourceforge.net/). While the files are represented as base64-encoded octet-streams, you may also use a text-string for this by providing another property "voice_encoding":

{
  "voice_id": "<filename>",
  "dict_id":  "<filename>",
  "dict":     "<base64-encoded octet stream>",
  "voice":    "<text-string>",
  "voice_encoding": "text"
}

现在,参考声音的eSpeak数据和eSpeak-docs,您可以找到声音en-us的以下文字:

Now, referring to the eSpeak-data and the eSpeak-docs for voices, you may find the following text for the voice "en-us":

// moving towards US English
name english-us
language en-us 2
language en-r
language en 3
gender male
[and more]

删除第一行中的评论,编辑名称(我们希望这是唯一的)并最终更改性别,您将到达:

by removing the comment in the first line, editing the name (we want this to be unique) and finally changing the gender, you'll arrive at:

name english-us-f
language en-us 2
language en-r
language en 3
gender female

将所有换行符替换为\ n以获取一个有效的JSON字符串:

Replace any line-breaks by "\n" to get a valid JSON-string:

"name english-us-f\nlanguage en-us 2\nlanguage en-r\nlanguage en 3\ngender female"

并使用此值作为属性的值语音。
保存文件并将其加载到meSpeak。

and use this as the value of the property "voice". Save your file and load it into meSpeak.

您可以根据eSpeak-Docs微调语音: http://espeak.sourceforge.net/voices.html

You may fine-tune the voice according to the eSpeak-Docs: http://espeak.sourceforge.net/voices.html

(另一种方法是保存一个普通的eSpeak语音文件,并将其内容编码为base64-string,并将其用作语音的值。在这种情况下,你不会设置voice_encoding属性。使用纯文本可能是更适合测试。)

(An alternate way would involve saving a plain eSpeak-voice file and encoding its content as base64-string and using this as a value for "voice". In this case you would not set the "voice_encoding" property. Using plain-text might be more suitable for testing.)

希望这会有所帮助(它不会比这更容易)。

Hope this helps (it won't get easier than this).

NL

编辑:请注意,任何格式错误的语音字符串都会导致(m)eSpeak出错。 (eSpeak在语法错误方面并不优雅,但会抛出类型错误 - 由meSpeak作为控制台日志处理。请记住,meSpeak的核心只是emspepten生成的eSpeak端口。所以它不会更好地处理语音文件。)

Please mind that any malformed voice-string will cause an error in (m)eSpeak. (eSpeak is not gracious on syntax errors, but will throw a "type-error" – which is handled as a console-log by meSpeak. Keep in mind that the core of meSpeak is just an Emscripten-generated port of eSpeak. So it doesn't handle voice-files any better.)

编辑:这个(扩展)版本现在是meSpeak文档的一部分: http://www.masswerk.at/mespeak/voices-and-languages.html

An (extended) version of this is now part of the meSpeak-documentation: http://www.masswerk.at/mespeak/voices-and-languages.html

这篇关于Speak.js中的女声的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆