Spaces:
Sleeping
Sleeping
fda
Browse files- staticfiles/livetest.html +25 -2
staticfiles/livetest.html
CHANGED
@@ -26,13 +26,36 @@
|
|
26 |
let _debug = 0;
|
27 |
'use strict';
|
28 |
|
29 |
-
function
|
30 |
-
var text =
|
31 |
var speech = new SpeechSynthesisUtterance(text);
|
32 |
speech.lang = "ja-JP"; // 日本語に設定
|
33 |
window.speechSynthesis.speak(speech);
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
class MiiboAvatar {
|
37 |
constructor(config) {
|
38 |
this.container = config.container;
|
|
|
26 |
let _debug = 0;
|
27 |
'use strict';
|
28 |
|
29 |
+
function speaks(input) {
|
30 |
+
var text = input;//document.getElementById("text").value;
|
31 |
var speech = new SpeechSynthesisUtterance(text);
|
32 |
speech.lang = "ja-JP"; // 日本語に設定
|
33 |
window.speechSynthesis.speak(speech);
|
34 |
}
|
35 |
|
36 |
+
function speak(input) {
|
37 |
+
var text = input;//document.getElementById("text").value;
|
38 |
+
var speech = new SpeechSynthesisUtterance(text);
|
39 |
+
|
40 |
+
// 声のリストから男性の声を選択
|
41 |
+
var voices = window.speechSynthesis.getVoices();
|
42 |
+
for (var i = 0; i < voices.length; i++) {
|
43 |
+
if (voices[i].name.includes("Google 日本語") || voices[i].name.includes("Male")) {
|
44 |
+
speech.voice = voices[i];
|
45 |
+
break;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
// 音声の設定
|
50 |
+
speech.lang = "ja-JP"; // 日本語の設定
|
51 |
+
speech.pitch = 1; // ピッチ(声の高さ)
|
52 |
+
speech.rate = 1; // 読み上げ速度
|
53 |
+
speech.volume = 1; // 音量
|
54 |
+
|
55 |
+
// 音声の再生
|
56 |
+
window.speechSynthesis.speak(speech);
|
57 |
+
}
|
58 |
+
|
59 |
class MiiboAvatar {
|
60 |
constructor(config) {
|
61 |
this.container = config.container;
|