-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvoice_demo.html
More file actions
26 lines (25 loc) · 759 Bytes
/
Copy pathvoice_demo.html
File metadata and controls
26 lines (25 loc) · 759 Bytes
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
<!DOCTYPE html>
<html>
<head>
<title>Voice Expense Tracker</title>
</head>
<body>
<h2>Speak Your Expense</h2>
<button onclick="startDictation()">🎤 Speak</button><br><br>
<input type="text" id="textBox" placeholder="Your speech appears here" size="50" />
<script>
function startDictation() {
const recognition = new webkitSpeechRecognition(); // Chrome only
recognition.lang = "en-IN"; // Indian English
recognition.onresult = function(event) {
const transcript = event.results[0][0].transcript;
document.getElementById("textBox").value = transcript;
};
recognition.onerror = function(e) {
alert("Error: " + e.error);
};
recognition.start();
}
</script>
</body>
</html>