Created
September 7, 2016 10:06
-
-
Save nosix/3de00175e75408ffcbe063e74f6e5ede to your computer and use it in GitHub Desktop.
Text to Speech using Watson
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Text to Speech</title> | |
| </head> | |
| <body> | |
| <div id="text-to-speech"> | |
| <input type="text" name="speech-text" placeholder="Sentence"> | |
| <button id="submit">Speech</button> | |
| <audio id="speech"></audio> | |
| </div> | |
| <script type="text/javascript" src="https://code.jquery.com/jquery-3.1.0.min.js"></script> | |
| <script type="text/javascript"> | |
| $(document).ready(function(){ | |
| $("#submit").click(function(){ | |
| var text = $("#text-to-speech input[name=speech-text]").val(); | |
| var url = "https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize?voice=ja-JP_EmiVoice&accept=audio/wav&text=" + text; | |
| $("#speech").attr("src", url)[0].play(); | |
| }); | |
| }); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment