demo.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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 1.49.1 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 input {
  27. margin: 0;
  28. padding: 0;
  29. border: 0;
  30. }
  31. .speecharg button {
  32. width: 1.5rem;
  33. height: 1.5rem;
  34. margin: 0 0 0 1.5rem;
  35. display: inline-block;
  36. }
  37. .bottom {
  38. margin-top: 1rem;
  39. display: -webkit-flex;
  40. display: flex;
  41. -webkit-justify-content: space-between;
  42. justify-content: space-between;
  43. margin: 1rem 0;
  44. }
  45. .bottom button {
  46. flex-grow: 1;
  47. -webkit-flex-grow: 1;
  48. }
  49. #texttospeak {
  50. width: 100%;
  51. height: 8rem;
  52. display: block;
  53. margin-bottom: 1rem;
  54. }
  55. #ipaarea {
  56. width: 100%;
  57. height: 8rem;
  58. display: block;
  59. margin-bottom: 1rem;
  60. }
  61. p.gh {
  62. color: #333;
  63. text-align: right;
  64. display: block;
  65. font-style: italic;
  66. }
  67. /* loading screen */
  68. #splash {
  69. position: absolute;
  70. top: 0;
  71. left: 0;
  72. right: 0;
  73. bottom: 0;
  74. background-color: #fff;
  75. padding-top: 4rem;
  76. transition: opacity 200ms ease, visibility 200ms;
  77. -webkit-transition: opacity 200ms ease, visibility 200ms;
  78. visibility: hidden;
  79. opacity: 0;
  80. }
  81. body.loading #splash {
  82. visibility: visible;
  83. opacity: 1;
  84. }
  85. #splash > * {
  86. width: 10rem;
  87. max-width: 480px;
  88. margin: 2rem auto;
  89. display: block;
  90. text-align: center;
  91. }
  92. body.loading > *:not(#splash) {
  93. visibility: hidden;
  94. }
  95. </style>
  96. <script type="text/javascript" src="js/espeakng.js"></script>
  97. <script type="text/javascript" src="js/demo.js"></script>
  98. </head>
  99. <body class="loading">
  100. <div id="splash">
  101. <div>Loading eSpeak-ng worker and data...</div>
  102. <progress></progress>
  103. </div>
  104. <h1>espeakng.js 1.49.1 Demo</h1>
  105. <form>
  106. <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>
  107. <textarea readonly="true" placeholder="IPA" id="ipaarea"></textarea>
  108. <div class="speecharg">
  109. <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>
  110. </div>
  111. <div class="speecharg">
  112. <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>
  113. </div>
  114. <div class="speecharg">
  115. <label for="voice">Voice</label><select id="voice"></select><button type="button" aria-label="Reset voice" title="Reset voice" onclick="resetVoice();">&#x21b6;</button>
  116. </div>
  117. <div class="bottom">
  118. <button type="button" onmousedown="speakAndIpa();">Speak</button>
  119. <button type="button" onmousedown="stop();">Stop</button>
  120. </div>
  121. <p class="gh"><a href="https://github.com/eeejay/espeak/tree/emscripten">Original Code for eSpeak: Eitan Isaacson</a></p>
  122. <p class="gh"><a href="https://github.com/pettarin/espeak-ng/tree/emscripten">Adapted Code for eSpeak-ng: Alberto Pettarin</a></p>
  123. </form>
  124. <script type="text/javascript">
  125. initializeDemo();
  126. </script>
  127. </body>
  128. </html>