Merge pull request #246856 from mweinelt/piper-tts-1.2.0

piper-tts: 0.0.2 -> 1.2.0

authored by

Martin Weinelt and committed by
GitHub
fcf476cb fd3ce3bb

+198 -77
+60
pkgs/development/libraries/piper-phonemize/default.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + 5 + # build 6 + , cmake 7 + , pkg-config 8 + 9 + # runtime 10 + , espeak-ng 11 + , onnxruntime 12 + }: 13 + 14 + let 15 + espeak-ng' = espeak-ng.overrideAttrs (oldAttrs: { 16 + version = "1.52-dev"; 17 + src = fetchFromGitHub { 18 + owner = "rhasspy"; 19 + repo = "espeak-ng"; 20 + rev = "61504f6b76bf9ebbb39b07d21cff2a02b87c99ff"; 21 + hash = "sha256-RBHL11L5uazAFsPFwul2QIyJREXk9Uz8HTZx9JqmyIQ="; 22 + }; 23 + 24 + patches = [ 25 + ./espeak-mbrola.patch 26 + ]; 27 + }); 28 + in 29 + stdenv.mkDerivation rec { 30 + pname = "piper-phonemize"; 31 + version = "1.1.0"; 32 + 33 + src = fetchFromGitHub { 34 + owner = "rhasspy"; 35 + repo = "piper-phonemize"; 36 + rev = "refs/tags/v${version}"; 37 + hash = "sha256-cMer7CSLOXv3jc9huVA3Oy5cjXjOX9XuEXpIWau1BNQ="; 38 + }; 39 + 40 + nativeBuildInputs = [ 41 + cmake 42 + pkg-config 43 + ]; 44 + 45 + buildInputs = [ 46 + espeak-ng' 47 + onnxruntime 48 + ]; 49 + 50 + passthru = { 51 + espeak-ng = espeak-ng'; 52 + }; 53 + 54 + meta = with lib; { 55 + description = "C++ library for converting text to phonemes for Piper"; 56 + homepage = "https://github.com/rhasspy/piper-phonemize"; 57 + license = licenses.mit; 58 + maintainers = with maintainers; [ hexa ]; 59 + }; 60 + }
+26
pkgs/development/libraries/piper-phonemize/espeak-mbrola.patch
··· 1 + diff --git a/src/libespeak-ng/mbrowrap.c b/src/libespeak-ng/mbrowrap.c 2 + index ae137873..9015cc01 100644 3 + --- a/src/libespeak-ng/mbrowrap.c 4 + +++ b/src/libespeak-ng/mbrowrap.c 5 + @@ -206,7 +206,7 @@ static int start_mbrola(const char *voice_path) 6 + signal(SIGTERM, SIG_IGN); 7 + 8 + snprintf(charbuf, sizeof(charbuf), "%g", mbr_volume); 9 + - execlp("mbrola", "mbrola", "-e", "-v", charbuf, 10 + + execlp("@mbrola/bin/mbrola", "mbrola", "-e", "-v", charbuf, 11 + voice_path, "-", "-.wav", (char *)NULL); 12 + /* if execution reaches this point then the exec() failed */ 13 + snprintf(mbr_errorbuf, sizeof(mbr_errorbuf), 14 + diff --git a/src/libespeak-ng/synth_mbrola.c b/src/libespeak-ng/synth_mbrola.c 15 + index 734631b7..46d1f13e 100644 16 + --- a/src/libespeak-ng/synth_mbrola.c 17 + +++ b/src/libespeak-ng/synth_mbrola.c 18 + @@ -85,7 +85,7 @@ espeak_ng_STATUS LoadMbrolaTable(const char *mbrola_voice, const char *phtrans, 19 + if (!load_MBR()) 20 + return ENS_MBROLA_NOT_FOUND; 21 + 22 + - sprintf(path, "%s/mbrola/%s", path_home, mbrola_voice); 23 + + sprintf(path, "@mbrola@/share/mbrola/voices/%s/%s", mbrola_voice, mbrola_voice); 24 + #if PLATFORM_POSIX 25 + // if not found, then also look in 26 + // usr/share/mbrola/xx, /usr/share/mbrola/xx/xx, /usr/share/mbrola/voices/xx
+34
pkgs/development/python-modules/piper-phonemize/default.nix
··· 1 + { buildPythonPackage 2 + , onnxruntime-native 3 + , piper-phonemize-native 4 + , pybind11 5 + , setuptools 6 + }: 7 + 8 + buildPythonPackage { 9 + inherit (piper-phonemize-native) pname version src; 10 + format = "pyproject"; 11 + 12 + nativeBuildInputs = [ 13 + pybind11 14 + setuptools 15 + ]; 16 + 17 + buildInputs = [ 18 + onnxruntime-native 19 + piper-phonemize-native 20 + piper-phonemize-native.espeak-ng 21 + ]; 22 + 23 + pythonImportsCheck = [ 24 + "piper_phonemize" 25 + ]; 26 + 27 + # no tests 28 + doCheck = false; 29 + 30 + meta = { 31 + description = "Phonemization libary used by Piper text to speech system"; 32 + inherit (piper-phonemize-native.meta) homepage license maintainers; 33 + }; 34 + }
-60
pkgs/development/python-modules/piper-train/default.nix
··· 1 - { buildPythonPackage 2 - , piper-tts 3 - 4 - # build 5 - , cython 6 - , python 7 - 8 - # propagates 9 - , espeak-phonemizer 10 - , librosa 11 - , numpy 12 - , onnxruntime 13 - , pytorch-lightning 14 - , torch 15 - }: 16 - 17 - buildPythonPackage { 18 - inherit (piper-tts) version src meta; 19 - 20 - pname = "piper-train"; 21 - format = "setuptools"; 22 - 23 - sourceRoot = "source/src/python"; 24 - 25 - nativeBuildInputs = [ 26 - cython 27 - ]; 28 - 29 - postPatch = '' 30 - substituteInPlace requirements.txt \ 31 - --replace "onnxruntime~=1.11.0" "onnxruntime" \ 32 - --replace "pytorch-lightning~=1.7.0" "pytorch-lightning" \ 33 - --replace "torch~=1.11.0" "torch" 34 - ''; 35 - 36 - postBuild = '' 37 - make -C piper_train/vits/monotonic_align 38 - ''; 39 - 40 - postInstall = '' 41 - export MONOTONIC_ALIGN=$out/${python.sitePackages}/piper_train/vits/monotonic_align/monotonic_align 42 - mkdir -p $MONOTONIC_ALIGN 43 - cp -v ./piper_train/vits/monotonic_align/piper_train/vits/monotonic_align/core.*.so $MONOTONIC_ALIGN/ 44 - ''; 45 - 46 - propagatedBuildInputs = [ 47 - espeak-phonemizer 48 - librosa 49 - numpy 50 - onnxruntime 51 - pytorch-lightning 52 - torch 53 - ]; 54 - 55 - pythonImportsCheck = [ 56 - "piper_train" 57 - ]; 58 - 59 - doCheck = false; # no tests 60 - }
+18 -14
pkgs/tools/audio/piper/default.nix
··· 1 1 { lib 2 2 , stdenv 3 3 , fetchFromGitHub 4 + 5 + # build time 4 6 , cmake 5 7 , pkg-config 6 - , espeak-ng 8 + 9 + # runtime 7 10 , onnxruntime 8 11 , pcaudiolib 12 + , piper-phonemize 13 + , spdlog 14 + 15 + # tests 9 16 , piper-train 10 17 }: 11 18 12 19 let 13 20 pname = "piper"; 14 - version = "0.0.2"; 21 + version = "1.2.0"; 15 22 in 16 23 stdenv.mkDerivation { 17 24 inherit pname version; ··· 19 26 src = fetchFromGitHub { 20 27 owner = "rhasspy"; 21 28 repo = "piper"; 22 - rev = "70afec58bc131010c8993c154ff02a78d1e7b8b0"; 23 - hash = "sha256-zTW7RGcV8Hh7G6Braf27F/8s7nNjAqagp7tmrKO10BY="; 29 + rev = "refs/tags/v${version}"; 30 + hash = "sha256-6WNWqJt0PO86vnf+3iHaRRg2KwBOEj4aicmB+P2phlk="; 24 31 }; 25 32 26 33 sourceRoot = "source/src/cpp"; 27 34 28 - patches = [ 29 - ./fix-compilation-with-newer-onnxruntime.patch 30 - ]; 31 - 32 - postPatch = '' 33 - substituteInPlace CMakeLists.txt \ 34 - --replace "/usr/local/include/onnxruntime" "${onnxruntime}" 35 - ''; 36 - 37 35 nativeBuildInputs = [ 38 36 cmake 39 37 pkg-config 40 38 ]; 41 39 42 40 buildInputs = [ 43 - espeak-ng 44 41 onnxruntime 45 42 pcaudiolib 43 + piper-phonemize 44 + piper-phonemize.espeak-ng 45 + spdlog 46 + ]; 47 + 48 + env.NIX_CFLAGS_COMPILE = builtins.toString [ 49 + "-isystem ${lib.getDev piper-phonemize}/include/piper-phonemize" 46 50 ]; 47 51 48 52 installPhase = ''
+54
pkgs/tools/audio/piper/train.nix
··· 1 + { piper-tts 2 + , python3 3 + }: 4 + 5 + let 6 + python = python3.override { 7 + packageOverrides = self: super: { 8 + }; 9 + }; 10 + in 11 + 12 + python.pkgs.buildPythonPackage { 13 + inherit (piper-tts) version src; 14 + 15 + pname = "piper-train"; 16 + format = "setuptools"; 17 + 18 + sourceRoot = "source/src/python"; 19 + 20 + nativeBuildInputs = with python.pkgs; [ 21 + cython 22 + ]; 23 + 24 + postBuild = '' 25 + make -C piper_train/vits/monotonic_align 26 + ''; 27 + 28 + postInstall = '' 29 + export MONOTONIC_ALIGN=$out/${python.sitePackages}/piper_train/vits/monotonic_align/monotonic_align 30 + mkdir -p $MONOTONIC_ALIGN 31 + cp -v ./piper_train/vits/monotonic_align/piper_train/vits/monotonic_align/core.*.so $MONOTONIC_ALIGN/ 32 + ''; 33 + 34 + propagatedBuildInputs = with python.pkgs; [ 35 + espeak-phonemizer 36 + librosa 37 + numpy 38 + onnxruntime 39 + piper-phonemize 40 + pytorch-lightning 41 + torch 42 + ]; 43 + 44 + pythonImportsCheck = [ 45 + "piper_train" 46 + ]; 47 + 48 + doCheck = false; # no tests 49 + 50 + meta = piper-tts.meta // { 51 + # requires torch<2, pytorch-lightning~=1.7 52 + broken = true; 53 + }; 54 + }
+2 -1
pkgs/top-level/all-packages.nix
··· 11716 11716 11717 11717 pim6sd = callPackage ../servers/pim6sd { }; 11718 11718 11719 - piper-train = with python3Packages; toPythonApplication piper-train; 11719 + piper-phonemize = callPackage ../development/libraries/piper-phonemize { }; 11720 + piper-train = callPackage ../tools/audio/piper/train.nix { }; 11720 11721 piper-tts = callPackage ../tools/audio/piper { }; 11721 11722 11722 11723 phosh = callPackage ../applications/window-managers/phosh { };
-1
pkgs/top-level/python-aliases.nix
··· 184 184 jupyter_server = jupyter-server; # added 2023-01-05 185 185 Kajiki = kajiki; # added 2023-02-19 186 186 Keras = keras; # added 2021-11-25 187 - larynx-train = piper-train; # added 2023-06-09 188 187 ldap = python-ldap; # added 2022-09-16 189 188 lammps-cython = throw "lammps-cython no longer builds and is unmaintained"; # added 2021-07-04 190 189 logilab_astng = throw "logilab-astng has not been released since 2013 and is unmaintained"; # added 2022-11-29
+4 -1
pkgs/top-level/python-packages.nix
··· 7965 7965 7966 7966 pipenv-poetry-migrate = callPackage ../development/python-modules/pipenv-poetry-migrate { }; 7967 7967 7968 - piper-train = callPackage ../development/python-modules/piper-train { }; 7968 + piper-phonemize = callPackage ../development/python-modules/piper-phonemize { 7969 + onnxruntime-native = pkgs.onnxruntime; 7970 + piper-phonemize-native = pkgs.piper-phonemize; 7971 + }; 7969 7972 7970 7973 pip-api = callPackage ../development/python-modules/pip-api { }; 7971 7974