-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathESP32_SpeechRecognition.html
159 lines (156 loc) · 6.6 KB
/
ESP32_SpeechRecognition.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!-- Author: https://www.facebook.com/francefu -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="https://fustyles.github.io/webduino/myBlockly/SpeechRecognition/speechrecognition.js"></script>
<script>
var strUrl=location.search;
if (strUrl.indexOf("?")!=-1) {
var STAIP = strUrl.split("?")[1].split("&")[0];
var Lang = strUrl.split("?")[1].split("&")[1];
}
</script>
</head>
<body onclick="if (Lang) document.getElementById('lang').value=Lang;">
Language
<select id="lang" name="lang" onclick="recognition.lang=this.value;try{startButton(event);}catch(e){}">
<option value="en-NZ">en-NZ</option>
<option value="cmn-Hant-TW">中文(台灣)</option>
<option value="af-ZA">Afrikaans</option>
<option value="am-ET">አማርኛ</option>
<option value="az-AZ">Azərbaycanca</option>
<option value="bn-BD">বাংলাদেশ</option>
<option value="bn-IN">ভারত</option>
<option value="id-ID">BahasaIndonesia</option>
<option value="ms-MY">BahasaMelayu</option>
<option value="ca-ES">Català</option>
<option value="cs-CZ">Čeština</option>
<option value="da-DK">Dansk</option>
<option value="de-DE">Deutsch</option>
<option value="en-AU">Australia</option>
<option value="en-CA">Canada</option>
<option value="en-IN">India</option>
<option value="en-KE">Kenya</option>
<option value="en-TZ">Tanzania</option>
<option value="en-GH">Ghana</option>
<option value="en-NZ">NewZealand</option>
<option value="en-NG">Nigeria</option>
<option value="en-ZA">SouthAfrica</option>
<option value="en-PH">Philippines</option>
<option value="en-GB">UnitedKingdom</option>
<option value="en-US">UnitedStates</option>
<option value="es-AR">Argentina</option>
<option value="es-BO">Bolivia</option>
<option value="es-CL">Chile</option>
<option value="es-CO">Colombia</option>
<option value="es-CR">CostaRica</option>
<option value="es-EC">Ecuador</option>
<option value="es-SV">ElSalvador</option>
<option value="es-ES">España</option>
<option value="es-US">EstadosUnidos</option>
<option value="es-GT">Guatemala</option>
<option value="es-HN">Honduras</option>
<option value="es-MX">México</option>
<option value="es-NI">Nicaragua</option>
<option value="es-PA">Panamá</option>
<option value="es-PY">Paraguay</option>
<option value="es-PE">Perú</option>
<option value="es-PR">PuertoRico</option>
<option value="es-DO">RepúblicaDominicana</option>
<option value="es-UY">Uruguay</option>
<option value="es-VE">Venezuela</option>
<option value="eu-ES">Euskara</option>
<option value="fil-PH">Filipino</option>
<option value="fr-FR">Français</option>
<option value="jv-ID">BasaJawa</option>
<option value="gl-ES">Galego</option>
<option value="gu-IN">ગુજરાતી</option>
<option value="hr-HR">Hrvatski</option>
<option value="zu-ZA">IsiZulu</option>
<option value="is-IS">Íslenska</option>
<option value="it-IT">Italia</option>
<option value="it-CH">Svizzera</option>
<option value="kn-IN">ಕನ್ನಡ</option>
<option value="km-KH">ភាសាខ្មែរ</option>
<option value="lv-LV">Latviešu</option>
<option value="lt-LT">Lietuvių</option>
<option value="ml-IN">മലയാളം</option>
<option value="mr-IN">मराठी</option>
<option value="hu-HU">Magyar</option>
<option value="lo-LA">ລາວ</option>
<option value="nl-NL">Nederlands</option>
<option value="ne-NP">नेपालीभाषा</option>
<option value="nb-NO">Norskbokmål</option>
<option value="pl-PL">Polski</option>
<option value="pt-BR">Brasil</option>
<option value="pt-PT">Portugal</option>
<option value="ro-RO">Română</option>
<option value="si-LK">සිංහල</option>
<option value="sl-SI">Slovenščina</option>
<option value="su-ID">BasaSunda</option>
<option value="sk-SK">Slovenčina</option>
<option value="fi-FI">Suomi</option>
<option value="sv-SE">Svenska</option>
<option value="sw-TZ">Tanzania</option>
<option value="sw-KE">Kenya</option>
<option value="ka-GE">ქართული</option>
<option value="hy-AM">Հայերեն</option>
<option value="ta-IN">இந்தியா</option>
<option value="ta-SG">சிங்கப்பூர்</option>
<option value="ta-LK">இலங்கை</option>
<option value="ta-MY">மலேசியா</option>
<option value="te-IN">తెలుగు</option>
<option value="vi-VN">TiếngViệt</option>
<option value="tr-TR">Türkçe</option>
<option value="ur-PK">پاکستان</option>
<option value="ur-IN">بھارت</option>
<option value="el-GR">Ελληνικά</option>
<option value="bg-BG">български</option>
<option value="ru-RU">Pусский</option>
<option value="sr-RS">Српски</option>
<option value="uk-UA">Українська</option>
<option value="ko-KR">한국어</option>
<option value="cmn-Hans-CN">普通话(中国大陆)</option>
<option value="cmn-Hans-HK">普通话(香港)</option>
<option value="yue-Hant-HK">粵語(香港)</option>
<option value="ja-JP">日本語</option>
<option value="hi-IN">हिन्दी</option>
<option value="th-TH">ภาษาไทย</option>
</select>
<br>Say "ok" or "okay" to execute command.<br>
<div id="showText"></div>
<div id="result" style="color:red;font-weight:bold;"></div>
<br>
<div id="command" style="color:blue;font-weight:bold;"></div>
<script>
if (Lang) recognition.lang="en-NZ";
if (!recognizing) startButton(event);
setInterval(async function(){
Result = (Recognition_final_get());
if (Result) {
if (Result.toLowerCase().trim()=="ok"||Result.toLowerCase().trim()=="okay") {
document.getElementById("showText").innerHTML = "";
document.getElementById("result").innerHTML = "";
location.href = document.getElementById("command").innerHTML;
return;
}
else {
document.getElementById("showText").innerHTML = "";
document.getElementById("result").innerHTML = Result;
document.getElementById("command").innerHTML = "http://" +STAIP + "?speech=" + Result.toLowerCase().trim() + ";" + document.getElementById("lang").value;
}
}
if (document.getElementById("showText").innerHTML!="") {
document.getElementById("result").innerHTML = "";
}
if (!recognizing) {
try {
startButton(event);
}
catch (e) {
}
}
},10);
</script>
</body>
</html>