eSpeak NG is an open source speech synthesizer that supports more than hundred languages and accents.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

demo.html 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
  6. <title>espeakng.js Demo</title>
  7. <style>
  8. h1 {
  9. max-width: 480px;
  10. margin: 2rem auto;
  11. font-size: 150%;
  12. }
  13. form {
  14. max-width: 480px;
  15. margin: 0 auto;
  16. }
  17. .speecharg label {
  18. display: inline-block;
  19. width: 20%;
  20. }
  21. .speecharg input, .speecharg select {
  22. display: inline-block;
  23. width: calc(80% - 3rem);
  24. margin: 0;
  25. }
  26. .speecharg button {
  27. width: 1.5rem;
  28. height: 1.5rem;
  29. margin: 0 0 0 1.5rem;
  30. display: inline-block;
  31. }
  32. .bottom {
  33. margin-top: 1rem;
  34. display: -webkit-flex;
  35. display: flex;
  36. -webkit-justify-content: space-between;
  37. justify-content: space-between;
  38. margin: 1rem 0;
  39. }
  40. .bottom button {
  41. flex-grow: 1;
  42. -webkit-flex-grow: 1;
  43. }
  44. #texttospeak {
  45. width: 100%;
  46. height: 8rem;
  47. display: block;
  48. margin-bottom: 1rem;
  49. }
  50. p.gh {
  51. color: #333;
  52. text-align: right;
  53. display: block;
  54. font-style: italic;
  55. }
  56. /* loading screen */
  57. #splash {
  58. position: absolute;
  59. top: 0;
  60. left: 0;
  61. right: 0;
  62. bottom: 0;
  63. background-color: #fff;
  64. padding-top: 4rem;
  65. transition: opacity 200ms ease, visibility 200ms;
  66. -webkit-transition: opacity 200ms ease, visibility 200ms;
  67. visibility: hidden;
  68. opacity: 0;
  69. }
  70. body.loading #splash {
  71. visibility: visible;
  72. opacity: 1;
  73. }
  74. #splash > * {
  75. width: 10rem;
  76. max-width: 480px;
  77. margin: 2rem auto;
  78. display: block;
  79. text-align: center;
  80. }
  81. body.loading > *:not(#splash) {
  82. visibility: hidden;
  83. }
  84. </style>
  85. <script type="text/javascript" src="js/espeakng.js"></script>
  86. <script type="text/javascript" src="js/demo.js"></script>
  87. </head>
  88. <body class="loading">
  89. <div id="splash">
  90. <div>Loading eSpeak-ng worker and data...</div>
  91. <progress></progress>
  92. </div>
  93. <h1>espeakng.js Demo</h1>
  94. <form>
  95. <textarea id="texttospeak">Call me Ishmael. Some years ago --- never mind how long precisely --- having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. It is a way I have of driving off the spleen and regulating the circulation.</textarea>
  96. <div class="speecharg">
  97. <label for="pitch">Pitch</label><input id="pitch" type="range" value="50" min="0" max="100"><button type="button" aria-label="Reset pitch" title="Reset pitch" onclick="resetPitch();">&#x21b6;</button>
  98. </div>
  99. <div class="speecharg">
  100. <label for="rate">Rate</label><input id="rate" type="range" value="175" min="80" max="450"><button type="button" aria-label="Reset rate" title="Reset rate" onclick="resetRate();">&#x21b6;</button>
  101. </div>
  102. <div class="speecharg">
  103. <label for="voice">Voice</label><select id="voice"></select><button type="button" aria-label="Reset voice" title="Reset voice" onclick="resetVoice();">&#x21b6;</button>
  104. </div>
  105. <div class="bottom">
  106. <button type="button" onmousedown="speak();">Speak</button>
  107. <button type="button" onmousedown="stop();">Stop</button>
  108. </div>
  109. <p class="gh"><a href="https://github.com/eeejay/espeak/tree/emscripten">Original Code for eSpeak: Eitan Isaacson</a></p>
  110. <p class="gh"><a href="https://github.com/pettarin/espeak-ng/tree/emscripten">Adapted Code for eSpeak-ng: Alberto Pettarin</a></p>
  111. </form>
  112. <script type="text/javascript">
  113. initializeDemo();
  114. </script>
  115. </body>
  116. </html>