Exemple #1
0
 public function __construct(Language $language, DataProvider $dataProvider)
 {
     self::$instance = $this;
     $this->language = $language;
     $this->dataProvider = $dataProvider;
     $this->getVoices();
     //Initialise
 }
Exemple #2
0
 /**
  * Checks if a voice is compatible with the language
  *
  * @return bool
  */
 public function useable()
 {
     $required = PUTTS::getInstance()->getLanguage()->getRequired();
     foreach ($required as $audio) {
         if (!$this->existsVoiceFile($audio)) {
             return false;
             break;
         }
     }
     return true;
 }
Exemple #3
0
<?php

/*
 * This is an example file.
 * You can edit the constants below
 * to generate your personalised Audio.
 *
 * Run this script with the Command Line.
 * A file with the name "output.wav" will be created
 * in the same folder It will be overwritten if it exists.
 */
ini_set("date.timezone", "CET");
echo "Enter a string >>> ";
$window = fopen("php://stdin", "r");
$string = str_replace("\n", "", strtolower(fread($window, 20000)));
fclose($window);
//Options
define("USE_VOICE", "Niki");
define("TALK_STRING", $string);
echo "Speaking '" . $string . "'....\n";
include "DataProvider.php";
include "DataProvider/Wav.php";
include "PUTTS.php";
include "Voice.php";
include "Language.php";
include "Languages/de_DE.php";
$putts = new PUTTS(new de_DE(), new Wav());
//Set language and data-provider
file_put_contents("output.wav", PUTTS::getVoice(USE_VOICE)->speakString(TALK_STRING)->getOutput(PUTTS::getVoice(USE_VOICE)));
$putts->setDataProvider(new Wav());
file_put_contents("german_time.wav", PUTTS::getVoice(USE_VOICE)->speakString("es ist jetzt " . date("G") . " uhr " . (int) date("i"))->getOutput(PUTTS::getVoice(USE_VOICE)));