ffvoice 0.4.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ffvoice-0.4.5/CMakeLists.txt +412 -0
- ffvoice-0.4.5/LICENSE +21 -0
- ffvoice-0.4.5/MANIFEST.in +30 -0
- ffvoice-0.4.5/PKG-INFO +772 -0
- ffvoice-0.4.5/README.md +731 -0
- ffvoice-0.4.5/include/ffvoice/types.h +72 -0
- ffvoice-0.4.5/pyproject.toml +73 -0
- ffvoice-0.4.5/python/examples/basic_transcription.py +63 -0
- ffvoice-0.4.5/python/examples/complete_realtime_pipeline.py +218 -0
- ffvoice-0.4.5/python/examples/realtime_transcription.py +113 -0
- ffvoice-0.4.5/python/ffvoice/__init__.py +38 -0
- ffvoice-0.4.5/python/ffvoice.egg-info/PKG-INFO +772 -0
- ffvoice-0.4.5/python/ffvoice.egg-info/SOURCES.txt +48 -0
- ffvoice-0.4.5/python/ffvoice.egg-info/dependency_links.txt +1 -0
- ffvoice-0.4.5/python/ffvoice.egg-info/not-zip-safe +1 -0
- ffvoice-0.4.5/python/ffvoice.egg-info/requires.txt +10 -0
- ffvoice-0.4.5/python/ffvoice.egg-info/top_level.txt +1 -0
- ffvoice-0.4.5/python/tests/test_basic.py +124 -0
- ffvoice-0.4.5/python/tests/test_numpy.py +220 -0
- ffvoice-0.4.5/setup.cfg +4 -0
- ffvoice-0.4.5/setup.py +159 -0
- ffvoice-0.4.5/src/audio/audio_capture_device.cpp +242 -0
- ffvoice-0.4.5/src/audio/audio_capture_device.h +134 -0
- ffvoice-0.4.5/src/audio/audio_processor.cpp +195 -0
- ffvoice-0.4.5/src/audio/audio_processor.h +148 -0
- ffvoice-0.4.5/src/audio/rnnoise_processor.cpp +186 -0
- ffvoice-0.4.5/src/audio/rnnoise_processor.h +115 -0
- ffvoice-0.4.5/src/audio/vad_segmenter.cpp +175 -0
- ffvoice-0.4.5/src/audio/vad_segmenter.h +156 -0
- ffvoice-0.4.5/src/audio/webrtc_processor.cpp +127 -0
- ffvoice-0.4.5/src/audio/webrtc_processor.h +117 -0
- ffvoice-0.4.5/src/audio/whisper_processor.cpp +313 -0
- ffvoice-0.4.5/src/audio/whisper_processor.h +208 -0
- ffvoice-0.4.5/src/media/audio_file_writer.cpp +15 -0
- ffvoice-0.4.5/src/media/audio_file_writer.h +14 -0
- ffvoice-0.4.5/src/media/flac_writer.cpp +160 -0
- ffvoice-0.4.5/src/media/flac_writer.h +91 -0
- ffvoice-0.4.5/src/media/wav_writer.cpp +123 -0
- ffvoice-0.4.5/src/media/wav_writer.h +84 -0
- ffvoice-0.4.5/src/python/bindings.cpp +464 -0
- ffvoice-0.4.5/src/utils/audio_converter.cpp +337 -0
- ffvoice-0.4.5/src/utils/audio_converter.h +127 -0
- ffvoice-0.4.5/src/utils/logger.cpp +20 -0
- ffvoice-0.4.5/src/utils/logger.h +38 -0
- ffvoice-0.4.5/src/utils/ring_buffer.cpp +12 -0
- ffvoice-0.4.5/src/utils/ring_buffer.h +15 -0
- ffvoice-0.4.5/src/utils/signal_generator.cpp +54 -0
- ffvoice-0.4.5/src/utils/signal_generator.h +49 -0
- ffvoice-0.4.5/src/utils/subtitle_generator.cpp +141 -0
- ffvoice-0.4.5/src/utils/subtitle_generator.h +103 -0
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
# ffvoice-engine - Low-latency C++ voice engine
|
|
2
|
+
cmake_minimum_required(VERSION 3.20)
|
|
3
|
+
project(ffvoice-engine VERSION 0.1.0 LANGUAGES CXX C)
|
|
4
|
+
|
|
5
|
+
# C++ Standard
|
|
6
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
7
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
8
|
+
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
9
|
+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
10
|
+
|
|
11
|
+
# Set architecture for macOS (allow override from setup.py for universal2 builds)
|
|
12
|
+
if(APPLE AND NOT DEFINED CMAKE_OSX_ARCHITECTURES)
|
|
13
|
+
# Default to native architecture if not specified
|
|
14
|
+
set(CMAKE_OSX_ARCHITECTURES "${CMAKE_SYSTEM_PROCESSOR}" CACHE STRING "macOS architecture" FORCE)
|
|
15
|
+
endif()
|
|
16
|
+
|
|
17
|
+
# Build options
|
|
18
|
+
option(BUILD_TESTS "Build unit tests" ON)
|
|
19
|
+
option(BUILD_EXAMPLES "Build examples" ON)
|
|
20
|
+
option(BUILD_PYTHON "Build Python bindings" OFF)
|
|
21
|
+
option(ENABLE_WEBRTC_APM "Enable WebRTC Audio Processing Module" OFF)
|
|
22
|
+
option(ENABLE_RNNOISE "Enable RNNoise deep learning noise suppression" OFF)
|
|
23
|
+
option(ENABLE_WHISPER "Enable Whisper ASR (speech recognition)" OFF)
|
|
24
|
+
|
|
25
|
+
# Compiler flags
|
|
26
|
+
if(MSVC)
|
|
27
|
+
add_compile_options(/W4 /permissive-)
|
|
28
|
+
else()
|
|
29
|
+
add_compile_options(-Wall -Wextra -Wpedantic)
|
|
30
|
+
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
|
31
|
+
# Use -march=native only for single-architecture builds on x86_64
|
|
32
|
+
# Skip for universal2 builds (multiple architectures) as -march=native is incompatible
|
|
33
|
+
if(APPLE)
|
|
34
|
+
# Check if building for multiple architectures (universal2)
|
|
35
|
+
string(FIND "${CMAKE_OSX_ARCHITECTURES}" ";" IS_UNIVERSAL)
|
|
36
|
+
if(IS_UNIVERSAL GREATER -1)
|
|
37
|
+
# Universal2 build - skip -march=native
|
|
38
|
+
add_compile_options(-O3)
|
|
39
|
+
elseif(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64|AMD64")
|
|
40
|
+
# Single x86_64 build
|
|
41
|
+
add_compile_options(-O3 -march=native)
|
|
42
|
+
else()
|
|
43
|
+
# Single ARM64 build
|
|
44
|
+
add_compile_options(-O3)
|
|
45
|
+
endif()
|
|
46
|
+
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
|
|
47
|
+
add_compile_options(-O3 -march=native)
|
|
48
|
+
else()
|
|
49
|
+
add_compile_options(-O3)
|
|
50
|
+
endif()
|
|
51
|
+
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
52
|
+
add_compile_options(-g -O0)
|
|
53
|
+
endif()
|
|
54
|
+
endif()
|
|
55
|
+
|
|
56
|
+
# Find dependencies
|
|
57
|
+
find_package(PkgConfig REQUIRED)
|
|
58
|
+
|
|
59
|
+
# FFmpeg (required)
|
|
60
|
+
pkg_check_modules(FFMPEG REQUIRED
|
|
61
|
+
libavcodec
|
|
62
|
+
libavformat
|
|
63
|
+
libavutil
|
|
64
|
+
libswresample
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# PortAudio (required for audio capture)
|
|
68
|
+
pkg_check_modules(PORTAUDIO REQUIRED portaudio-2.0)
|
|
69
|
+
|
|
70
|
+
# FLAC (required for FLAC encoding)
|
|
71
|
+
pkg_check_modules(FLAC REQUIRED flac)
|
|
72
|
+
|
|
73
|
+
# WebRTC APM (optional)
|
|
74
|
+
if(ENABLE_WEBRTC_APM)
|
|
75
|
+
pkg_check_modules(WEBRTC_APM webrtc-audio-processing-1)
|
|
76
|
+
|
|
77
|
+
if(NOT WEBRTC_APM_FOUND)
|
|
78
|
+
message(STATUS "")
|
|
79
|
+
message(STATUS "========================================")
|
|
80
|
+
message(STATUS "WebRTC APM library not found!")
|
|
81
|
+
message(STATUS "========================================")
|
|
82
|
+
message(STATUS "")
|
|
83
|
+
message(STATUS "To install webrtc-audio-processing:")
|
|
84
|
+
message(STATUS "")
|
|
85
|
+
message(STATUS "Linux (Ubuntu/Debian):")
|
|
86
|
+
message(STATUS " sudo apt-get install webrtc-audio-processing-dev")
|
|
87
|
+
message(STATUS "")
|
|
88
|
+
message(STATUS "macOS/Linux (from source):")
|
|
89
|
+
message(STATUS " git clone https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing.git")
|
|
90
|
+
message(STATUS " cd webrtc-audio-processing")
|
|
91
|
+
message(STATUS " meson setup build --prefix=/usr/local")
|
|
92
|
+
message(STATUS " meson compile -C build")
|
|
93
|
+
message(STATUS " sudo meson install -C build")
|
|
94
|
+
message(STATUS "")
|
|
95
|
+
message(STATUS "Or disable WebRTC APM and use other processors:")
|
|
96
|
+
message(STATUS " cmake .. -DENABLE_WEBRTC_APM=OFF")
|
|
97
|
+
message(STATUS "")
|
|
98
|
+
message(STATUS "========================================")
|
|
99
|
+
message(FATAL_ERROR "WebRTC APM library required but not found")
|
|
100
|
+
endif()
|
|
101
|
+
|
|
102
|
+
message(STATUS "WebRTC APM found in system:")
|
|
103
|
+
message(STATUS " Include dirs: ${WEBRTC_APM_INCLUDE_DIRS}")
|
|
104
|
+
message(STATUS " Libraries: ${WEBRTC_APM_LIBRARIES}")
|
|
105
|
+
message(STATUS " Library dirs: ${WEBRTC_APM_LIBRARY_DIRS}")
|
|
106
|
+
endif()
|
|
107
|
+
|
|
108
|
+
# Include directories
|
|
109
|
+
include_directories(
|
|
110
|
+
${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
111
|
+
${CMAKE_CURRENT_SOURCE_DIR}/src
|
|
112
|
+
${FFMPEG_INCLUDE_DIRS}
|
|
113
|
+
${PORTAUDIO_INCLUDE_DIRS}
|
|
114
|
+
${FLAC_INCLUDE_DIRS}
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
if(ENABLE_WEBRTC_APM AND WEBRTC_APM_FOUND)
|
|
118
|
+
include_directories(${WEBRTC_APM_INCLUDE_DIRS})
|
|
119
|
+
endif()
|
|
120
|
+
|
|
121
|
+
# Source files
|
|
122
|
+
set(FFVOICE_CORE_SOURCES
|
|
123
|
+
src/audio/audio_capture_device.cpp
|
|
124
|
+
src/audio/audio_processor.cpp
|
|
125
|
+
src/audio/vad_segmenter.cpp
|
|
126
|
+
src/media/audio_file_writer.cpp
|
|
127
|
+
src/media/wav_writer.cpp
|
|
128
|
+
src/media/flac_writer.cpp
|
|
129
|
+
src/utils/logger.cpp
|
|
130
|
+
src/utils/ring_buffer.cpp
|
|
131
|
+
src/utils/signal_generator.cpp
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
# WebRTC APM (conditional)
|
|
135
|
+
if(ENABLE_WEBRTC_APM)
|
|
136
|
+
message(STATUS "WebRTC APM: Enabled")
|
|
137
|
+
add_compile_definitions(ENABLE_WEBRTC_APM)
|
|
138
|
+
list(APPEND FFVOICE_CORE_SOURCES
|
|
139
|
+
src/audio/webrtc_processor.cpp
|
|
140
|
+
)
|
|
141
|
+
else()
|
|
142
|
+
message(STATUS "WebRTC APM: Disabled (use -DENABLE_WEBRTC_APM=ON to enable)")
|
|
143
|
+
endif()
|
|
144
|
+
|
|
145
|
+
# RNNoise (conditional)
|
|
146
|
+
if(ENABLE_RNNOISE)
|
|
147
|
+
message(STATUS "RNNoise: Enabled")
|
|
148
|
+
add_compile_definitions(ENABLE_RNNOISE)
|
|
149
|
+
|
|
150
|
+
# Fetch RNNoise library via CMake FetchContent
|
|
151
|
+
include(FetchContent)
|
|
152
|
+
|
|
153
|
+
message(STATUS "Fetching RNNoise from GitHub...")
|
|
154
|
+
|
|
155
|
+
FetchContent_Declare(
|
|
156
|
+
rnnoise
|
|
157
|
+
GIT_REPOSITORY https://github.com/xiph/rnnoise.git
|
|
158
|
+
GIT_TAG master
|
|
159
|
+
GIT_SHALLOW TRUE
|
|
160
|
+
SOURCE_DIR ${CMAKE_BINARY_DIR}/_deps/rnnoise-src
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
# Download only, don't try to build (RNNoise uses autotools, not CMake)
|
|
164
|
+
FetchContent_GetProperties(rnnoise)
|
|
165
|
+
if(NOT rnnoise_POPULATED)
|
|
166
|
+
FetchContent_Populate(rnnoise)
|
|
167
|
+
endif()
|
|
168
|
+
|
|
169
|
+
# RNNoise source files (manual configuration since it uses autotools)
|
|
170
|
+
set(RNNOISE_SOURCES
|
|
171
|
+
${rnnoise_SOURCE_DIR}/src/rnn.c
|
|
172
|
+
${rnnoise_SOURCE_DIR}/src/rnn_data.c
|
|
173
|
+
${rnnoise_SOURCE_DIR}/src/rnn_reader.c
|
|
174
|
+
${rnnoise_SOURCE_DIR}/src/denoise.c
|
|
175
|
+
${rnnoise_SOURCE_DIR}/src/celt_lpc.c
|
|
176
|
+
${rnnoise_SOURCE_DIR}/src/kiss_fft.c
|
|
177
|
+
${rnnoise_SOURCE_DIR}/src/pitch.c
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
# Create RNNoise static library
|
|
181
|
+
add_library(rnnoise STATIC ${RNNOISE_SOURCES})
|
|
182
|
+
|
|
183
|
+
target_include_directories(rnnoise PUBLIC
|
|
184
|
+
${rnnoise_SOURCE_DIR}/include
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
# RNNoise is a C library
|
|
188
|
+
set_target_properties(rnnoise PROPERTIES
|
|
189
|
+
C_STANDARD 99
|
|
190
|
+
C_STANDARD_REQUIRED ON
|
|
191
|
+
POSITION_INDEPENDENT_CODE ON
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
message(STATUS "RNNoise configured successfully")
|
|
195
|
+
message(STATUS " Source dir: ${rnnoise_SOURCE_DIR}")
|
|
196
|
+
message(STATUS " Include dir: ${rnnoise_SOURCE_DIR}/include")
|
|
197
|
+
|
|
198
|
+
list(APPEND FFVOICE_CORE_SOURCES
|
|
199
|
+
src/audio/rnnoise_processor.cpp
|
|
200
|
+
)
|
|
201
|
+
else()
|
|
202
|
+
message(STATUS "RNNoise: Disabled (use -DENABLE_RNNOISE=ON to enable)")
|
|
203
|
+
endif()
|
|
204
|
+
|
|
205
|
+
# Whisper ASR (conditional)
|
|
206
|
+
if(ENABLE_WHISPER)
|
|
207
|
+
message(STATUS "Whisper ASR: Enabled")
|
|
208
|
+
add_compile_definitions(ENABLE_WHISPER)
|
|
209
|
+
|
|
210
|
+
# Fetch whisper.cpp library via CMake FetchContent
|
|
211
|
+
include(FetchContent)
|
|
212
|
+
|
|
213
|
+
message(STATUS "Fetching whisper.cpp from GitHub...")
|
|
214
|
+
|
|
215
|
+
FetchContent_Declare(
|
|
216
|
+
whisper
|
|
217
|
+
GIT_REPOSITORY https://github.com/ggerganov/whisper.cpp.git
|
|
218
|
+
GIT_TAG v1.5.4
|
|
219
|
+
GIT_SHALLOW TRUE
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
# Configure whisper.cpp build options
|
|
223
|
+
set(WHISPER_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
|
224
|
+
set(WHISPER_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
|
225
|
+
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
|
226
|
+
|
|
227
|
+
# Disable AVX/AVX2/SIMD for Rosetta 2 compatibility
|
|
228
|
+
set(WHISPER_NO_AVX ON CACHE BOOL "" FORCE)
|
|
229
|
+
set(WHISPER_NO_AVX2 ON CACHE BOOL "" FORCE)
|
|
230
|
+
set(WHISPER_NO_FMA ON CACHE BOOL "" FORCE)
|
|
231
|
+
set(WHISPER_NO_F16C ON CACHE BOOL "" FORCE)
|
|
232
|
+
set(GGML_NATIVE OFF CACHE BOOL "" FORCE)
|
|
233
|
+
|
|
234
|
+
# Enable Position Independent Code for Python bindings
|
|
235
|
+
set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "" FORCE)
|
|
236
|
+
|
|
237
|
+
FetchContent_MakeAvailable(whisper)
|
|
238
|
+
|
|
239
|
+
message(STATUS "whisper.cpp fetched successfully")
|
|
240
|
+
message(STATUS " Source dir: ${whisper_SOURCE_DIR}")
|
|
241
|
+
|
|
242
|
+
# Download Whisper tiny model (39MB)
|
|
243
|
+
set(WHISPER_MODEL_DIR "${CMAKE_BINARY_DIR}/models")
|
|
244
|
+
set(WHISPER_TINY_MODEL "${WHISPER_MODEL_DIR}/ggml-tiny.bin")
|
|
245
|
+
|
|
246
|
+
if(NOT EXISTS ${WHISPER_TINY_MODEL})
|
|
247
|
+
message(STATUS "Downloading whisper tiny model (39MB)...")
|
|
248
|
+
file(MAKE_DIRECTORY ${WHISPER_MODEL_DIR})
|
|
249
|
+
|
|
250
|
+
file(DOWNLOAD
|
|
251
|
+
"https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.bin"
|
|
252
|
+
${WHISPER_TINY_MODEL}
|
|
253
|
+
SHOW_PROGRESS
|
|
254
|
+
STATUS DOWNLOAD_STATUS
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
list(GET DOWNLOAD_STATUS 0 DOWNLOAD_CODE)
|
|
258
|
+
if(NOT DOWNLOAD_CODE EQUAL 0)
|
|
259
|
+
message(WARNING "Failed to download whisper model. Please download manually from:")
|
|
260
|
+
message(WARNING " https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.bin")
|
|
261
|
+
message(WARNING " Save to: ${WHISPER_TINY_MODEL}")
|
|
262
|
+
else()
|
|
263
|
+
message(STATUS "Model downloaded successfully")
|
|
264
|
+
endif()
|
|
265
|
+
else()
|
|
266
|
+
message(STATUS "Whisper tiny model already exists at ${WHISPER_TINY_MODEL}")
|
|
267
|
+
endif()
|
|
268
|
+
|
|
269
|
+
# Add compile definition for model path
|
|
270
|
+
add_compile_definitions(WHISPER_MODEL_PATH="${WHISPER_TINY_MODEL}")
|
|
271
|
+
|
|
272
|
+
list(APPEND FFVOICE_CORE_SOURCES
|
|
273
|
+
src/audio/whisper_processor.cpp
|
|
274
|
+
src/utils/subtitle_generator.cpp
|
|
275
|
+
src/utils/audio_converter.cpp
|
|
276
|
+
)
|
|
277
|
+
else()
|
|
278
|
+
message(STATUS "Whisper ASR: Disabled (use -DENABLE_WHISPER=ON to enable)")
|
|
279
|
+
endif()
|
|
280
|
+
|
|
281
|
+
# Python bindings (optional)
|
|
282
|
+
if(BUILD_PYTHON)
|
|
283
|
+
message(STATUS "Python bindings: Enabled")
|
|
284
|
+
|
|
285
|
+
# Find Python - use PYTHON_EXECUTABLE if provided (from setup.py)
|
|
286
|
+
if(DEFINED PYTHON_EXECUTABLE)
|
|
287
|
+
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
288
|
+
message(STATUS "Using Python from setup.py: ${PYTHON_EXECUTABLE}")
|
|
289
|
+
endif()
|
|
290
|
+
find_package(Python COMPONENTS Interpreter Development REQUIRED)
|
|
291
|
+
|
|
292
|
+
# Find pybind11
|
|
293
|
+
find_package(pybind11 CONFIG)
|
|
294
|
+
|
|
295
|
+
if(NOT pybind11_FOUND)
|
|
296
|
+
message(STATUS "pybind11 not found in system, fetching from GitHub...")
|
|
297
|
+
include(FetchContent)
|
|
298
|
+
|
|
299
|
+
FetchContent_Declare(
|
|
300
|
+
pybind11
|
|
301
|
+
GIT_REPOSITORY https://github.com/pybind/pybind11.git
|
|
302
|
+
GIT_TAG v2.11.1
|
|
303
|
+
GIT_SHALLOW TRUE
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
FetchContent_MakeAvailable(pybind11)
|
|
307
|
+
message(STATUS "pybind11 fetched successfully")
|
|
308
|
+
else()
|
|
309
|
+
message(STATUS "pybind11 found: ${pybind11_DIR}")
|
|
310
|
+
endif()
|
|
311
|
+
|
|
312
|
+
# Python module
|
|
313
|
+
pybind11_add_module(_ffvoice src/python/bindings.cpp)
|
|
314
|
+
|
|
315
|
+
target_link_libraries(_ffvoice PRIVATE ffvoice-core)
|
|
316
|
+
|
|
317
|
+
target_include_directories(_ffvoice PRIVATE
|
|
318
|
+
${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
319
|
+
${CMAKE_CURRENT_SOURCE_DIR}/src
|
|
320
|
+
)
|
|
321
|
+
|
|
322
|
+
# Install Python module
|
|
323
|
+
install(TARGETS _ffvoice LIBRARY DESTINATION python/ffvoice)
|
|
324
|
+
install(DIRECTORY python/ffvoice/ DESTINATION python/ffvoice
|
|
325
|
+
FILES_MATCHING PATTERN "*.py")
|
|
326
|
+
else()
|
|
327
|
+
message(STATUS "Python bindings: Disabled (use -DBUILD_PYTHON=ON to enable)")
|
|
328
|
+
endif()
|
|
329
|
+
|
|
330
|
+
# Core library
|
|
331
|
+
add_library(ffvoice-core STATIC ${FFVOICE_CORE_SOURCES})
|
|
332
|
+
|
|
333
|
+
# Enable Position Independent Code for Python bindings on Linux
|
|
334
|
+
set_target_properties(ffvoice-core PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
335
|
+
|
|
336
|
+
target_link_libraries(ffvoice-core
|
|
337
|
+
PUBLIC
|
|
338
|
+
${FFMPEG_LINK_LIBRARIES}
|
|
339
|
+
${PORTAUDIO_LIBRARIES}
|
|
340
|
+
${FLAC_LIBRARIES}
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
if(ENABLE_WEBRTC_APM AND WEBRTC_APM_FOUND)
|
|
344
|
+
target_link_libraries(ffvoice-core
|
|
345
|
+
PUBLIC ${WEBRTC_APM_LIBRARIES}
|
|
346
|
+
)
|
|
347
|
+
endif()
|
|
348
|
+
|
|
349
|
+
if(ENABLE_RNNOISE)
|
|
350
|
+
target_link_libraries(ffvoice-core
|
|
351
|
+
PUBLIC rnnoise
|
|
352
|
+
)
|
|
353
|
+
target_include_directories(ffvoice-core
|
|
354
|
+
PUBLIC ${rnnoise_SOURCE_DIR}/include
|
|
355
|
+
)
|
|
356
|
+
endif()
|
|
357
|
+
|
|
358
|
+
if(ENABLE_WHISPER)
|
|
359
|
+
target_link_libraries(ffvoice-core
|
|
360
|
+
PUBLIC whisper
|
|
361
|
+
)
|
|
362
|
+
target_include_directories(ffvoice-core
|
|
363
|
+
PUBLIC ${whisper_SOURCE_DIR}
|
|
364
|
+
)
|
|
365
|
+
endif()
|
|
366
|
+
|
|
367
|
+
target_link_directories(ffvoice-core
|
|
368
|
+
PUBLIC
|
|
369
|
+
${FFMPEG_LIBRARY_DIRS}
|
|
370
|
+
${PORTAUDIO_LIBRARY_DIRS}
|
|
371
|
+
${FLAC_LIBRARY_DIRS}
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
if(ENABLE_WEBRTC_APM AND WEBRTC_APM_FOUND)
|
|
375
|
+
target_link_directories(ffvoice-core
|
|
376
|
+
PUBLIC ${WEBRTC_APM_LIBRARY_DIRS}
|
|
377
|
+
)
|
|
378
|
+
endif()
|
|
379
|
+
|
|
380
|
+
target_include_directories(ffvoice-core
|
|
381
|
+
PUBLIC
|
|
382
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
383
|
+
$<INSTALL_INTERFACE:include>
|
|
384
|
+
PRIVATE
|
|
385
|
+
${CMAKE_CURRENT_SOURCE_DIR}/src
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
# CLI application
|
|
389
|
+
add_executable(ffvoice apps/cli/main.cpp)
|
|
390
|
+
target_link_libraries(ffvoice PRIVATE ffvoice-core)
|
|
391
|
+
|
|
392
|
+
# Tests
|
|
393
|
+
if(BUILD_TESTS)
|
|
394
|
+
enable_testing()
|
|
395
|
+
add_subdirectory(tests)
|
|
396
|
+
endif()
|
|
397
|
+
|
|
398
|
+
# Examples
|
|
399
|
+
if(BUILD_EXAMPLES)
|
|
400
|
+
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/examples/CMakeLists.txt)
|
|
401
|
+
add_subdirectory(examples)
|
|
402
|
+
endif()
|
|
403
|
+
endif()
|
|
404
|
+
|
|
405
|
+
# Install
|
|
406
|
+
install(TARGETS ffvoice ffvoice-core
|
|
407
|
+
RUNTIME DESTINATION bin
|
|
408
|
+
LIBRARY DESTINATION lib
|
|
409
|
+
ARCHIVE DESTINATION lib
|
|
410
|
+
)
|
|
411
|
+
|
|
412
|
+
install(DIRECTORY include/ffvoice DESTINATION include)
|
ffvoice-0.4.5/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 chico
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Include the license and readme
|
|
2
|
+
include LICENSE
|
|
3
|
+
include README.md
|
|
4
|
+
include pyproject.toml
|
|
5
|
+
include setup.py
|
|
6
|
+
include CMakeLists.txt
|
|
7
|
+
|
|
8
|
+
# Include all C++ source and header files
|
|
9
|
+
recursive-include src *.cpp *.h *.hpp
|
|
10
|
+
recursive-include include *.h *.hpp
|
|
11
|
+
|
|
12
|
+
# Include CMake modules
|
|
13
|
+
recursive-include cmake *.cmake
|
|
14
|
+
|
|
15
|
+
# Include Python bindings source
|
|
16
|
+
recursive-include python *.cpp *.py
|
|
17
|
+
|
|
18
|
+
# Include third-party dependencies that are bundled
|
|
19
|
+
recursive-include third_party *.cpp *.c *.h *.hpp *.cmake CMakeLists.txt
|
|
20
|
+
|
|
21
|
+
# Exclude build artifacts
|
|
22
|
+
global-exclude *.pyc
|
|
23
|
+
global-exclude *.pyo
|
|
24
|
+
global-exclude __pycache__
|
|
25
|
+
global-exclude *.so
|
|
26
|
+
global-exclude *.dylib
|
|
27
|
+
global-exclude .DS_Store
|
|
28
|
+
prune build
|
|
29
|
+
prune dist
|
|
30
|
+
prune *.egg-info
|