From b75a2262d82743e509858de28b46bb0ad89c1950 Mon Sep 17 00:00:00 2001 From: pallasivasai Date: Thu, 8 Aug 2024 21:35:55 +0530 Subject: [PATCH] Voice_Recognition_API is added --- New_APIs/README.md | 3 +- New_APIs/Voice_Recognition_API/README.md | 43 +++++++++++++++++++++++ New_APIs/Voice_Recognition_API/index.html | 18 ++++++++++ New_APIs/Voice_Recognition_API/script.js | 37 +++++++++++++++++++ New_APIs/Voice_Recognition_API/style.css | 40 +++++++++++++++++++++ 5 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 New_APIs/Voice_Recognition_API/README.md create mode 100644 New_APIs/Voice_Recognition_API/index.html create mode 100644 New_APIs/Voice_Recognition_API/script.js create mode 100644 New_APIs/Voice_Recognition_API/style.css diff --git a/New_APIs/README.md b/New_APIs/README.md index 54a69e3..d2c3f33 100644 --- a/New_APIs/README.md +++ b/New_APIs/README.md @@ -17,4 +17,5 @@ |[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](./Payment_API/)|This demonstrates how to create a Social Media Analytics API to retrieve user engagement data like posts, likes, comments, and shares.| \ No newline at end of file +|[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| \ No newline at end of file diff --git a/New_APIs/Voice_Recognition_API/README.md b/New_APIs/Voice_Recognition_API/README.md new file mode 100644 index 0000000..a51a5b3 --- /dev/null +++ b/New_APIs/Voice_Recognition_API/README.md @@ -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. diff --git a/New_APIs/Voice_Recognition_API/index.html b/New_APIs/Voice_Recognition_API/index.html new file mode 100644 index 0000000..51b5649 --- /dev/null +++ b/New_APIs/Voice_Recognition_API/index.html @@ -0,0 +1,18 @@ + + + + + + Voice Recognition and Assistance + + + +
+

Voice Recognition and Assistance

+ +

Click the button and start speaking...

+
+
+ + + diff --git a/New_APIs/Voice_Recognition_API/script.js b/New_APIs/Voice_Recognition_API/script.js new file mode 100644 index 0000000..e4da476 --- /dev/null +++ b/New_APIs/Voice_Recognition_API/script.js @@ -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(); + }); +}); diff --git a/New_APIs/Voice_Recognition_API/style.css b/New_APIs/Voice_Recognition_API/style.css new file mode 100644 index 0000000..3759805 --- /dev/null +++ b/New_APIs/Voice_Recognition_API/style.css @@ -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; +}