2323 daemon-scope : user
2424 activates-on : [speech-provider]
2525 environment :
26- ESPEAK_DATA_PATH : $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/espeak-ng-data
26+ # espeak-ng appends "espeak-ng-data" to this path; the matching data
27+ # snapshot is staged by the espeak-ng-data part
28+ ESPEAK_DATA_PATH : $SNAP/usr/share/piper
2729 LD_LIBRARY_PATH : $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio:$LD_LIBRARY_PATH
2830 plugs :
2931 - audio-playback
@@ -49,6 +51,28 @@ parts:
4951 - python3-tap
5052 - gi-docgen
5153
54+ # espeak-ng data matching the piper voices: the retrained voices on
55+ # huggingface were trained against the newer phoneme inventory shipped
56+ # by piper1-gpl (e.g. pt-BR "ɐ" where the distro's espeak-ng-data
57+ # package still produces "æ"), so phonemization must use the same data
58+ # snapshot as the reference piper. Staged under share/piper because the
59+ # distro espeak-ng-data (pulled in via libespeak-ng1) occupies the
60+ # default location; the app's ESPEAK_DATA_PATH points at its parent.
61+ espeak-ng-data :
62+ plugin : nil
63+ build-packages :
64+ - ca-certificates
65+ - curl
66+ - unzip
67+ override-build : |
68+ curl -L --fail --retry 3 -o "$CRAFT_PART_SRC/piper-tts.whl" \
69+ "https://github.com/OHF-Voice/piper1-gpl/releases/download/v1.8.0/piper_tts-1.8.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl"
70+ unzip -q "$CRAFT_PART_SRC/piper-tts.whl" 'piper/espeak-ng-data/*' \
71+ -d "$CRAFT_PART_SRC/piper-tts"
72+ mkdir -p "$CRAFT_PART_INSTALL/usr/share/piper"
73+ mv "$CRAFT_PART_SRC/piper-tts/piper/espeak-ng-data" \
74+ "$CRAFT_PART_INSTALL/usr/share/piper/espeak-ng-data"
75+
5276 speech-provider-piper :
5377 plugin : meson
5478 source : https://github.com/project-spiel/speech-provider-piper.git
@@ -59,11 +83,13 @@ parts:
5983 - rustup
6084 build-packages :
6185 - cmake
86+ - jq
6287 - libclang-dev
6388 - libespeak-ng-dev
89+ - patch
6490 stage-packages :
65- # Piper requires espeak-ng-data for phoneme generation
66- - espeak-ng-data
91+ # Runtime espeak-ng library; the espeak-ng-data snapshot matching the
92+ # retrained voices comes from the espeak-ng-data part above.
6793 - libespeak-ng1
6894 - libpulse0
6995 build-environment :
@@ -81,6 +107,22 @@ parts:
81107 rustup default "$RUSTUP_TOOLCHAIN"
82108 rustc --version
83109 cargo --version
110+ # Patch the sonata revision pinned by Cargo.lock before building:
111+ # current piper voice configs need sonata-piper changes that are
112+ # not in that pin (see patches/ for details and the verification
113+ # against piper's own phoneme id output).
114+ cargo fetch --manifest-path "$CRAFT_PART_SRC/Cargo.toml" --locked
115+ sonata_checkout_dir="$(cargo metadata --format-version 1 --locked \
116+ --manifest-path "$CRAFT_PART_SRC/Cargo.toml" \
117+ | jq -r '.packages[] | select(.name == "sonata-piper") | .manifest_path
118+ | rtrimstr("/Cargo.toml") | rtrimstr("/sonata/models/piper")')"
119+ # cargo reuses a previously fetched checkout, so skip the patch when
120+ # it is already applied to it
121+ if ! grep -q "vowel_clusters" \
122+ "$sonata_checkout_dir/sonata/models/piper/src/lib.rs"; then
123+ patch -d "$sonata_checkout_dir" -p1 \
124+ < "${CRAFT_PROJECT_DIR:-$SNAPCRAFT_PROJECT_DIR}/patches/sonata-piper-vowel-clusters.patch"
125+ fi
84126 craftctl default
85127
86128 voices-cs-cz-jirka-medium :
@@ -413,6 +455,28 @@ parts:
413455 meta/hooks/install : (component/voices-it-it-paola-medium)/meta/hooks/install
414456 meta/hooks/post-refresh : (component/voices-it-it-paola-medium)/meta/hooks/post-refresh
415457
458+ voices-nl-nl-pim-medium :
459+ plugin : dump
460+ source : ./component-base
461+ build-packages :
462+ - curl
463+ - ca-certificates
464+ override-build : |
465+ craftctl default
466+ set -eu
467+ mkdir -p "$CRAFT_PART_INSTALL/nl_NL-pim-medium"
468+ curl -L --fail --retry 3 \
469+ -o "$CRAFT_PART_INSTALL/nl_NL-pim-medium/nl_NL-pim-medium.onnx" \
470+ "https://huggingface.co/rhasspy/piper-voices/resolve/main/nl/nl_NL/pim/medium/nl_NL-pim-medium.onnx"
471+ curl -L --fail --retry 3 \
472+ -o "$CRAFT_PART_INSTALL/nl_NL-pim-medium/nl_NL-pim-medium.onnx.json" \
473+ "https://huggingface.co/rhasspy/piper-voices/resolve/main/nl/nl_NL/pim/medium/nl_NL-pim-medium.onnx.json"
474+ organize :
475+ nl_NL-pim-medium/nl_NL-pim-medium.onnx : (component/voices-nl-nl-pim-medium)/nl_NL-pim-medium.onnx
476+ nl_NL-pim-medium/nl_NL-pim-medium.onnx.json : (component/voices-nl-nl-pim-medium)/nl_NL-pim-medium.onnx.json
477+ meta/hooks/install : (component/voices-nl-nl-pim-medium)/meta/hooks/install
478+ meta/hooks/post-refresh : (component/voices-nl-nl-pim-medium)/meta/hooks/post-refresh
479+
416480 voices-no-no-talesyntese-medium :
417481 plugin : dump
418482 source : ./component-base
@@ -457,6 +521,28 @@ parts:
457521 meta/hooks/install : (component/voices-pl-pl-gosia-medium)/meta/hooks/install
458522 meta/hooks/post-refresh : (component/voices-pl-pl-gosia-medium)/meta/hooks/post-refresh
459523
524+ voices-pt-br-faber-medium :
525+ plugin : dump
526+ source : ./component-base
527+ build-packages :
528+ - curl
529+ - ca-certificates
530+ override-build : |
531+ craftctl default
532+ set -eu
533+ mkdir -p "$CRAFT_PART_INSTALL/pt_BR-faber-medium"
534+ curl -L --fail --retry 3 \
535+ -o "$CRAFT_PART_INSTALL/pt_BR-faber-medium/pt_BR-faber-medium.onnx" \
536+ "https://huggingface.co/rhasspy/piper-voices/resolve/main/pt/pt_BR/faber/medium/pt_BR-faber-medium.onnx"
537+ curl -L --fail --retry 3 \
538+ -o "$CRAFT_PART_INSTALL/pt_BR-faber-medium/pt_BR-faber-medium.onnx.json" \
539+ "https://huggingface.co/rhasspy/piper-voices/resolve/main/pt/pt_BR/faber/medium/pt_BR-faber-medium.onnx.json"
540+ organize :
541+ pt_BR-faber-medium/pt_BR-faber-medium.onnx : (component/voices-pt-br-faber-medium)/pt_BR-faber-medium.onnx
542+ pt_BR-faber-medium/pt_BR-faber-medium.onnx.json : (component/voices-pt-br-faber-medium)/pt_BR-faber-medium.onnx.json
543+ meta/hooks/install : (component/voices-pt-br-faber-medium)/meta/hooks/install
544+ meta/hooks/post-refresh : (component/voices-pt-br-faber-medium)/meta/hooks/post-refresh
545+
460546 voices-ro-ro-mihai-medium :
461547 plugin : dump
462548 source : ./component-base
@@ -681,6 +767,15 @@ components:
681767 install : {}
682768 post-refresh : {}
683769
770+ voices-nl-nl-pim-medium :
771+ type : standard
772+ summary : nl-NL pim voice for Piper
773+ description : nl-NL pim voice for Piper
774+ version : ' 0.1'
775+ hooks :
776+ install : {}
777+ post-refresh : {}
778+
684779 voices-no-no-talesyntese-medium :
685780 type : standard
686781 summary : no-NO talesyntese voice for Piper
@@ -699,6 +794,15 @@ components:
699794 install : {}
700795 post-refresh : {}
701796
797+ voices-pt-br-faber-medium :
798+ type : standard
799+ summary : pt-BR faber voice for Piper
800+ description : pt-BR faber voice for Piper
801+ version : ' 0.1'
802+ hooks :
803+ install : {}
804+ post-refresh : {}
805+
702806 voices-ro-ro-mihai-medium :
703807 type : standard
704808 summary : ro-RO mihai voice for Piper
0 commit comments