artibex / piper-http

Creates a docker image that runs the piper http service
https://hub.docker.com/r/artibex/piper-http
MIT License
6 stars 4 forks source link

[Feature] Add ENV to select speaker #1

Closed ErroneousBosch closed 4 months ago

ErroneousBosch commented 6 months ago

Since each voice set contains multiple speakers, a way to select them would be a key feature

ErroneousBosch commented 6 months ago

Might be helpful to add in some of the other arguments as well, but that may be more than people want to bother configuring

ErroneousBosch commented 6 months ago

Not sure if you want to also add ENVs for the other options as well.

artibex commented 6 months ago

You can provide a direct download link from the voices repo from huggingface for example this one here:

https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_GB/jenny_dioco/medium/en_GB-jenny_dioco-medium.onnx?download=true

to create a container with this voice use this: docker run -e MODEL_DOWNLOAD_LINK=https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_GB/jenny_dioco/medium/en_GB-jenny_dioco-medium.onnx?download=true --name piper -p 5000:5000 artibex/piper-http

With the ENV MODEL_DOWNLOAD_LINK you should be able to download every model that you want from the huggingface repo (or change in the Dockerfile the URL)

If you need other voices just spin up a second piper-http container on a different port

ErroneousBosch commented 6 months ago

That lets us define the model, but some voice models have multiple "speakers". You can see a demonstration of this at https://rhasspy.github.io/piper-samples/

For German, the "mls" voice has 235 "speakers" in it. US English "libritts_r" has over 900.

The piper command like takes this as -s for the argument. The http_server script has quite a few options passable

artibex commented 6 months ago

@ErroneousBosch I added the ENV SPEAKER which runs the http server with -s <your number> and default is 0

Let me know if it works for you

Example: docker run -e SPEAKER=12 --name piper -p 5000:5000 artibex/piper-http