首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用freetts在java中使用文本到语音

使用freetts在java中使用文本到语音
EN

Stack Overflow用户
提问于 2016-01-11 14:37:25
回答 1查看 7.5K关注 0票数 1

我使用freetts文件作为文本到语音。但我需要更多像印度英语这样的声音。

我的代码是:

代码语言:javascript
复制
  import com.sun.speech.freetts.Voice;
  import com.sun.speech.freetts.VoiceManager;

 class s
 {

     VoiceManager freettsVM;
     Voice freettsVoice;
     private Voice voice;
     public s(String voiceName) 
     {
          VoiceManager voiceManager = VoiceManager.getInstance();
           voice = voiceManager.getVoice(voiceName);
      }
      public void speak(String msg) {
          freettsVoice.allocate();
          freettsVoice.speak(msg);
          freettsVoice.deallocate();
      }
 }
 public class Main {
    public static void main(String[] args) {
    String speekstring = txtmassage.getText();
            s t = new s("kevin16");
            t.speak(speekstring);}
 }

这是正确的工作但我需要更多的声音。

现在我把我的代码改为

那么错误是

代码语言:javascript
复制
 Could not validate any MBROLA voices at

  C:/Users/anand/Documents/NetBeansProjects/mbrola

  Make sure you FULLY specify the path to
  the MBROLA directory using the mbrola.base
  system property.

  Exception in thread "main" java.lang.NullPointerException
          at newpro.TestTTS.<init>(TestTTS.java:20)
         at newpro.TestTTS.main(TestTTS.java:29)
  Java Result: 1
  BUILD SUCCESSFUL (total time: 0 seconds)
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-01-11 15:05:46

您可以使用MBROLA -项目。它是免费的,并提供多种语言。

您需要下载项目包本身和声音。

有关如何安装和使用MBROLA的一步一步的指南,您可以访问以下内容:

https://stackoverflow.com/a/26236563/1368690

或者转到项目页面本身:

http://tcts.fpms.ac.be/synthesis/mbrola.html

当你向下滚动一点,有很多声音你可以测试,看看它们是否会对你有用。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34724104

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档