开发者

Can someone recommend me a TTS solution in PHP for a CentOs server? [closed]

开发者 https://www.devze.com 2023-01-07 13:47 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently acc开发者_如何学Goepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently acc开发者_如何学Goepting answers.

Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 8 years ago.

Improve this question

i own a translation service and now im wanting to implement a TTS solution. Do you know any software that can be executed from php to generate mp3s on the fly for a specific text?


If you are in an environment where you can make system calls, you could pipe the output of Festival into lame like so:

<?php
$infile = tempnam();
file_put_contents($input, 'My name is judge');

$outfile = "/path/to/output.mp3";
$cmd = "text2wave -f 22050 < {$infile} | lame --quiet --preset medium  - {$outfile}";

$output = $status = null;
exec($cmd, $output, $status);

If you want to do further processing as well as the conversion, you can pipe the output of text2wave to SoX instead, which can also do the conversion for you:

text2wave -f 22050 < input.txt | sox - output.mp3

The default Festival voice seems to be a bit pants though, so this article might be worth investigating, but I haven't actually tried it myself.

I know you aren't using ubuntu but for others who might find this answer helpful, there is a problem where even after you install all the "ugly" plugins, SoX still cannot output MP3 files. You have to manually dismantle the .deb and modify the debian/rules file to remove --without-lame from DEB_CONFIGURE_EXTRA_FLAGS.

0

精彩评论

暂无评论...
验证码 换一张
取 消