rhasspy / piper

A fast, local neural text to speech system
https://rhasspy.github.io/piper-samples/
MIT License
5.71k stars 408 forks source link

Possible to use Piper voices from JavaScript SpeechSynthesis Web API? #208

Open DaveEElliott opened 11 months ago

DaveEElliott commented 11 months ago

I'd like to use a realistic voice on a Web-based project on Raspberry Pi 4 (chromium or firefox). Can Piper voices be installed and accessible through getVoices() or accessed any other way?

louisfoster commented 11 months ago

Dave, you could look into building a small server (you could use a language like Deno or Node if you're familiar with JavaScript, or even Python). The server will run on localhost, similar to your RPi4 app, and you can make a request, which could execute the script to generate the data. Either return the generated file, or stream the data. JavaScript can be used to do the requests / play the audio, or you could do it without JS by using a form and returning a page with an audio element. No need to use the SpeechSynthesis API at all.

DaveEElliott commented 11 months ago

Thanks. That sounds doable. I was hoping to use SpeechSynthesis because I'm actually developing on a MacBook and deploying on the RPi4. Speech is fine on the MacBook using SpeechSynthesis and Apple's Samantha voice. Everything else is working on the RPi4, except the voices that come with eSpeak are really bad.

DaveEElliott commented 11 months ago

Does the rhasspy text-to-speech API endpoint support piper? I see many other tts systems supported here: https://rhasspy.readthedocs.io/en/latest/text-to-speech/