diff options
author | Martin Weinelt <hexa@darmstadt.ccc.de> | 2023-06-30 01:37:40 +0200 |
---|---|---|
committer | Martin Weinelt <hexa@darmstadt.ccc.de> | 2023-08-03 02:10:52 +0200 |
commit | 14329c27de642c4d1ccbef2eb710c2824398ad75 (patch) | |
tree | 86c25634566159d0e038fae3fd7480e4dba1bafd /pkgs/development | |
parent | 6e877eacf22c78b068442eea7680d68c2cca961d (diff) |
piper-phonemize: init at 1.1.0
C++ library for converting text to phonemes for Piper
Diffstat (limited to 'pkgs/development')
-rw-r--r-- | pkgs/development/libraries/piper-phonemize/default.nix | 73 | ||||
-rw-r--r-- | pkgs/development/libraries/piper-phonemize/espeak-mbrola.patch | 26 |
2 files changed, 99 insertions, 0 deletions
diff --git a/pkgs/development/libraries/piper-phonemize/default.nix b/pkgs/development/libraries/piper-phonemize/default.nix new file mode 100644 index 0000000000000..137625355ec30 --- /dev/null +++ b/pkgs/development/libraries/piper-phonemize/default.nix @@ -0,0 +1,73 @@ +{ 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="; + }; + + outputs = [ + "out" + "dev" + ]; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + buildInputs = [ + espeak-ng' + onnxruntime + ]; + + ainstallPhase = '' + runHook preInstall + + install -d $out/lib + install ./libpiper_phonemize.so $out/lib + + install -d $dev/include/piper_phonemize + install -D ../src/*.hpp $dev/include + + runHook postInstall + ''; + + 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 ]; + }; +} diff --git a/pkgs/development/libraries/piper-phonemize/espeak-mbrola.patch b/pkgs/development/libraries/piper-phonemize/espeak-mbrola.patch new file mode 100644 index 0000000000000..9d3f0aeb4abe6 --- /dev/null +++ b/pkgs/development/libraries/piper-phonemize/espeak-mbrola.patch @@ -0,0 +1,26 @@ +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 |