luudoanh/text-to-speech

该包的最新版本(1)没有可用的许可信息。

一个类可以将文本文件转换为音频文件

1 2019-06-30 06:23 UTC

This package is auto-updated.

Last update: 2024-09-09 16:48:46 UTC


README

  • 这是一个基本类,允许您通过Google翻译将文本内容转换为音频(mp3)文件。(英文)
  • 这是一个简单的类,可以帮助您将文本文件(text)转换为音频(mp3)文件,通过使用谷歌翻译(越南文)。

安装

使用Composer

$ composer require luudoanh/text-to-speech
<?php

require_once __DIR__.'/vendor/autoload.php';

use \App\TextToSpeechBasic;
$tts = new TextToSpeechBasic();
$config = array(
	'tl' => 'en', // Example: en => English, vi => Vietnamese
	'ie' => 'UTF-8', // The language character set you want to convert.
	'client' => 'tw-ob' // Constant
);
// Config settings
$tts->_setting($config);
// $file_path path to text file.
// $folder_save folder save audio file
echo $tts->TTS($file_path, $folder_save);
// return  Successful! is completed

不使用Composer

如果您不使用composer,请下载Text To Speech的最新版本,并将ZIP存档的内容放入项目的目录中。

<?php
require_once __DIR__.'/src/TextToSpeechBasic.php';
use \App\TextToSpeechBasic;
$tts = new TextToSpeechBasic();
$config = array(
	'tl' => 'en', // Example: en => English, vi => Vietnamese
	'ie' => 'UTF-8', // The language character set you want to convert.
	'client' => 'tw-ob' // Constant
);
// Config settings
$tts->_setting($config);
// $file_path path to text file.
// $folder_save folder save audio file
echo $tts->TTS($file_path, $folder_save);
// return  Successful! is completed

支持的语言

我不确定,但与英语和越南语兼容良好