没有的FreeTTS音频Linux操作系统Ubuntu - 没有错误 [英] FreeTTS no audio linux ubuntu - no errors

查看:658
本文介绍了没有的FreeTTS音频Linux操作系统Ubuntu - 没有错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Java 6的运行Ubuntu 10.10并不能得到的FreeTTS输出任何音频。现在我已经尝试过了3台不同的计算机,甚至问我的一个朋友尝试一下Ubuntu的自己的PC上和他有同样的问题。有没有是绝对被显示,得到了MBROLA我甚至不再获得有关未检测到MBROLA声音警告后,错误。等等等等等等..

I am running Ubuntu 10.10 using Java 6 and can not get FreeTTS to output any audio. I have tried it now on 3 different computers and even asked a buddy of mine to try it on his Ubuntu PC and he had the same problem. There is absolutly no errors that are displayed, after getting the MBROLA i no longer even get the warning about No MBROLA voices detected. blah blah blah..

使用我跑了一个虚拟的盒子,并启动了Windows XP在同一台计算机,我其实是能够运行的HelloWorld.jar时得到的音频和不过TTSHelloWorld.jar的freetts.jar仍然是沉默的,当我尝试输入我自己的文本

Using the same computer I ran a virtual box and started Windows XP, i was actually able to get audio when running the HelloWorld.jar and TTSHelloWorld.jar however the freetts.jar is still silent when I try to input my own text.

命令我使用。

Java的罐子的lib / freetts.jar -text您好

java -jar lib/freetts.jar -text Hello

当我打输入启动,并经常给我失踪MBROLA警告消息,但现在它只是坐在那里,直到我CTRL-C停止它。

When I hit enter it starts up and used to give me the missing MBROLA warning message but now it just sits there until i CTRL-C to stop it.

我不明白我在做什么错,为什么没有其他人有这个问题,当我经验研究它的每一台计算机上,以及它的工作原理有点在Windows上。谁能帮我?

I dont understand what I am doing wrong and why nobody else is having this problem, when I expierence it on every computer, well it works somewhat on Windows. Can anyone Help me?

谢谢,

约翰

推荐答案

我是谁一直在努力使有关的FreeTTS其Ubuntu的工作一个星期的学生。最后我找到了答案在这里:非常感谢你hakvroot

I am a student who has been trying to make FreeTTS working on its Ubuntu for one week. And finally I found the answer here : thank you so much hakvroot !

您的答案是完美的,但你没有把你的实现,这花了相当长一个小时了解在JavaStreamingAudioPlayer类是怎么回事。为了帮助其他人喜欢我,谁没有在跳水在一个完全未知的Java code使用(我还是一个学生),我会把我在这里code和希望这将帮助其他人:)

Your answer was perfect but you did not put your implementation and this took me quite one hour to understand what was going on in the JavaStreamingAudioPlayer class. To help the other people like me who are not used in "diving" in a completely unknown Java code (I am still a student), I will put here my code and hope it will help other people :) .

首先,更详细的解释:围绕线152,JavaStreamingAudioPlayer打开线路。然而,该操作可能需要一些时间,所以在使用它之前,它要检查它被打开。在当前的实施中,所使用的解决方案是创建一个LineListener听这条线,然后睡(使用等待()的螺纹的方式)。

First, a more detailed explanation : around line 152, the JavaStreamingAudioPlayer opens a Line. However this operation can require some time so before using it, it wants to check it is opened. In the current implementation, the solution used is to create a LineListener listening to this line and then to sleep (using the wait() method of the threads).

该LineListener会唤醒使用notifyAll的主线程(),只有当它接收类型的LineEventOPEN,这将保证该行已经开通将做到这一点。

The LineListener will "wake up" the main Thread using a notifyAll() and will do this only when it receives a LineEvent of type "OPEN" which will guarantee that the line has been opened.

然而,由于由hakvroot这里说明的问题是,该通知从未因为被Ubuntu使用的DataLine的特定行为的发送。

However as explained by hakvroot here the problem is that the notification is never sent because of the specific behavior of the DataLine used by Ubuntu.

所以我删除了同步,wait()和notifyAll的()的code的部分,但作为hakvroot,然后打开之前你JavaStreamingAudioPlayer可能会尝试用你的是:你需要等待确认有新机制停止JavaStreamingAudioPlayer后来到唤醒它,当确认到了。

So I removed the synchronized, wait() and notifyAll() parts of the code but as hakvroot, then your JavaStreamingAudioPlayer might try to use your Line before it is opened : you need to wait for the confirmation with a new mechanism to stop the JavaStreamingAudioPlayer and to wake it up later, when the confirmation arrived.

所以我使用的信号灯这havkroot使用(请参阅此锁的系统上解释的Javadoc)与1堆栈启动:

So I used the Semaphore which havkroot used (see Javadoc for explanations on this lock system) initiated with 1 stack :


  • 在该行被打开它获得一个堆栈(所以0遗体)

  • when the line is opened it acquires one stack (so 0 remains)

当它要利用它试图收购另一行(所以它已停止)

when it wants to use the line it tries to acquire another (so it is stopped)

在听者得到我们正在寻找的事件时,它释放信号量

when the listener gets the event we are looking for, it releases the semaphore

这将释放JavaStreamingAudioPlayer谁可以去下一部分

this frees the JavaStreamingAudioPlayer who can go for the next part

不要忘了再次释放信号量,因此又有1栈下一行打开

do not forget to release again the semaphore so it has again 1 stack for the next line to open

这是我的code:

声明一个信号变量:

private Semaphore hackSemaphore;

启动它的构造器:

Initiate it in the constructor :

hackSemaphore = new Semaphore(1);

然后第一部分更换(见hakvroot看到哪里把它):

Then the first part to replace (see hakvroot to see where to put it) :

            line = (SourceDataLine) AudioSystem.getLine(info);
            line.addLineListener(new JavaStreamLineListener());

            line.open(format, AUDIO_BUFFER_SIZE);
            hackSemaphore.acquire(); 
            hackSemaphore.acquire(); 
            opened = true;
            hackSemaphore.release();

和第二部分:

    public void update(LineEvent event) {
        if (event.getType().equals(LineEvent.Type.OPEN)) {
            hackSemaphore.release();
        }
    }

这篇关于没有的FreeTTS音频Linux操作系统Ubuntu - 没有错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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