public function make($text, $fileName) { $sp = new SplitterText(); $text = iconv('UTF-8', 'UTF-8', $text); $lines = $sp->split($text, 100); $content = ''; foreach ($lines as $line) { $query = ['voice' => $this->getLanguage(), 'speed' => $this->getSpeed(), 'text' => $line, 'action' => 'convert']; $content .= $this->reguestGet($query); } return $content; }
public function make($text, $fileName) { $sp = new SplitterText(); $text = iconv('UTF-8', 'UTF-8', $text); $lines = $sp->split($text, 512); $content = ''; foreach ($lines as $line) { $query = ['format' => 'mp3', 'lang' => $this->getLanguage(), 'quality' => 'hi', 'text' => $line, 'speaker' => 'omazh', 'mixed' => 'mixed', 'key' => '7dc83e6f-7a54-4fac-a651-0ef471177aa3']; $content .= $this->reguestGet($query); } return $content; }
protected function synthesize($text, $outFile) { $sp = new SplitterText(); $text = iconv('UTF-8', 'UTF-8', $text); $lines = $sp->split($text, 512); $content = ''; foreach ($lines as $line) { $query = ['format' => 'mp3', 'quality' => 'hi', 'text' => $line, 'speaker' => $this->speaker, 'emotion' => 'good', 'lang' => 'ru‑RU', 'speed' => 1.2, 'key' => $this->apiKey]; $content .= $this->reguestGet($query); } file_put_contents($outFile, $content); return true; }