-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
48fdfe0
commit b75a226
Showing
5 changed files
with
140 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Voice Recognition and Assistance | ||
|
||
This is a simple web application that captures voice input and displays the recognized text using the Web Speech API. | ||
|
||
## Project Structure | ||
|
||
- `index.html`: The main HTML file that contains the structure of the web page. | ||
- `style.css`: The CSS file that styles the web page. | ||
- `script.js`: The JavaScript file that handles voice recognition and displays the recognized text. | ||
- `README.md`: This file containing information about the project. | ||
|
||
## Setup | ||
|
||
1. Clone the repository: | ||
```sh | ||
git clone https://github.com/yourusername/voice-recognition-assistance.git | ||
cd voice-recognition-assistance | ||
``` | ||
|
||
2. Open `index.html` in your browser. | ||
|
||
## Usage | ||
|
||
- Click the "Start Listening" button and start speaking. | ||
- The recognized text will be displayed on the web page. | ||
|
||
## Browser Support | ||
|
||
This application uses the Web Speech API, which is supported in the following browsers: | ||
- Google Chrome | ||
- Microsoft Edge | ||
|
||
Note: The Web Speech API is not supported in all browsers. If your browser does not support it, you will see a message indicating this. | ||
|
||
## Customization | ||
|
||
- Modify `index.html` to change the structure of the web page. | ||
- Update `style.css` to change the styling of the web page. | ||
- Edit `script.js` to change the language or add additional functionalities. | ||
|
||
## License | ||
|
||
This project is licensed under the MIT License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Voice Recognition and Assistance</title> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>Voice Recognition and Assistance</h1> | ||
<button id="start-button">Start Listening</button> | ||
<p id="status">Click the button and start speaking...</p> | ||
<div id="result"></div> | ||
</div> | ||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
document.addEventListener("DOMContentLoaded", function() { | ||
const startButton = document.getElementById("start-button"); | ||
const statusElement = document.getElementById("status"); | ||
const resultElement = document.getElementById("result"); | ||
|
||
// Check for browser support | ||
if (!('webkitSpeechRecognition' in window)) { | ||
statusElement.innerText = "Your browser does not support speech recognition."; | ||
return; | ||
} | ||
|
||
const recognition = new webkitSpeechRecognition(); | ||
recognition.continuous = false; | ||
recognition.interimResults = false; | ||
recognition.lang = "en-US"; | ||
|
||
recognition.onstart = function() { | ||
statusElement.innerText = "Listening..."; | ||
}; | ||
|
||
recognition.onresult = function(event) { | ||
const transcript = event.results[0][0].transcript; | ||
resultElement.innerText = `You said: ${transcript}`; | ||
}; | ||
|
||
recognition.onerror = function(event) { | ||
statusElement.innerText = `Error occurred: ${event.error}`; | ||
}; | ||
|
||
recognition.onend = function() { | ||
statusElement.innerText = "Click the button and start speaking..."; | ||
}; | ||
|
||
startButton.addEventListener("click", function() { | ||
recognition.start(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
body { | ||
font-family: Arial, sans-serif; | ||
background-color: #f4f4f4; | ||
margin: 0; | ||
padding: 0; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
} | ||
|
||
.container { | ||
text-align: center; | ||
padding: 20px; | ||
background-color: #fff; | ||
border-radius: 8px; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
h1 { | ||
color: #333; | ||
} | ||
|
||
button { | ||
padding: 10px 20px; | ||
font-size: 16px; | ||
margin-top: 20px; | ||
cursor: pointer; | ||
} | ||
|
||
#status { | ||
margin-top: 20px; | ||
color: #555; | ||
} | ||
|
||
#result { | ||
margin-top: 20px; | ||
font-size: 18px; | ||
color: #333; | ||
} |