luudoanh/text-to-speech

There is no license information available for the latest version (1) of this package.

A class converts text files into audio files

1 2019-06-30 06:23 UTC

This package is auto-updated.

Last update: 2025-06-09 18:23:37 UTC


README

  • This is a basic class that allows you to convert text content into audio (mp3) files, via a google translate. (EN).
  • Đây là một lớp đơn giản giúp bạn có thể chuyển đổi nội dung của file văn bản (text) thành file âm thanh (mp3), thông qua goiogle translate (VI).

Installation

With 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

Without Composer

If you don't use composer. Download the Text To Speech latest release and put the contents of the ZIP archive into a directory in your project.

<?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

Support Language

I'm not sure, but it works well with English and Vietnamese