From dd0a412dfab311af1241e619ea11595f45d02b06 Mon Sep 17 00:00:00 2001 From: Kenneth Raplee Date: Fri, 6 Jun 2025 03:33:13 -0700 Subject: audio/piper: Fast and local text to speech system Pull Request: https://github.com/freebsd/freebsd-ports/pull/406 Co-authored-by: Gleb Popov --- audio/piper/files/patch-src_cpp_piper.cpp | 61 +++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 audio/piper/files/patch-src_cpp_piper.cpp (limited to 'audio/piper/files/patch-src_cpp_piper.cpp') diff --git a/audio/piper/files/patch-src_cpp_piper.cpp b/audio/piper/files/patch-src_cpp_piper.cpp new file mode 100644 index 000000000000..51f672629560 --- /dev/null +++ b/audio/piper/files/patch-src_cpp_piper.cpp @@ -0,0 +1,61 @@ +--- src/cpp/piper.cpp.orig ++++ src/cpp/piper.cpp +@@ -6,7 +6,7 @@ + #include + + #include +-#include ++#include + #include + + #include "json.hpp" +@@ -229,22 +229,6 @@ void initialize(PiperConfig &config) { + spdlog::debug("Initialized eSpeak"); + } + +- // Load onnx model for libtashkeel +- // https://github.com/mush42/libtashkeel/ +- if (config.useTashkeel) { +- spdlog::debug("Using libtashkeel for diacritization"); +- if (!config.tashkeelModelPath) { +- throw std::runtime_error("No path to libtashkeel model"); +- } +- +- spdlog::debug("Loading libtashkeel model from {}", +- config.tashkeelModelPath.value()); +- config.tashkeelState = std::make_unique(); +- tashkeel::tashkeel_load(config.tashkeelModelPath.value(), +- *config.tashkeelState); +- spdlog::debug("Initialized libtashkeel"); +- } +- + spdlog::info("Initialized piper"); + } + +@@ -447,15 +431,6 @@ void textToAudio(PiperConfig &config, Voice &voice, std::string text, + voice.synthesisConfig.sampleRate * voice.synthesisConfig.channels); + } + +- if (config.useTashkeel) { +- if (!config.tashkeelState) { +- throw std::runtime_error("Tashkeel model is not loaded"); +- } +- +- spdlog::debug("Diacritizing text with libtashkeel: {}", text); +- text = tashkeel::tashkeel_run(text, *config.tashkeelState); +- } +- + // Phonemes for each sentence + spdlog::debug("Phonemizing text: {}", text); + std::vector> phonemes; +--- src/cpp/piper.hpp.orig ++++ src/cpp/piper.hpp +@@ -8,7 +8,7 @@ + #include + #include + +-#include ++#include + #include + #include + #include -- cgit v1.2.3