Loading pkgs/development/libraries/piper-phonemize/default.nix 0 → 100644 +60 −0 Original line number Diff line number Diff line { lib , stdenv , fetchFromGitHub # build , cmake , pkg-config # runtime , espeak-ng , onnxruntime }: let espeak-ng' = espeak-ng.overrideAttrs (oldAttrs: { version = "1.52-dev"; src = fetchFromGitHub { owner = "rhasspy"; repo = "espeak-ng"; rev = "61504f6b76bf9ebbb39b07d21cff2a02b87c99ff"; hash = "sha256-RBHL11L5uazAFsPFwul2QIyJREXk9Uz8HTZx9JqmyIQ="; }; patches = [ ./espeak-mbrola.patch ]; }); in stdenv.mkDerivation rec { pname = "piper-phonemize"; version = "1.1.0"; src = fetchFromGitHub { owner = "rhasspy"; repo = "piper-phonemize"; rev = "refs/tags/v${version}"; hash = "sha256-cMer7CSLOXv3jc9huVA3Oy5cjXjOX9XuEXpIWau1BNQ="; }; nativeBuildInputs = [ cmake pkg-config ]; buildInputs = [ espeak-ng' onnxruntime ]; passthru = { espeak-ng = espeak-ng'; }; meta = with lib; { description = "C++ library for converting text to phonemes for Piper"; homepage = "https://github.com/rhasspy/piper-phonemize"; license = licenses.mit; maintainers = with maintainers; [ hexa ]; }; } pkgs/development/libraries/piper-phonemize/espeak-mbrola.patch 0 → 100644 +26 −0 Original line number Diff line number Diff line diff --git a/src/libespeak-ng/mbrowrap.c b/src/libespeak-ng/mbrowrap.c index ae137873..9015cc01 100644 --- a/src/libespeak-ng/mbrowrap.c +++ b/src/libespeak-ng/mbrowrap.c @@ -206,7 +206,7 @@ static int start_mbrola(const char *voice_path) signal(SIGTERM, SIG_IGN); snprintf(charbuf, sizeof(charbuf), "%g", mbr_volume); - execlp("mbrola", "mbrola", "-e", "-v", charbuf, + execlp("@mbrola/bin/mbrola", "mbrola", "-e", "-v", charbuf, voice_path, "-", "-.wav", (char *)NULL); /* if execution reaches this point then the exec() failed */ snprintf(mbr_errorbuf, sizeof(mbr_errorbuf), diff --git a/src/libespeak-ng/synth_mbrola.c b/src/libespeak-ng/synth_mbrola.c index 734631b7..46d1f13e 100644 --- a/src/libespeak-ng/synth_mbrola.c +++ b/src/libespeak-ng/synth_mbrola.c @@ -85,7 +85,7 @@ espeak_ng_STATUS LoadMbrolaTable(const char *mbrola_voice, const char *phtrans, if (!load_MBR()) return ENS_MBROLA_NOT_FOUND; - sprintf(path, "%s/mbrola/%s", path_home, mbrola_voice); + sprintf(path, "@mbrola@/share/mbrola/voices/%s/%s", mbrola_voice, mbrola_voice); #if PLATFORM_POSIX // if not found, then also look in // usr/share/mbrola/xx, /usr/share/mbrola/xx/xx, /usr/share/mbrola/voices/xx pkgs/development/python-modules/piper-phonemize/default.nix 0 → 100644 +34 −0 Original line number Diff line number Diff line { buildPythonPackage , onnxruntime-native , piper-phonemize-native , pybind11 , setuptools }: buildPythonPackage { inherit (piper-phonemize-native) pname version src; format = "pyproject"; nativeBuildInputs = [ pybind11 setuptools ]; buildInputs = [ onnxruntime-native piper-phonemize-native piper-phonemize-native.espeak-ng ]; pythonImportsCheck = [ "piper_phonemize" ]; # no tests doCheck = false; meta = { description = "Phonemization libary used by Piper text to speech system"; inherit (piper-phonemize-native.meta) homepage license maintainers; }; } pkgs/tools/audio/piper/default.nix +18 −14 Original line number Diff line number Diff line { lib , stdenv , fetchFromGitHub # build time , cmake , pkg-config , espeak-ng # runtime , onnxruntime , pcaudiolib , piper-phonemize , spdlog # tests , piper-train }: let pname = "piper"; version = "0.0.2"; version = "1.2.0"; in stdenv.mkDerivation { inherit pname version; Loading @@ -19,30 +26,27 @@ stdenv.mkDerivation { src = fetchFromGitHub { owner = "rhasspy"; repo = "piper"; rev = "70afec58bc131010c8993c154ff02a78d1e7b8b0"; hash = "sha256-zTW7RGcV8Hh7G6Braf27F/8s7nNjAqagp7tmrKO10BY="; rev = "refs/tags/v${version}"; hash = "sha256-6WNWqJt0PO86vnf+3iHaRRg2KwBOEj4aicmB+P2phlk="; }; sourceRoot = "source/src/cpp"; patches = [ ./fix-compilation-with-newer-onnxruntime.patch ]; postPatch = '' substituteInPlace CMakeLists.txt \ --replace "/usr/local/include/onnxruntime" "${onnxruntime}" ''; nativeBuildInputs = [ cmake pkg-config ]; buildInputs = [ espeak-ng onnxruntime pcaudiolib piper-phonemize piper-phonemize.espeak-ng spdlog ]; env.NIX_CFLAGS_COMPILE = builtins.toString [ "-isystem ${lib.getDev piper-phonemize}/include/piper-phonemize" ]; installPhase = '' Loading pkgs/development/python-modules/piper-train/default.nix→pkgs/tools/audio/piper/train.nix +19 −25 Original line number Diff line number Diff line { buildPythonPackage , piper-tts # build , cython , python # propagates , espeak-phonemizer , librosa , numpy , onnxruntime , pytorch-lightning , torch { piper-tts , python3 }: buildPythonPackage { inherit (piper-tts) version src meta; let python = python3.override { packageOverrides = self: super: { }; }; in python.pkgs.buildPythonPackage { inherit (piper-tts) version src; pname = "piper-train"; format = "setuptools"; sourceRoot = "source/src/python"; nativeBuildInputs = [ nativeBuildInputs = with python.pkgs; [ cython ]; postPatch = '' substituteInPlace requirements.txt \ --replace "onnxruntime~=1.11.0" "onnxruntime" \ --replace "pytorch-lightning~=1.7.0" "pytorch-lightning" \ --replace "torch~=1.11.0" "torch" ''; postBuild = '' make -C piper_train/vits/monotonic_align ''; Loading @@ -43,11 +31,12 @@ buildPythonPackage { cp -v ./piper_train/vits/monotonic_align/piper_train/vits/monotonic_align/core.*.so $MONOTONIC_ALIGN/ ''; propagatedBuildInputs = [ propagatedBuildInputs = with python.pkgs; [ espeak-phonemizer librosa numpy onnxruntime piper-phonemize pytorch-lightning torch ]; Loading @@ -57,4 +46,9 @@ buildPythonPackage { ]; doCheck = false; # no tests meta = piper-tts.meta // { # requires torch<2, pytorch-lightning~=1.7 broken = true; }; } Loading
pkgs/development/libraries/piper-phonemize/default.nix 0 → 100644 +60 −0 Original line number Diff line number Diff line { lib , stdenv , fetchFromGitHub # build , cmake , pkg-config # runtime , espeak-ng , onnxruntime }: let espeak-ng' = espeak-ng.overrideAttrs (oldAttrs: { version = "1.52-dev"; src = fetchFromGitHub { owner = "rhasspy"; repo = "espeak-ng"; rev = "61504f6b76bf9ebbb39b07d21cff2a02b87c99ff"; hash = "sha256-RBHL11L5uazAFsPFwul2QIyJREXk9Uz8HTZx9JqmyIQ="; }; patches = [ ./espeak-mbrola.patch ]; }); in stdenv.mkDerivation rec { pname = "piper-phonemize"; version = "1.1.0"; src = fetchFromGitHub { owner = "rhasspy"; repo = "piper-phonemize"; rev = "refs/tags/v${version}"; hash = "sha256-cMer7CSLOXv3jc9huVA3Oy5cjXjOX9XuEXpIWau1BNQ="; }; nativeBuildInputs = [ cmake pkg-config ]; buildInputs = [ espeak-ng' onnxruntime ]; passthru = { espeak-ng = espeak-ng'; }; meta = with lib; { description = "C++ library for converting text to phonemes for Piper"; homepage = "https://github.com/rhasspy/piper-phonemize"; license = licenses.mit; maintainers = with maintainers; [ hexa ]; }; }
pkgs/development/libraries/piper-phonemize/espeak-mbrola.patch 0 → 100644 +26 −0 Original line number Diff line number Diff line diff --git a/src/libespeak-ng/mbrowrap.c b/src/libespeak-ng/mbrowrap.c index ae137873..9015cc01 100644 --- a/src/libespeak-ng/mbrowrap.c +++ b/src/libespeak-ng/mbrowrap.c @@ -206,7 +206,7 @@ static int start_mbrola(const char *voice_path) signal(SIGTERM, SIG_IGN); snprintf(charbuf, sizeof(charbuf), "%g", mbr_volume); - execlp("mbrola", "mbrola", "-e", "-v", charbuf, + execlp("@mbrola/bin/mbrola", "mbrola", "-e", "-v", charbuf, voice_path, "-", "-.wav", (char *)NULL); /* if execution reaches this point then the exec() failed */ snprintf(mbr_errorbuf, sizeof(mbr_errorbuf), diff --git a/src/libespeak-ng/synth_mbrola.c b/src/libespeak-ng/synth_mbrola.c index 734631b7..46d1f13e 100644 --- a/src/libespeak-ng/synth_mbrola.c +++ b/src/libespeak-ng/synth_mbrola.c @@ -85,7 +85,7 @@ espeak_ng_STATUS LoadMbrolaTable(const char *mbrola_voice, const char *phtrans, if (!load_MBR()) return ENS_MBROLA_NOT_FOUND; - sprintf(path, "%s/mbrola/%s", path_home, mbrola_voice); + sprintf(path, "@mbrola@/share/mbrola/voices/%s/%s", mbrola_voice, mbrola_voice); #if PLATFORM_POSIX // if not found, then also look in // usr/share/mbrola/xx, /usr/share/mbrola/xx/xx, /usr/share/mbrola/voices/xx
pkgs/development/python-modules/piper-phonemize/default.nix 0 → 100644 +34 −0 Original line number Diff line number Diff line { buildPythonPackage , onnxruntime-native , piper-phonemize-native , pybind11 , setuptools }: buildPythonPackage { inherit (piper-phonemize-native) pname version src; format = "pyproject"; nativeBuildInputs = [ pybind11 setuptools ]; buildInputs = [ onnxruntime-native piper-phonemize-native piper-phonemize-native.espeak-ng ]; pythonImportsCheck = [ "piper_phonemize" ]; # no tests doCheck = false; meta = { description = "Phonemization libary used by Piper text to speech system"; inherit (piper-phonemize-native.meta) homepage license maintainers; }; }
pkgs/tools/audio/piper/default.nix +18 −14 Original line number Diff line number Diff line { lib , stdenv , fetchFromGitHub # build time , cmake , pkg-config , espeak-ng # runtime , onnxruntime , pcaudiolib , piper-phonemize , spdlog # tests , piper-train }: let pname = "piper"; version = "0.0.2"; version = "1.2.0"; in stdenv.mkDerivation { inherit pname version; Loading @@ -19,30 +26,27 @@ stdenv.mkDerivation { src = fetchFromGitHub { owner = "rhasspy"; repo = "piper"; rev = "70afec58bc131010c8993c154ff02a78d1e7b8b0"; hash = "sha256-zTW7RGcV8Hh7G6Braf27F/8s7nNjAqagp7tmrKO10BY="; rev = "refs/tags/v${version}"; hash = "sha256-6WNWqJt0PO86vnf+3iHaRRg2KwBOEj4aicmB+P2phlk="; }; sourceRoot = "source/src/cpp"; patches = [ ./fix-compilation-with-newer-onnxruntime.patch ]; postPatch = '' substituteInPlace CMakeLists.txt \ --replace "/usr/local/include/onnxruntime" "${onnxruntime}" ''; nativeBuildInputs = [ cmake pkg-config ]; buildInputs = [ espeak-ng onnxruntime pcaudiolib piper-phonemize piper-phonemize.espeak-ng spdlog ]; env.NIX_CFLAGS_COMPILE = builtins.toString [ "-isystem ${lib.getDev piper-phonemize}/include/piper-phonemize" ]; installPhase = '' Loading
pkgs/development/python-modules/piper-train/default.nix→pkgs/tools/audio/piper/train.nix +19 −25 Original line number Diff line number Diff line { buildPythonPackage , piper-tts # build , cython , python # propagates , espeak-phonemizer , librosa , numpy , onnxruntime , pytorch-lightning , torch { piper-tts , python3 }: buildPythonPackage { inherit (piper-tts) version src meta; let python = python3.override { packageOverrides = self: super: { }; }; in python.pkgs.buildPythonPackage { inherit (piper-tts) version src; pname = "piper-train"; format = "setuptools"; sourceRoot = "source/src/python"; nativeBuildInputs = [ nativeBuildInputs = with python.pkgs; [ cython ]; postPatch = '' substituteInPlace requirements.txt \ --replace "onnxruntime~=1.11.0" "onnxruntime" \ --replace "pytorch-lightning~=1.7.0" "pytorch-lightning" \ --replace "torch~=1.11.0" "torch" ''; postBuild = '' make -C piper_train/vits/monotonic_align ''; Loading @@ -43,11 +31,12 @@ buildPythonPackage { cp -v ./piper_train/vits/monotonic_align/piper_train/vits/monotonic_align/core.*.so $MONOTONIC_ALIGN/ ''; propagatedBuildInputs = [ propagatedBuildInputs = with python.pkgs; [ espeak-phonemizer librosa numpy onnxruntime piper-phonemize pytorch-lightning torch ]; Loading @@ -57,4 +46,9 @@ buildPythonPackage { ]; doCheck = false; # no tests meta = piper-tts.meta // { # requires torch<2, pytorch-lightning~=1.7 broken = true; }; }