TEXT TO VOICE

Text-to-Voice Tool

Text-to-Voice Tool

body { margin: 0; padding: 0; font-family: sans-serif; background-color: #f8f8f8; } .container { width: 90%; max-width: 800px; margin: 0 auto; text-align: center; padding: 30px; background-color: #fff; border-radius: 5px; box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1); } h1 { font-size: 32px; margin-bottom: 20px; } textarea { width: 100%; height: 200px; border: none; padding: 10px; font-size: 16px; border-radius: 5px; box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1); resize: none; margin-bottom: 20px; } .controls { display: flex; justify-content: center; } button { padding: 10px 20px; font-size: 16px; border-radius: 5px; border: none; margin: 0 10px; background-color: #007aff; color: #fff; cursor: pointer; box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1); transition: all 0.2s ease-in-out; } button:hover { background-color: #0059ff; } @media only screen and (max-width: 600px) { textarea { height: 150px; } h1 { font-size: 28px; } button { padding: 8px 16px; font-size: 14px; } } const playButton = document.getElementById('play-button'); const pauseButton = document.getElementById('pause-button'); const stopButton = document.getElementById('stop-button'); const textInput = document.getElementById('text-input'); const speechSynthesis = window.speechSynthesis; let currentUtterance; // Disable pause and stop buttons by default pauseButton.disabled = true; stopButton.disabled = true; playButton.addEventListener('click', () => { // Create a new utterance object currentUtterance = new SpeechSynthesisUtterance(textInput.value); // Set the voice to the default system voice currentUtterance.voice = speechSynthesis.getVoices()[0]; // When the utterance finishes, enable the play button and disable pause and stop

No comments

Powered by Blogger.