 |
ใครเคยพัฒนางานอ่านข้อความบน textbox เป็นเสียงพูดไหมครับ |
|
 |
|
|
 |
 |
|
อย่าทำเอง ใช้ google cloud
https://cloud.google.com/text-to-speech/docs/reference/rest
|
 |
 |
 |
 |
Date :
2022-04-12 12:25:29 |
By :
009 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
php แค่ส่วนสร้าง html/javascript/img/sound
ส่วนการประกอบการแปล เปลี่ยนอักษรเป็นเสียง ต้องใช้ javascript
หรือใช้เครื่องมือ สำเร็จรูป แบบที่ท่านข้างบนบอก
|
 |
 |
 |
 |
Date :
2022-04-12 13:46:28 |
By :
Chaidhanan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คุณ 009 ครับ พออธิบายหรือมีโค๊ดตัวอย่างให้ศึกษาไหมครับ มือใหม่อาจเข้าใจยากหน่อยครับ
|
 |
 |
 |
 |
Date :
2022-04-13 08:03:19 |
By :
ผู้ใฝ่รู้ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
โค้ดก็ตามลิงค์ที่ให้ไปไงครับ ยังไม่ได้เปิดดู?
Code (PHP)
require __DIR__ . '/vendor/autoload.php';
use Google\Cloud\TextToSpeech\V1\AudioConfig;
use Google\Cloud\TextToSpeech\V1\AudioEncoding;
use Google\Cloud\TextToSpeech\V1\SynthesisInput;
use Google\Cloud\TextToSpeech\V1\TextToSpeechClient;
use Google\Cloud\TextToSpeech\V1\VoiceSelectionParams;
$textToSpeechClient = new TextToSpeechClient();
$input = new SynthesisInput();
$input->setText('Japan\'s national soccer team won against Colombia!');
$voice = new VoiceSelectionParams();
$voice->setLanguageCode('en-US');
$audioConfig = new AudioConfig();
$audioConfig->setAudioEncoding(AudioEncoding::MP3);
$resp = $textToSpeechClient->synthesizeSpeech($input, $voice, $audioConfig);
file_put_contents('test.mp3', $resp->getAudioContent());
จริงๆ ใช้ google translate แล้วคลิกปุ่ม speaker เอาก็ได้
คำเตือน มือใหม่แนะนำเปลี่ยนงาน เพราะขนาด senior dev ของบริษัท ยังทำไม่เป็นเลย แต่ปัจจัยสำคัญคือค่าใช้จ่าย
|
 |
 |
 |
 |
Date :
2022-04-13 12:50:07 |
By :
009 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|