Speech To Text

Developer
Size
3,109 Kb
Views
6,072

How do I make an speech to text?

What is a speech to text? How do you make a speech to text? This script and codes were developed by Adam on 27 December 2022, Tuesday.

Speech To Text Previews

Speech To Text - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Speech To Text</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="cards"> <div class="card">Hello, ask me a question.</div>
</div>
<button class="ask">ask</button> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Speech To Text - Script Codes CSS Codes

@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,600,300);
body { background-color: #EEE; font-family: 'Open Sans', sans-serif;
}
.cards { max-width: 500px; margin: 15px auto 0 auto;
}
.cards .card { background-color: #FFF; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1); padding: 15px 20px 15px 20px; margin: 0 5px 15px 5px;
}
.ask { position: absolute; bottom: 20px; left: 50%; height: 50px; width: 50px; border-radius: 50%; border: none; background-color: #364A5E; color: #FFF;
}

Speech To Text - Script Codes JS Codes

if (!('webkitSpeechRecognition' in window)) { alert('Your browser sucks... :(')
}else{ var recognizing = false, ignore_onend = false, final_transcript, previousQuestion; var recognition = new webkitSpeechRecognition(); recognition.continuous = true; recognition.interimResults = true; recognition.onstart = function() { recognizing = true; // Show Listening Indicator here... }; recognition.onerror = function(event) { if (event.error == 'no-speech') { console.log('info_no_speech'); ignore_onend = true; } if (event.error == 'audio-capture') { console.log('info_no_microphone'); ignore_onend = true; } if (event.error == 'not-allowed') { if (event.timeStamp - start_timestamp < 100) { showInfo('info_blocked'); } else { showInfo('info_denied'); } ignore_onend = true; } }; recognition.onend = function() { recognizing = false; if (ignore_onend) { return; } if (!final_transcript) { showInfo('info_start'); return; } /*showInfo(''); if (window.getSelection) { window.getSelection().removeAllRanges(); var range = document.createRange(); range.selectNode(document.getElementById('final_span')); window.getSelection().addRange(range); } if (create_email) { create_email = false; createEmail(); }*/ }; recognition.onresult = function(event) { var interim_transcript = ''; for (var i = event.resultIndex; i < event.results.length; ++i) { if (event.results[i].isFinal) { final_transcript += event.results[i][0].transcript; } else { interim_transcript += event.results[i][0].transcript; } } if(final_transcript.length > 0 && final_transcript !== previousQuestion){ $('.cards').append('<div class="card">'+final_transcript+'</div>'); var utterance = new SpeechSynthesisUtterance(final_transcript); window.speechSynthesis.speak(utterance); } previousQuestion = final_transcript; recognition.stop(); };
}
$('.ask').click(function(){ if (recognizing) { recognition.stop(); return; } final_transcript = ''; recognition.start(); ignore_onend = false; start_timestamp = event.timeStamp; $.ajaxSetup({xhrFields: { withCredentials: true } });
});
Speech To Text - Script Codes
Speech To Text - Script Codes
Home Page Home
Developer Adam
Username adamjacob
Uploaded December 27, 2022
Rating 3
Size 3,109 Kb
Views 6,072
Do you need developer help for Speech To Text?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Adam (adamjacob) Script Codes
Create amazing video scripts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!