问题描述
在具有FreeTTS的Java程序中使用MBROLA语音...
我正在使用简单的程序。我已经决定使用FreeTTS,但声音并不是我正在想的,而且我正在寻求使用一个女性的声音。所以我开始环顾四周,并决定使用MBROLA来改变我的文字转语音节目的声音。
I am working on a simple text-to-speech program in Java. I have decided to use FreeTTS, but the voices are not really what I was thinking, and I was looking to use a female voice anyway. So I started looking around, and decided that I would use MBROLA to change the voice of my text-to-speech program.
我读了 FreeTTS可以使用MBROLA语音 ,但是我搜索到无处不在,找不到如何设置MBROLA的清晰指南,以及需要哪些文件。有许多MBROLA论坛与FreeTTS一起工作,但也似乎没有人知道他们在做什么。
I read that "FreeTTS can use MBROLA voices", but I searched everywhere and couldn't find a clear guide how to set MBROLA up, and what files are needed to do so. There are many forums on MBROLA working alongside FreeTTS, however it also seems that none of the people have any idea what they are doing.
所以问题: / strong>
So the questions:
- 需要下载什么文件?
- 使用MBROLA语音的简单FreeTTS示例?
- What files need to be downloaded?
- Steps to include these into my program?
- Simple FreeTTS example using MBROLA voices?
推荐答案
上述问题的答案
1。什么文件需要下载?
1. What files need to be downloaded?
- FreeTTS (freeTTS 1.2.2-bin) -
- MBROLA zip文件夹
- 语音可以在
- FreeTTS with all the libraries (freeTTS 1.2.2-bin) - download here
- MBROLA zip folder mbr301d.zip
- Voices which can be found on the MBROLA website
1.1 FreeTTS 库(在freetts-1.2.2-bin / freetts-1.2 / lib中找到):
- cmu_time_awb.jar
- cmu_us_kal.jar
- cmudict04.jar
- cmulex.jar
- cmutimelex.jar
- en_us.jar
- freetts.jar
- freetts-jsapi10.jar
- mbrola.jar
- cmu_time_awb.jar
- cmu_us_kal.jar
- cmudict04.jar
- cmulex.jar
- cmutimelex.jar
- en_us.jar
- freetts.jar
- freetts-jsapi10.jar
- mbrola.jar
1.2 T他 MBROLA zip文件夹将包括:
1.2 The MBROLA zip folder will include:
- mbrola.exe
- mbr302a
- readme.txt
1.3 语音是压缩文件夹,其中包含名为 us1 或 af1 的单个文件夹。
1.3 The Voices are zipped folders that include a single folder named 'us1' or 'af1' etc.
2。步骤包括这些到我的程序?
2. Steps to include these into my program?
注意我有也安装在我的电脑上,但我不确定它是否对程序有影响,但我怀疑它不。编辑:我已经测试过看看MBROLA工具包是否需要与FreeTTS一起运行MBROLA,并且证明不需要。
NOTE: I had the MBROLA Tooklit installed on my computer too, however I am unsure whether it has an impact on the program, but I suspect that it doesn't. I have tested to see whether the MBROLA toolkit is needed to run MBROLA alongside FreeTTS, and it turns out that it is not needed.
- 提取freetts-1.2.2-bin
- 将库复制到项目中并包含在构建路径中
- 解压缩mbr301d.zip文件夹
-
- 将'mbr301d'重命名为'mbrola'
- 将声音解压缩到名为mbrola的文件夹
- Extract freetts-1.2.2-bin
- Copy the libraries to your project and include in build path
- Unzip the mbr301d.zip folder
- Rename 'mbr301d' to 'mbrola'
- Unzip the voices to the folder you named 'mbrola'
完成之后,您的mbrola文件夹应如下所示:
After this is done, your mbrola folder should look like this:
- [mbr302a] - 文件夹
- [us1] - 文件夹(名称取决于您下载的语言)
- mbrola.exe - 文件
- readme.txt - 文件
- [mbr302a] - folder
- [us1] - folder (name depends on the language you downloaded)
- mbrola.exe - file
- readme.txt - file
您可以将所有语言都放在此文件夹中,只需从Java程序中调用。
You can place all your languages in this folder, and they will just be called from your Java program.
3。简单的FreeTTS示例使用MBROLA语音?
3. Simple FreeTTS example using MBROLA voices?
我看到很多人收到此错误:
I've seen many people get this error:
System property "mbrola.base" is undefined. Will not use MBROLA voices.
mbrola.base
指的是你的mbrola文件位于您的计算机上,并且没有将属性指向正确的位置,您将收到此错误。
The mbrola.base
refers to where your mbrola files are located on your computer, and without the property being pointed to the correct location, you will recieve this error.
对于获取的NON-MBROLA用户这个错误:如果您只使用FreeTTS,只需从引用的库中删除mbrola.jar
To NON-MBROLA users who get this error: Simply remove the mbrola.jar from your referenced libraries if you're only using FreeTTS
设置 mbrola。使用
To set the mbrola.base
property, use:
System.setProperty("mbrola.base", "C:/Path/to/your/mbrola")
以下是一个简单的例子, FreeTTS程序。请注意,上述步骤必须在此之前完成。如果基础未设置,只需将语音名称更改为mbrola_us1即可。
Below is a simple Example to use the MBROLA voices in your FreeTTS program. Note that the steps above must be done before this will work. Simply changing the name of the voice to "mbrola_us1" will not work if the base isn't set!
package com.madmob.test;
import com.sun.speech.freetts.Voice;
import com.sun.speech.freetts.VoiceManager;
public class TestTTS {
VoiceManager freettsVM;
Voice freettsVoice;
public TestTTS(String words) {
// Most important part!
System.setProperty("mbrola.base", "C:/mbrola");
freettsVM = VoiceManager.getInstance();
// Simply change to MBROLA voice
freettsVoice = freettsVM.getVoice("mbrola_us1");
// Allocate your chosen voice
freettsVoice.allocate();
sayWords(words);
}
public void sayWords(String words) {
// Make her speak!
freettsVoice.speak(words);
}
public static void main(String [] args) {
new TestTTS("Hello there! Now M BROLA and Free T T S work together!");
}
}
MBROLA和FreeTTS现在应该在一起工作!这段代码是从我的电脑上复制出来的,并在被放在这里之前进行测试。
MBROLA and FreeTTS should now be working together! This code was copied right from my computer and has been tested before putting it down here.
这篇关于MBROLA语音与FreeTTS - Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!