Certainly! Here's a complete example of a simple HTML + CSS + JavaScript voice generator that lets users type text and control speed (rate) and pitch of the speech. It also includes an option to export the generated speech to a WAV file and "share" it via a download link.
Notes:
The Web Speech API's speechSynthesis can control voice, rate, and pitch, but it does not support exporting audio natively.
To export speech to WAV, you need to either:
Record the audio output via Web Audio API and MediaRecorder (complex and browser-limited).
Use an external API or server-side TTS solution.
In this example, I will demonstrate a workaround using the SpeechSynthesis to play the audio, and simultaneously use the Web Audio API to capture audio via the SpeechSynthesisUtterance — unfortunately, this is not trivial or widely supported.
Instead, I'll provide a demo that uses the browser's SpeechSynthesis for playback and uses Recorder.js (a lib for recording audio from microphone or Web Audio API nodes) to record audio from the mic for export.
Because TTS audio cannot be directly captured easily due to browser limitations, the WAV export will work only if you record audio from the mic (which contradicts your need). Alternatively, I can suggest using the Web Speech API playback and sharing text + settings, but no direct WAV export.
So: Here's a minimal, fully working TTS with rate and pitch controls, and ability to share text+params via a URL fragment (#/).
Click Generate Share URL to create a link which includes your text and settings encoded as part of the URL hash.
Copy/share that link; when opened it will load the text and settings from the URL for easy sharing or bookmarking.
Explanation & limitations:
Native browser TTS does not allow exporting voice to WAV or other formats.
Using the Web Audio API and MediaRecorder to capture SpeechSynthesis output is technically difficult and not supported across all browsers.
This demo focuses on usability & sharing the configuration.
If you want to export audio, you'd typically need to send text to a server-side TTS engine (Google, Amazon Polly, etc.) and download the resulting audio file.
If you want, I can help you explore server-side options or more advanced client-side audio capturing approaches. Just ask!