当前位置:   article > 正文

ekho 语音合成开源_ekho语音库

ekho语音库

1.ekho 介绍:

http://www.eguidedog.net/cn/ekho_cn.php​

2.安装以及依赖包安装

​2.1 依赖包安装

 yum install -y ncurses-devel libsndfile-devel espeak-devel pulseaudio-libs-devel 

​2.2 ekho 安装

tar xJvf ekho-xxx.tar.xz 

cd ekho-xxx 

 ./configure 

make && make install​

​3. 测试

ekho 你好 -o 1.mp3 

4.将文字转为语音并且网页播放PHP脚本

<?php

$text = $_GET['text'];

$volume = $pitch = $speed = 0;

$voice  = 'Mandarin';

if (isset($_GET['volumeDelta'])) {

if($_GET['volumeDelta'] >= -100 && $_GET['volumeDelta'] <=100 ){

$volume = $_GET['volumeDelta'];

}

}

if (isset($_GET['pitchDelta'])) {

if($_GET['pitchDelta'] >= -100 && $_GET['pitchDelta'] <=100 ){

$pitch = $_GET['pitchDelta'];

}

}

if (isset($_GET['speedDelta'])) {

if($_GET['speedDelta'] >= -50 && $_GET['speedDelta'] <=100 ){

$speed = $_GET['speedDelta'];

}

}

if (isset($_GET['voice'])) {

if($_GET['voice'] >= -100 && $_GET['voice'] <=100 ){

$voice = $_GET['voice'];

}

}

$filename = md5($text) . '.mp3';

$filepath = $base_dir . '/v' . $voice . 's' . $speed . 'p' . $pitch .

    'a' . $volume . 't' . $filename;

$text = escapeshellarg($text);

if (!file_exists($filepath)) {

$cmd = "ekho -s $speed -p $pitch -a $volume -v $voice  $text -o $filepath";

//$cmd = "ekho $text -o $filepath";

//print_r($cmd);exit;

  exec($cmd);

}

header('Content-Type: ');

header('Content-Length: ' . filesize($filepath));

readfile($filepath);

5​. 页面请求

​t.php?voice=Mandarin&speedDelta=0&pitchDelta=0&volumeDelta=0&text=你好

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/342214
推荐阅读
相关标签
  

闽ICP备14008679号