From nobody Tue Jun 17 07:28:05 2025 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bLz4612s8z5q1Pf; Tue, 17 Jun 2025 07:28:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bLz4540hXz3fpJ; Tue, 17 Jun 2025 07:28:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750145285; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9X1HQ4JskLnlzKYuxqlrYGytZ9i8JakW1M7HIYZxxRw=; b=i/SoqnUxQU7s2tCHJMC606G32WXw3VOve/5mF7mClmUEKg/4MCqCR0jcv0YfRhdISvSHWz Jdpyw0mkqvpui6WUkwLFcvZ8TthibiTNJW/NHDnpe7R6RXnyxTwmZveHmcsmt7nDFb62QK 4EkfRgIBwURUOG/FGcbggAMpiG2X5NkhKz6huWoE147k5a0i8MByNGV7pFj/r/YIAwT7rD mp9FfyC625DwaFNZWX054UXzPUvJ8ROCRB+Sr4o2chH/faKiZVca9QEiLXY+FxuPgms8Jl ha1CWPo7/cLhO8Iwv+yX8D5nECmrlkb/GfY2Us95LaezpVayZJlVjw67CQIPfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750145285; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9X1HQ4JskLnlzKYuxqlrYGytZ9i8JakW1M7HIYZxxRw=; b=EQ2sdlewOgo9lQgFKqTxngi4636ZWsATfSbHdCAtpGldkgkhlKm51n/Zptmjw2LuOSix/E 4/mwt5AHkk2JLp5R/ZdxjqcNdRvIBAb5rgOj3FqhlqgxqY5AC+gUGA9N9bEmtpawPnOGB4 wz+CaogOo0AdZlcrDCOmLNAdSUlt5Md9OkIR8nDduFYBG4WCKAPJApSePcLlqfan7npjuB ACVi2c9MVqJv2pSwMom+WgmNXCAM3yrQ5EpS8JeKkv4DzHOFIxQpB3/vKODYb3wGPO2YUO FmWibSIjVDuIl79Ph6nsbsg63u7I7jcA5QQQwLymah953HEPYCBg17PeiKitrA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750145285; a=rsa-sha256; cv=none; b=QyxPvOnE37qPBGB5FLm7Iy65HooQVIqkDfQetoMUPS0s3cZfwfxeZfJiFtu3I6lSWGKeJZ Hez2qRTyuThcaokBCqyGLvimG8xutr6u3+yttaPDTSRSJVdPgwnyExbn6fBMX2dx80y0pF YRJFFq5KJ8baXeb2fc2f+NC8Rv1mHeHKv5H2XA8O/2RVTLjN5/rX71268MNmXdJMTQwuen Ruqd3Df2wNDzW/+ri0uhu/9hd+TvwnxCimaWVCeaMFFgqKFv1VYgZsWBhYARnW/qwHYC1a YDl6Z5OtgMy5jCMliD7fEPG6JtLDLqmHdHbLymaGX3pnstiF12t4vhQJuUmWPA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bLz453SqFzZy0; Tue, 17 Jun 2025 07:28:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55H7S5JM082278; Tue, 17 Jun 2025 07:28:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55H7S5a9082275; Tue, 17 Jun 2025 07:28:05 GMT (envelope-from git) Date: Tue, 17 Jun 2025 07:28:05 GMT Message-Id: <202506170728.55H7S5a9082275@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Gleb Popov Subject: git: dd0a412dfab3 - main - audio/piper: Fast and local text to speech system List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-main@freebsd.org Sender: owner-dev-commits-ports-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dd0a412dfab311af1241e619ea11595f45d02b06 Auto-Submitted: auto-generated The branch main has been updated by arrowd: URL: https://cgit.FreeBSD.org/ports/commit/?id=dd0a412dfab311af1241e619ea11595f45d02b06 commit dd0a412dfab311af1241e619ea11595f45d02b06 Author: Kenneth Raplee AuthorDate: 2025-06-06 10:33:13 +0000 Commit: Gleb Popov CommitDate: 2025-06-17 07:27:55 +0000 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/Makefile | 1 + audio/piper/Makefile | 27 ++++++ audio/piper/distinfo | 3 + audio/piper/files/patch-CMakeLists.txt | 139 ++++++++++++++++++++++++++++++ audio/piper/files/patch-src_cpp_piper.cpp | 61 +++++++++++++ audio/piper/pkg-descr | 2 + 6 files changed, 233 insertions(+) diff --git a/audio/Makefile b/audio/Makefile index bcfe68ef060c..ca57669e1928 100644 --- a/audio/Makefile +++ b/audio/Makefile @@ -594,6 +594,7 @@ SUBDIR += pianod2 SUBDIR += picard SUBDIR += picard-plugins + SUBDIR += piper SUBDIR += piper-phonemize SUBDIR += pipewire-module-xrdp SUBDIR += pipewire-spa-oss diff --git a/audio/piper/Makefile b/audio/piper/Makefile new file mode 100644 index 000000000000..c13f0322cc28 --- /dev/null +++ b/audio/piper/Makefile @@ -0,0 +1,27 @@ +PORTNAME= piper +DISTVERSION= 2023.11.14 +DISTVERSIONSUFFIX= -2 +CATEGORIES= audio + +MAINTAINER= kenrap@kennethraplee.com +COMMENT= Fast, local text to speech system +WWW= https://rhasspy.github.io/piper-samples/ + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/LICENSE.md + +LIB_DEPENDS= libespeak-ng.so:audio/espeak-ng \ + libfmt.so:devel/libfmt \ + libonnxruntime.so:misc/onnxruntime \ + libpiper_phonemize.so:audio/piper-phonemize \ + libspdlog.so:devel/spdlog + +USES= compiler:c++17-lang cmake localbase pkgconfig tar:xz xorg +USE_XORG= x11 + +USE_GITHUB= yes +GH_ACCOUNT= rhasspy + +PLIST_FILES= bin/piper + +.include diff --git a/audio/piper/distinfo b/audio/piper/distinfo new file mode 100644 index 000000000000..9f8fb736b6a0 --- /dev/null +++ b/audio/piper/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1750142677 +SHA256 (rhasspy-piper-2023.11.14-2_GH0.tar.gz) = 8b684e102cfe23af097830db9555a8641f17735725853c531a1daeb34b6ed1a8 +SIZE (rhasspy-piper-2023.11.14-2_GH0.tar.gz) = 25602353 diff --git a/audio/piper/files/patch-CMakeLists.txt b/audio/piper/files/patch-CMakeLists.txt new file mode 100644 index 000000000000..8c8041a0c750 --- /dev/null +++ b/audio/piper/files/patch-CMakeLists.txt @@ -0,0 +1,139 @@ +--- CMakeLists.txt.orig 2023-11-14 17:55:22 UTC ++++ CMakeLists.txt +@@ -13,7 +13,7 @@ if(MSVC) + add_compile_options("$<$:/utf-8>") + elseif(NOT APPLE) + # Linux flags +- string(APPEND CMAKE_CXX_FLAGS " -Wall -Wextra -Wl,-rpath,'$ORIGIN'") ++ string(APPEND CMAKE_CXX_FLAGS " -Wall -Wextra") + string(APPEND CMAKE_C_FLAGS " -Wall -Wextra") + endif() + +@@ -25,7 +25,7 @@ add_executable(test_piper src/cpp/test.cpp src/cpp/piper.cpp) + + # ---- fmt --- + +-if(NOT DEFINED FMT_DIR) ++if(FALSE) + set(FMT_VERSION "10.0.0") + set(FMT_DIR "${CMAKE_CURRENT_BINARY_DIR}/fi") + +@@ -43,7 +43,7 @@ endif() + + # ---- spdlog --- + +-if(NOT DEFINED SPDLOG_DIR) ++if(FALSE) + set(SPDLOG_DIR "${CMAKE_CURRENT_BINARY_DIR}/si") + set(SPDLOG_VERSION "1.12.0") + ExternalProject_Add( +@@ -58,7 +58,13 @@ endif() + + # ---- piper-phonemize --- + +-if(NOT DEFINED PIPER_PHONEMIZE_DIR) ++find_package(PkgConfig) ++pkg_check_modules(FMT REQUIRED fmt) ++pkg_check_modules(ONNXRUNTIME REQUIRED libonnxruntime) ++pkg_check_modules(PIPER_PHONEMIZE REQUIRED piper_phonemize) ++pkg_check_modules(SPDLOG REQUIRED spdlog) ++ ++if(FALSE) + set(PIPER_PHONEMIZE_DIR "${CMAKE_CURRENT_BINARY_DIR}/pi") + ExternalProject_Add( + piper_phonemize_external +@@ -74,9 +80,8 @@ endif() + + if((NOT MSVC) AND (NOT APPLE)) + # Linux flags +- string(APPEND CMAKE_CXX_FLAGS " -Wall -Wextra -Wl,-rpath,'$ORIGIN'") ++ string(APPEND CMAKE_CXX_FLAGS " -Wall -Wextra") + string(APPEND CMAKE_C_FLAGS " -Wall -Wextra") +- target_link_libraries(piper -static-libgcc -static-libstdc++) + + set(PIPER_EXTRA_LIBRARIES "pthread") + endif() +@@ -91,18 +96,18 @@ target_link_libraries(piper + ) + + target_link_directories(piper PUBLIC +- ${FMT_DIR}/lib +- ${SPDLOG_DIR}/lib +- ${PIPER_PHONEMIZE_DIR}/lib ++ ${FMT_LIBRARY_DIRS} ++ ${SPDLOG_LIBRARY_DIRS} ++ ${ONNXRUNTIME_LIBRARY_DIRS} + ) + + target_include_directories(piper PUBLIC +- ${FMT_DIR}/include +- ${SPDLOG_DIR}/include +- ${PIPER_PHONEMIZE_DIR}/include ++ ${FMT_INCLUDE_DIRS} ++ ${SPDLOG_INCLUDE_DIRS} ++ ${ONNXRUNTIME_INCLUDE_DIRS} + ) + +-target_compile_definitions(piper PUBLIC _PIPER_VERSION=${piper_version}) ++target_compile_definitions(piper PUBLIC _PIPER_VERSION="${piper_version}") + + # ---- Declare test ---- + include(CTest) +@@ -116,16 +121,16 @@ target_compile_features(test_piper PUBLIC cxx_std_17) + + target_include_directories( + test_piper PUBLIC +- ${FMT_DIR}/include +- ${SPDLOG_DIR}/include +- ${PIPER_PHONEMIZE_DIR}/include ++ ${FMT_INCLUDE_DIRS} ++ ${SPDLOG_INCLUDE_DIRS} ++ ${ONNXRUNTIME_INCLUDE_DIRS} + ) + + target_link_directories( + test_piper PUBLIC +- ${FMT_DIR}/lib +- ${SPDLOG_DIR}/lib +- ${PIPER_PHONEMIZE_DIR}/lib ++ ${FMT_LIBRARY_DIRS} ++ ${SPDLOG_LIBRARY_DIRS} ++ ${ONNXRUNTIME_LIBRARY_DIRS} + ) + + target_link_libraries(test_piper PUBLIC +@@ -140,33 +145,5 @@ target_link_libraries(test_piper PUBLIC + + install( + TARGETS piper +- DESTINATION ${CMAKE_INSTALL_PREFIX}) +- +-# Dependencies +-install( +- DIRECTORY ${PIPER_PHONEMIZE_DIR}/bin/ +- DESTINATION ${CMAKE_INSTALL_PREFIX} +- USE_SOURCE_PERMISSIONS # keep +x +- FILES_MATCHING +- PATTERN "piper_phonemize" +- PATTERN "espeak-ng" +- PATTERN "*.dll" +-) +- +-install( +- DIRECTORY ${PIPER_PHONEMIZE_DIR}/lib/ +- DESTINATION ${CMAKE_INSTALL_PREFIX} +- FILES_MATCHING +- PATTERN "*.dll" +- PATTERN "*.so*" +-) +- +-install( +- DIRECTORY ${PIPER_PHONEMIZE_DIR}/share/espeak-ng-data +- DESTINATION ${CMAKE_INSTALL_PREFIX} +-) +- +-install( +- FILES ${PIPER_PHONEMIZE_DIR}/share/libtashkeel_model.ort +- DESTINATION ${CMAKE_INSTALL_PREFIX} ++ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin + ) 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 diff --git a/audio/piper/pkg-descr b/audio/piper/pkg-descr new file mode 100644 index 000000000000..cad20f548b02 --- /dev/null +++ b/audio/piper/pkg-descr @@ -0,0 +1,2 @@ +A fast, local neural text to speech system that sounds great and is optimized +for the Raspberry Pi 4. Piper is used in a variety of projects.