FreeTTS 挂在 ColdFusion 8 / Java 中
我正在考虑设置一个文本转语音翻译器,以使我们的验证码挑战符合 ADA 标准。我们是一家 ColdFusion 商店,Ray Camden 去年已经对此进行了概念验证。我一直在这里使用他的博客文章 - http://www.coldfusionjedi.com/index.cfm/2009/5/29/Generate-Speech-with-ColdFusion-and-Java - 作为资源。
那里的一切都工作得很好......除了 FreeTTS 应该工作的部分。我有以下代码:
<cfset jardir = expandPath("freetts-1.2.2-bin/freetts-1.2/lib") />
<cfset jars = [] />
<cfdirectory name="jarList" directory="#jardir#" />
<cfloop query="jarList">
<cfset ArrayAppend(jars, jardir & "/" & name) />
</cfloop>
<cfset loader = createObject("component", "javaloader.JavaLoader").init(jars) />
<cfset voiceManager = loader.create("com.sun.speech.freetts.VoiceManager") />
<cfset vm = voiceManager.getInstance() />
<cfset voice = vm.getVoice("kevin16") />
<cfset voice.allocate() />
<!--- <cfset voice.speak("Hi.") /> --->
<cfset voice.deallocate() />
就这样,它运行良好,我可以在释放后(甚至在分配后)cfdump 语音对象。因此,您可以知道依赖项位于正确的位置,并且 ColdFusion 正在正确实例化所有内容。但是一旦我取消对 talk() 调用的注释,测试脚本就会挂在该方法上。
迹象表明某些服务器配置问题是这里的罪魁祸首,但我一生都无法想象它会是什么。 (顺便说一句,我们正在使用 ColdFusion 8.01。)如果有人能够提供一些额外的见解来解释为什么 FreeTTS 会出现这样的错误行为,我将非常感激。
更新:这似乎是一个更普遍的 Java 问题。 ColdFusion 的 JRUN 日志显示当服务器开始挂起时抛出以下错误:
Exception in thread "Thread-667" java.lang.IllegalArgumentException: No line matching interface SourceDataLine supporting format PCM_SIGNED 8000.0 Hz, 16 bit, mono, 2 bytes/frame, big-endian is supported.
此外,如果我尝试从命令行运行开箱即用的 FreeTTSHelloWorld.jar (java -jar bin/FreeTTSHelloWorld.jar
),Java 将挂起,我们必须使用 ^C 强制退出。
I'm looking into setting up a text-to-speech interpreter to make our CAPTCHA challenges ADA compliant. We're a ColdFusion shop, and Ray Camden's already done the proof of concept for this last year. I've been using his blog post here - http://www.coldfusionjedi.com/index.cfm/2009/5/29/Generating-Speech-with-ColdFusion-and-Java - as a resource.
Everything there works great... except for the part where FreeTTS is supposed to work. I've got the following code:
<cfset jardir = expandPath("freetts-1.2.2-bin/freetts-1.2/lib") />
<cfset jars = [] />
<cfdirectory name="jarList" directory="#jardir#" />
<cfloop query="jarList">
<cfset ArrayAppend(jars, jardir & "/" & name) />
</cfloop>
<cfset loader = createObject("component", "javaloader.JavaLoader").init(jars) />
<cfset voiceManager = loader.create("com.sun.speech.freetts.VoiceManager") />
<cfset vm = voiceManager.getInstance() />
<cfset voice = vm.getVoice("kevin16") />
<cfset voice.allocate() />
<!--- <cfset voice.speak("Hi.") /> --->
<cfset voice.deallocate() />
As this is, it runs fine and I can cfdump the voice object after the deallocate (or even after the allocate). So, from that you know the dependencies are in the right place and ColdFusion is instantiating everything correctly. But as soon as I uncomment the call to speak(), the test script will hang on that method.
Signs point to some server configuration issue being the culprit here, but for the life of me I can't think of what it would be. (We're using ColdFusion 8.01, by the by.) If anyone could provide some additional insight into why FreeTTS would be misbehaving like this, I'd be much appreciative.
Update: This appears to be a more general Java issue. ColdFusion's JRUN log is showing the following error being thrown as the server starts to hang:
Exception in thread "Thread-667" java.lang.IllegalArgumentException: No line matching interface SourceDataLine supporting format PCM_SIGNED 8000.0 Hz, 16 bit, mono, 2 bytes/frame, big-endian is supported.
Further, if I try to run FreeTTSHelloWorld.jar out of the box from the command line (java -jar bin/FreeTTSHelloWorld.jar
), Java will hang and we'll have to force-quit with ^C.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你有声卡吗?尝试(来自 ray 的同一篇文章)将文件写入磁盘。
Do you have a sound card? Try ( from the same post from ray ) writing the file to disk.