gpt4 book ai didi

text-to-speech - 使用 JSAPI 将文本转换为语音时排查 "System property mbrola.base is undefined. Will not use MBROLA voices"问题

转载 作者:行者123 更新时间:2023-12-02 08:57:16 31 4
gpt4 key购买 nike

我收到以下错误:

System property "mbrola.base" is undefined.  Will not use MBROLA voices.
import javax.speech.*;
import javax.speech.synthesis.*;
import java.util.Locale;

public class HelloWorld
{

public static void main(String args[])
{

try
{
// Create a synthesizer for English

Synthesizer synth = Central.createSynthesizer(
new SynthesizerModeDesc(Locale.ENGLISH));

// Get it ready to speak

synth.allocate();

synth.resume();

// Speak the “Hello world” string

synth.speakPlainText("Hello", null);

// Wait till speaking is done

synth.waitEngineState(Synthesizer.QUEUE_EMPTY);

// Clean up

synth.deallocate();

}
catch (Exception e)
{
e.printStackTrace();
}

}

}

最佳答案

对于那些仍在为这个问题苦苦挣扎的人,以下是我如何让它在 Windows 上使用普通记事本运行,不涉及 Eclipse。

  1. 我去了http://tcts.fpms.ac.be/synthesis/mbrola.html并在二进制语音下载下下载了2个包:PC/Windows 和 PC/DOS

  2. 将其全部解压并将 PC/Windows 二进制文件放在与 PC/DOS 可执行文件 mbrola.exe 相同的目录中。请注意 mbrola.exe 对我不起作用,因为它是 16 位的(看图!),但我找到了这个链接:

    http://sourceforge.net/projects/freetts/forums/forum/137669/topic/1219083
    其中有一个包含 2 个二进制文件的 zip 文件,其中一个是 2004 年的,似乎可以在我的 64 位 Windows 上运行。

  3. 然后我在 mbrola 网站上下载了上面第 1 节中的声音想要一个女声,所以我捕获了 us1 并将整个文件夹放入与
    相同的目录中上述 PC/Windows 二进制文件和 PC/DOS 可执行文件。

  4. 在代码中我指定了以下内容:System.setProperty("mbrola.base", "C:\devsrc\main\Head-Rev\src\java\freetts-1.2\mbrola");voice=vm.getVoice("mbrola_us1");

我得到了我的女声。我不需要任何编译或运行时标志。

希望这对某人有帮助。

关于text-to-speech - 使用 JSAPI 将文本转换为语音时排查 "System property mbrola.base is undefined. Will not use MBROLA voices"问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3976152/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com