File manager - Edit - /home/autoph/public_html/projects/tickets-autohub/resources/views/voice.blade.php
Back
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Text to Speech</title> </head> <body> <h1>Customizable Text-to-Speech</h1> <textarea id="text" rows="5" cols="30" placeholder="Enter text here..."></textarea> <br> <label for="voiceSelect">Choose Voice:</label> <select id="voiceSelect"></select> <br> <label for="rate">Rate:</label> <input id="rate" type="range" min="0.5" max="2" value="1" step="0.1"> <span id="rateValue">1</span> <br> <label for="pitch">Pitch:</label> <input id="pitch" type="range" min="0" max="2" value="1" step="0.1"> <span id="pitchValue">1</span> <br> <button onclick="speakText()">Speak</button> <script> const textArea = document.getElementById('text'); const voiceSelect = document.getElementById('voiceSelect'); const rate = document.getElementById('rate'); const pitch = document.getElementById('pitch'); const rateValue = document.getElementById('rateValue'); const pitchValue = document.getElementById('pitchValue'); const synth = window.speechSynthesis; let voices = []; // Populate voices function populateVoiceList() { voices = synth.getVoices(); voiceSelect.innerHTML = ''; voices.forEach((voice, i) => { const option = document.createElement('option'); option.textContent = `${voice.name} (${voice.lang})`; option.value = i; if (voice.default) { option.textContent += ' [default]'; } voiceSelect.appendChild(option); }); } synth.onvoiceschanged = populateVoiceList; // Update rate and pitch values rate.addEventListener('input', () => { rateValue.textContent = rate.value; }); pitch.addEventListener('input', () => { pitchValue.textContent = pitch.value; }); // Speak the text function speakText() { if (synth.speaking) { console.error('SpeechSynthesis already speaking'); return; } const utterThis = new SpeechSynthesisUtterance(textArea.value); const selectedVoice = voices[voiceSelect.value]; utterThis.voice = selectedVoice; utterThis.rate = rate.value; utterThis.pitch = pitch.value; synth.speak(utterThis); utterThis.onerror = (e) => { console.error('SpeechSynthesisUtterance error:', e); }; } </script> </body> </html>
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0 |
proxy
|
phpinfo
|
Settings