git: 5daa5d9a69bf - main - audio/lpcnet: New port: Neural Net speech coding
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 03 Aug 2022 00:10:42 UTC
The branch main has been updated by db: URL: https://cgit.FreeBSD.org/ports/commit/?id=5daa5d9a69bf6c60a39927dc99c7ca92ac61c906 commit 5daa5d9a69bf6c60a39927dc99c7ca92ac61c906 Author: Diane Bruce <db@FreeBSD.org> AuthorDate: 2022-08-03 00:00:35 +0000 Commit: Diane Bruce <db@FreeBSD.org> CommitDate: 2022-08-03 00:10:23 +0000 audio/lpcnet: New port: Neural Net speech coding Needed for freedv update see: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264769 Experimental version of LPCNet that has been used to develop FreeDV 2020 - a HF radio Digial Voice mode for over the air experimentation with Neural Net speech coding. Possibly the first use of Neural Net speech coding in real world operation. --- audio/Makefile | 1 + audio/lpcnet/Makefile | 27 +++++++++++ audio/lpcnet/distinfo | 7 +++ audio/lpcnet/files/patch-CMakeLists.txt | 86 +++++++++++++++++++++++++++++++++ audio/lpcnet/pkg-descr | 6 +++ audio/lpcnet/pkg-plist | 7 +++ 6 files changed, 134 insertions(+) diff --git a/audio/Makefile b/audio/Makefile index 80e05f9e50a2..2d4bf717cc7e 100644 --- a/audio/Makefile +++ b/audio/Makefile @@ -443,6 +443,7 @@ SUBDIR += logitechmediaserver-sqlplaylist SUBDIR += logitechmediaserver-trackstat SUBDIR += lollypop + SUBDIR += lpcnet SUBDIR += lsp-plugins-lv2 SUBDIR += lua-mpd SUBDIR += luppp diff --git a/audio/lpcnet/Makefile b/audio/lpcnet/Makefile new file mode 100644 index 000000000000..9ec36f347f5f --- /dev/null +++ b/audio/lpcnet/Makefile @@ -0,0 +1,27 @@ +PORTNAME= lpcnet +PORTVERSION= 20210629 +CATEGORIES= audio hamradio +MASTER_SITES= http://rowetel.com/downloads/deep/:main \ + GH:sub +DISTFILES= lpcnet_191005_v1.0.tgz:main \ + ${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}:sub + +MAINTAINER= hamradio@FreeBSD.org +COMMENT= Neural Net speech coding + +LICENSE= LGPL21 + +LIB_DEPENDS= libcodec2.so:audio/codec2 + +USES= cmake compiler:c++11-lib +CMAKE_ARGS+= -DMACHINE_CPU:STRING="${MACHINE_CPU}" \ + -DWRKDIR:STRING=${WRKDIR} + +USE_GITHUB= yes +GH_ACCOUNT= drowe67 +GH_PROJECT= LPCNet +GH_TAGNAME= 0dc5935 + +.include <bsd.port.pre.mk> +.include <bsd.cpu.mk> +.include <bsd.port.post.mk> diff --git a/audio/lpcnet/distinfo b/audio/lpcnet/distinfo new file mode 100644 index 000000000000..a0b495a1716d --- /dev/null +++ b/audio/lpcnet/distinfo @@ -0,0 +1,7 @@ +TIMESTAMP = 1641483640 +SHA256 (lpcnet_191005_v1.0.tgz) = 509440924751fdd87ffaa5683ee3dddd937af5c833b9104ccce65d51614926c8 +SIZE (lpcnet_191005_v1.0.tgz) = 18396516 +SHA256 (lpcnet-20210629.tar.gz) = 31a687ac5e822c6c2cf75fe8e7371a5cd834d692635a802ec8fd33dc340d9cf2 +SIZE (lpcnet-20210629.tar.gz) = 33016759 +SHA256 (drowe67-LPCNet-20210629-0dc5935_GH0.tar.gz) = 31a687ac5e822c6c2cf75fe8e7371a5cd834d692635a802ec8fd33dc340d9cf2 +SIZE (drowe67-LPCNet-20210629-0dc5935_GH0.tar.gz) = 33016759 diff --git a/audio/lpcnet/files/patch-CMakeLists.txt b/audio/lpcnet/files/patch-CMakeLists.txt new file mode 100644 index 000000000000..d11722280aa1 --- /dev/null +++ b/audio/lpcnet/files/patch-CMakeLists.txt @@ -0,0 +1,86 @@ +--- CMakeLists.txt.orig 2021-06-29 09:04:36 UTC ++++ CMakeLists.txt +@@ -87,15 +87,32 @@ message(STATUS "Host system arch is: ${CMAKE_SYSTEM_PR + # Detection of available CPU optimizations + if(NOT DISABLE_CPU_OPTIMIZATION) + if(UNIX AND NOT APPLE) +- message(STATUS "Looking for available CPU optimizations on Linux/BSD system...") +- execute_process(COMMAND grep -c "avx2" /proc/cpuinfo +- OUTPUT_VARIABLE AVX2) +- execute_process(COMMAND grep -c "avx " /proc/cpuinfo +- OUTPUT_VARIABLE AVX) +- execute_process(COMMAND grep -c "sse4_1 " /proc/cpuinfo +- OUTPUT_VARIABLE SSE) +- execute_process(COMMAND grep -c "neon" /proc/cpuinfo +- OUTPUT_VARIABLE NEON) ++ if ( ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") ++ message(STATUS "Looking for available CPU optimizations on FreeBSD system...") ++ message (STATUS "MACHINE_CPU = ${MACHINE_CPU}") ++ if (MACHINE_CPU MATCHES "avx") ++ set(AVX TRUE) ++ endif() ++ if (MACHINE_CPU MATCHES "avx2") ++ set(AVX2 TRUE) ++ endif() ++ if (MACHINE_CPU MATCHES "sse") ++ set(SSE TRUE) ++ endif() ++ if (MACHINE_CPU MATCHES "neon") ++ set(NEON TRUE) ++ endif() ++ else() ++ message(STATUS "Looking for available CPU optimizations on Linux system...") ++ execute_process(COMMAND grep -c "avx2" /proc/cpuinfo ++ OUTPUT_VARIABLE AVX2) ++ execute_process(COMMAND grep -c "avx " /proc/cpuinfo ++ OUTPUT_VARIABLE AVX) ++ execute_process(COMMAND grep -c "sse4_1 " /proc/cpuinfo ++ OUTPUT_VARIABLE SSE) ++ execute_process(COMMAND grep -c "neon" /proc/cpuinfo ++ OUTPUT_VARIABLE NEON) ++ endif() + elseif(APPLE) + if(BUILD_OSX_UNIVERSAL) + # Presume AVX/AVX2 are enabled on the x86 side. The ARM side will auto-enable +@@ -140,36 +157,12 @@ if(${NEON} OR ${NEON} GREATER 0) + endif() + + # grab latest NN model (or substitute your own) +-set(LPCNET_ROOT http://rowetel.com/downloads/deep/) +-set(LPCNET_FILE lpcnet_191005_v1.0.tgz) +-set(LPCNET_URL ${LPCNET_ROOT}${LPCNET_FILE}) ++# retrieved by port ++#set(LPCNET_ROOT http://rowetel.com/downloads/deep/) ++#set(LPCNET_FILE lpcnet_191005_v1.0.tgz) ++#set(LPCNET_URL ${LPCNET_ROOT}${LPCNET_FILE}) + +-if(EXISTS ${CMAKE_BINARY_DIR}/${LPCNET_FILE}) +- set(lpcnet_SOURCE_DIR ${CMAKE_BINARY_DIR}/src) +- file(MAKE_DIRECTORY ${lpcnet_SOURCE_DIR}) +- execute_process(COMMAND tar -xzf ${CMAKE_BINARY_DIR}/${LPCNET_FILE} -C ${CMAKE_BINARY_DIR}/src) +- +-# Work around not having the FetchContent module. +-elseif(CMAKE_VERSION VERSION_LESS 3.11.4) +- set(lpcnet_SOURCE_DIR ${CMAKE_BINARY_DIR}/src) +- if(NOT EXISTS ${lpcnet_SOURCE_DIR}) +- file(DOWNLOAD ${LPCNET_URL} +- ${CMAKE_BINARY_DIR}/${LPCNET_FILE} +- SHOW_PROGRESS +- ) +- file(MAKE_DIRECTORY ${lpcnet_SOURCE_DIR}) +- execute_process(COMMAND tar -xzf ${CMAKE_BINARY_DIR}/${LPCNET_FILE} -C ${CMAKE_BINARY_DIR}/src) +- endif() +-else() +- include(FetchContent) +- FetchContent_Declare( +- lpcnet +- URL ${LPCNET_URL}) +- FetchContent_GetProperties(lpcnet) +- if(NOT lpcnet_POPULATED) +- FetchContent_Populate(lpcnet) +- endif() +-endif() ++set(lpcnet_SOURCE_DIR ${WRKDIR}) + + # Find codec2 + if(CODEC2_BUILD_DIR) diff --git a/audio/lpcnet/pkg-descr b/audio/lpcnet/pkg-descr new file mode 100644 index 000000000000..86c8314a1260 --- /dev/null +++ b/audio/lpcnet/pkg-descr @@ -0,0 +1,6 @@ +Experimental version of LPCNet that has been used to develop FreeDV 2020 +- a HF radio Digial Voice mode for over the air experimentation with +Neural Net speech coding. Possibly the first use of Neural Net speech +coding in real world operation. + +WWW: http://freedv.org/tiki-index.php diff --git a/audio/lpcnet/pkg-plist b/audio/lpcnet/pkg-plist new file mode 100644 index 000000000000..54460bd5512e --- /dev/null +++ b/audio/lpcnet/pkg-plist @@ -0,0 +1,7 @@ +bin/lpcnet_dec +bin/lpcnet_enc +include/lpcnet/lpcnet_freedv.h +lib/cmake/lpcnetfreedv/lpcnetfreedv-config-%%CMAKE_BUILD_TYPE%%.cmake +lib/cmake/lpcnetfreedv/lpcnetfreedv-config.cmake +lib/liblpcnetfreedv.so +lib/liblpcnetfreedv.so.0.2