Package Details: piper-tts-bin 2023.11.14-1

Git Clone URL: https://aur.archlinux.org/piper-tts-bin.git (read-only, click to copy)
Package Base: piper-tts-bin
Description: A fast, local neural text to speech system
Upstream URL: https://github.com/rhasspy/piper
Licenses: MIT
Provides: piper-tts
Submitter: AUR-user
Maintainer: AUR-user
Last Packager: AUR-user
Votes: 6
Popularity: 1.80
First Submitted: 2023-06-28 20:43 (UTC)
Last Updated: 2024-01-24 20:38 (UTC)

Latest Comments

SysGhost commented on 2024-04-17 12:20 (UTC) (edited on 2024-04-17 12:30 (UTC) by SysGhost)

No longer works

Some problem with onnxrutime.

echo 'Welcome to the world of speech synthesis!' | piper-tts --model /usr/share/piper-voices/en/en_GB/alan/low/en_GB-alan-low.onnx --output_file welcome.wav
terminate called after throwing an instance of 'Ort::Exception'
  what():  Load model from /usr/share/piper-voices/en/en_GB/alan/low/en_GB-alan-low.onnx failed:Protobuf parsing failed.

AlphaJack commented on 2024-03-12 00:09 (UTC)

@jouven I've added these files to piper-voices-common and its "install" file

jouven commented on 2024-03-11 22:58 (UTC) (edited on 2024-03-11 23:19 (UTC) by jouven)

Best tts for real time text, if hardware allows it, then again it's the fastest one with high quality audio.
My setup:
For ~/.config/speech-dispatcher/speechd.conf add and leave only this AddModule line uncommented:

AddModule "piper-tts-generic"   "sd_generic"    "piper-tts-generic.conf"

Create ~/.config/speech-dispatcher/modules/piper-tts-generic.conf with:

GenericExecuteSynth "echo \'$DATA\' | piper-tts -q -m \"/somemodeldirectory/en_US-libritts-high.onnx\" -s 21 -f - | mpv --volume=80 --no-terminal --keep-open=no -"
#GenericExecuteSynth "echo \'$DATA\' | piper-tts -q -m \"/somemodeldirectory/en_US-libritts-high.onnx\" -s 21 --output-raw | aplay -r 22050 -f S16_LE -t raw -"
AddVoice "en" "male1"   "kal16"

However how to prevent the variation, without making it sound robotic? I'm talking --noise_scale, by default the value of this setting, If I spam the same text, there is some randomness about how it sounds each time but sometimes the "same" delivery sounds noticeably wrong, but if use --noise_scale 0 it always sounds robotic.
@Edit, this last issue has to do with the model, other models don't have this issue.

AlphaJack commented on 2024-01-18 20:44 (UTC) (edited on 2024-02-28 13:19 (UTC) by AlphaJack)

Thank you for adding a link to the armv7h binary.

I've created a new AUR packages with piper voices:

https://aur.archlinux.org/packages/piper-voices-minimal (1 model, ~120MB)

https://aur.archlinux.org/pkgbase/piper-voices (one split package per locale, ~6GB for all locales)

Can you add something similar to the PKGBUILD?

optdepends=("piper-voices: voices for all languages")

AlphaJack commented on 2024-01-18 18:35 (UTC)

Hi, can you also add support for armv7h?

mrickma commented on 2023-10-20 20:57 (UTC) (edited on 2023-10-20 21:01 (UTC) by mrickma)

Thank you for the package, I really love piper. I am using it regularly now having upgraded to version 2023.9.27-1. Firefox is reading German and English news aloud using piper-tts via speech dispatcher. The setup was a bit difficult. I made three files: ~/.config/speech-dispatcher/speechd.conf

AddModule "piper-generic" "sd_generic" "piper-generic.conf"
DefaultModule piper-generic
DefaultVoiceType  "MALE1"
DefaultLanguage "en-US"

~/.config/speech-dispatcher/modules/piper-generic.conf

Debug “1”

GenericExecuteSynth \
"env DATA="\"$DATA\"" VOICE="\"$VOICE\" " RATE="\"$RATE\"" \
 /opt/piper-tts/piper-pipe"

GenericCmdDependency "piper-tts"

AddVoice "de"    "MALE1"    "de_DE-thorsten-medium"
AddVoice "de"    "FEMALE1"  "de_DE-kerstin-low"
AddVoice "en-us" "MALE1"    "en_US-lessac-medium"
AddVoice "en-gb" "FEMALE1"  "en_GB-jenny_dioco-medium"
AddVoice "en-us" "FEMALE2"  "en_US-amy-medium"
AddVoice "en-us" "FEMALE3"  "ljspeech-high"

DefaultVoice “de_DE-thorsten-medium”

and executable /opt/piper-tts/piper-pipe

#!/bin/bash

VOICE_PATH="/opt/piper-tts/voices"

if [[ ${VOICE: -3} = low ]]; then
  ADJ_RATE=16000
else
  ADJ_RATE=22050
fi
ADJ_RATE=$((${RATE::-3} * 30 + $ADJ_RATE))
echo "$DATA" | piper-tts --model $VOICE_PATH/$VOICE.onnx  --output-raw | \
aplay -r $ADJ_RATE -f S16_LE -t raw -

wait

My setup can accommodate the different qualities of piper’s speech models. The high ones cause a bit of latency on my 6 year old core-i3 notebook. Additionally I can turn down speed for foreign languages. Fortunately aplay used pulseaudio as default device. I hope that this helps others to get started.

Sdar commented on 2023-10-09 14:39 (UTC) (edited on 2023-10-09 14:40 (UTC) by Sdar)

:( i was using this alongside speech dispatcher for using it mainly with mumble (read mute/unmute status and chat messages) but since last update 1.2.0-1 it only works for the first message and then stops working, spd-say does work a little better but sometimes it gets stuck and you have to use pkill sd_generic

I was using this before as speech dispatcher module for piper (1.0.0-1)

GenericExecuteSynth "echo '$DATA' | /usr/lib/piper/piper --model /usr/lib/piper/es-carlfm-x-low.onnx -c /usr/lib/piper/es-carlfm-x-low.onnx.json -f /tmp/speech.wav && $PLAY_COMMAND /tmp/speech.wav"`
GenericCmdDependency "piper-generic"`
AddVoice "es-ES" "MALE1" "es-carlfm-x-low.onnx"`

and changed the first line to the correct (opt folder) path after updating and even tried just calling for piper-tts, as i said it works but not reliably, not sure if it's something with the new package settings or has something to do with the new version.

AUR-user commented on 2023-07-09 09:11 (UTC)

I moved everything to /opt so users can still install espeak-ng in parallel.

Voices and configs shouldn't be part of this package as it would increase size dramatically and I assume in general users need only one or two voices.

The (currently) only user of piper-tts https://aur.archlinux.org/packages/python-wyoming-piper downloads voices and configs automatically if they are not available.

necklace commented on 2023-07-08 15:19 (UTC) (edited on 2023-07-08 19:13 (UTC) by necklace)

Currently this package seems to be putting everything into /usr/lib/ which is not ideal.

The piper binary in this package will also conflict with a command from a package called piper which is in the official extra repo, so I recommend renaming the piper binary to piper-tts.

In addition, piper-tts packages a fork of espeak-ng in the .tar.gz, these files could be a dependency instead but that would have to be separated out as a different AUR package since it is a fork. Instead, a lesser solution is to simply conflict this package with espeak-ng.

So, I propose changing the PKGBUILD to something like this:

pkgname=piper-tts-bin
pkgver=1.0.0
pkgrel=2
pkgdesc="A fast, local neural text to speech system"
arch=('x86_64' 'aarch64')
url="https://github.com/rhasspy/piper"
license=('MIT')
conflicts=('espeak-ng')
provides=('piper-tts')

source_x86_64=("https://github.com/rhasspy/piper/releases/download/v${pkgver}/piper_amd64.tar.gz")
source_aarch64=("https://github.com/rhasspy/piper/releases/download/v${pkgver}/piper_arm64.tar.gz")
sha256sums_x86_64=('6309a3660c28e6b05977831422c1e8c14f63f18175e1bb4e6d802f1dfd096776')
sha256sums_aarch64=('7ad77c0f5f1917f49401bf335b87ccbab803972c055c8abe6967b2e71d1e4c55')

package() {

  install -d ${pkgdir}/usr/share/
  cp -r ${srcdir}/piper/espeak-ng-data ${pkgdir}/usr/share/
  chown -R root:root ${pkgdir}/usr/share/espeak-ng-data
  chmod -R 755 ${pkgdir}/usr/share/espeak-ng-data
  install -D ${srcdir}/piper/libespeak-ng.so ${pkgdir}/usr/lib/libespeak-ng.so
  install -D ${srcdir}/piper/libespeak-ng.so.1 ${pkgdir}/usr/lib/libespeak-ng.so.1
  install -D ${srcdir}/piper/libespeak-ng.so.1.1.51 ${pkgdir}/usr/lib/libespeak-ng.so.1.1.51
  install -D ${srcdir}/piper/libonnxruntime.so.1.14.1 ${pkgdir}/usr/lib/libonnxruntime.so.1.14.1
  install -D ${srcdir}/piper/libpiper_phonemize.so ${pkgdir}/usr/lib/libpiper_phonemize.so
  install -D ${srcdir}/piper/libtashkeel_model.ort ${pkgdir}/usr/share/piper/libtashkeel_model.ort
  install -D -m755 ${srcdir}/piper/piper ${pkgdir}/usr/bin/piper-tts
}

This way, piper is in $PATH and is callable as piper-tts from a terminal, the libs are where they should be and the data in usr/share.

I'm unsure if this package should download the voices and configs from https://github.com/rhasspy/piper/releases/tag/v0.0.2 and huggingface or if they should be split into a separate package. Maybe separate them into language packages, many ways of doing it.

Either way, with this new proposed PKGBUILD I finally got it working after I downloaded the voices:

echo 'Hello, World!' | piper-tts --model en_US-amy-medium.onnx --config en_US-amy-medium.onnx.json

Works!