Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Voice_Recognition_API is added #380

Merged
merged 2 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion New_APIs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@
|[Music API Web Application](./music-api/)|You can access any song and listen to it. Below are some useful links and information.|
[Result-marks Data api ](./Result-marks_API/)|this is for those who want to make college management project they can simple take this api and connect to project easily|
|[Payment API](./Payment_API/)|This demonstrates how to integrate PayPal API for online payments. It handles payment success and cancellation scenarios.|
|[Social Media Analytics API](./Social_Media_Analytics_API/)|This demonstrates how to create a Social Media Analytics API to retrieve user engagement data like posts, likes, comments, and shares.|
|[Social Media Analytics API](./Social_Media_Analytics_AP/)|This demonstrates how to create a Social Media Analytics API to retrieve user engagement data like posts, likes, comments, and shares.|
|[Voice_Recognition_API](./Voice_Recognition_API/)|This demonstrates how a meachine retrieve user engagement only Voice|

43 changes: 43 additions & 0 deletions New_APIs/Voice_Recognition_API/README.md
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.
18 changes: 18 additions & 0 deletions New_APIs/Voice_Recognition_API/index.html
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>
37 changes: 37 additions & 0 deletions New_APIs/Voice_Recognition_API/script.js
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();
});
});
40 changes: 40 additions & 0 deletions New_APIs/Voice_Recognition_API/style.css
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;
}
Loading