R
R
regular person2018-10-23 13:37:10
PHP
regular person, 2018-10-23 13:37:10

How to get mp3 file from SpeechKit Cloud response?

To not re-apply.
Is there a way to do this on the php server?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Victor L, 2018-10-23
@Fzero0

<?php
  $id=$_GET["q"];
  	$say_text=$id;
  $qs = http_build_query(array("format" => "mp3","lang" => "ru-RU","speaker" => "jane","key" => "ключ","emotion" => "good", "text" => $say_text)); // параметры запроса
  $ctx = stream_context_create(array("http"=>array("method"=>"GET","header"=>"Referer: \r\n")));
  $soundfile = file_get_contents("https://tts.voicetech.yandex.net/generate?".$qs, false, $ctx); // запрос на генерацию mp3 файла
 	file_put_contents('1.mp3',$soundfile); //сохраняю
 	echo($soundfile);
?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question