-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upkeep/christmas updates: bugfixes and more (#87)
* Fix PYIN bugs and failures * Switch to CMake * Fix power-of-two FFT/autocorrelation with r2c/c2r transforms * Remove SWIPE algorithm * Improve sine waves and add many more unit tests
- Loading branch information
Showing
55 changed files
with
1,356 additions
and
976 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
* | ||
!src | ||
!lib | ||
!cmake | ||
!misc | ||
!include | ||
!test | ||
!degraded_audio_tests | ||
!wav_analyzer | ||
!Makefile | ||
!CMakeLists.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
*.png filter=lfs diff=lfs merge=lfs -text | ||
*.txt filter=lfs diff=lfs merge=lfs -text | ||
misc/samples/*.txt filter=lfs diff=lfs merge=lfs -text | ||
misc/* linguist-documentation | ||
*.wav filter=lfs diff=lfs merge=lfs -text | ||
*.aiff filter=lfs diff=lfs merge=lfs -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
lib | ||
.dir-locals.el | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(pitch_detection VERSION 1.0 LANGUAGES CXX) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED True) | ||
|
||
# use this for dependency graph generation | ||
#set_property(GLOBAL PROPERTY GRAPHVIZ_EXPORT_TARGETS TRUE) | ||
|
||
set(CMAKE_CXX_FLAGS "-Wall -Wextra -ansi -pedantic -fext-numeric-literals -fopenmp") | ||
set(CMAKE_CXX_FLAGS_DEBUG "-g") | ||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -flto") | ||
|
||
include_directories(include) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/test) | ||
|
||
find_package(mlpack REQUIRED) | ||
find_package(FFTS REQUIRED) | ||
|
||
# Assuming FFTS does not have a built-in find module | ||
|
||
# Add the library target | ||
file(GLOB_RECURSE LIB_SOURCES "src/*.cpp") | ||
add_library(pitch_detection SHARED ${LIB_SOURCES}) | ||
target_link_libraries(pitch_detection PUBLIC | ||
${MLPACK_LIBRARIES} | ||
${FFTS_LIBRARIES}) | ||
|
||
find_package(gflags QUIET) | ||
find_package(libnyquist QUIET) | ||
find_package(PkgConfig QUIET) | ||
pkg_search_module(OPUS QUIET opus) | ||
pkg_search_module(WAVPACK QUIET wavpack) | ||
|
||
if(gflags_FOUND AND OPUS_FOUND AND WAVPACK_FOUND AND libnyquist_FOUND) | ||
file(GLOB WAV_ANALYZER_SOURCES "wav_analyzer/*.cpp") | ||
add_executable(wav_analyzer ${WAV_ANALYZER_SOURCES}) | ||
target_link_libraries(wav_analyzer PRIVATE | ||
pitch_detection | ||
${GFLAGS_LIBRARIES} | ||
${OPUS_LIBRARIES} | ||
${WAVPACK_LIBRARIES} | ||
libnyquist) | ||
|
||
target_include_directories(wav_analyzer PRIVATE | ||
${GFLAGS_INCLUDE_DIRS} | ||
${OPUS_INCLUDE_DIRS} | ||
${WAVPACK_INCLUDE_DIRS} | ||
${LIBNYQUIST_INCLUDE_DIRS}) | ||
|
||
link_directories( | ||
${GFLAGS_LIBRARY_DIRS} | ||
${OPUS_LIBRARY_DIRS} | ||
${WAVPACK_LIBRARY_DIRS} | ||
${LIBYNQUIST_LIBRARY_DIRS}) | ||
endif() | ||
|
||
include(CTest) | ||
find_package(GTest QUIET) | ||
find_package(opus QUIET) | ||
find_package(lib QUIET) | ||
if(GTEST_FOUND) | ||
enable_testing() | ||
file(GLOB TEST_SOURCES "test/test*.cpp" "test/util.cpp") | ||
add_executable(pitch_tests ${TEST_SOURCES}) | ||
target_link_libraries(pitch_tests PRIVATE | ||
pitch_detection | ||
GTest::GTest | ||
GTest::Main) | ||
endif() | ||
|
||
find_package(benchmark QUIET) | ||
if(benchmark_FOUND) | ||
file(GLOB BENCH_SOURCES "test/bench.cpp" "test/util.cpp") | ||
add_executable(pitch_bench ${BENCH_SOURCES}) | ||
target_link_libraries(pitch_bench PRIVATE | ||
pitch_detection | ||
benchmark::benchmark) | ||
endif() | ||
|
||
install(TARGETS pitch_detection LIBRARY DESTINATION lib) | ||
install(FILES include/pitch_detection.h DESTINATION include) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# FindFFTS.cmake | ||
|
||
# Try to find FFTS | ||
# Once done, this will define | ||
# FFTS_FOUND - System has FFTS | ||
# FFTS_INCLUDE_DIRS - The FFTS include directories | ||
# FFTS_LIBRARIES - The libraries needed to use FFTS | ||
|
||
find_path(FFTS_INCLUDE_DIR NAMES ffts/ffts.h) | ||
find_library(FFTS_LIBRARY NAMES ffts) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(FFTS DEFAULT_MSG FFTS_LIBRARY FFTS_INCLUDE_DIR) | ||
|
||
if(FFTS_FOUND) | ||
set(FFTS_INCLUDE_DIRS ${FFTS_INCLUDE_DIR}) | ||
set(FFTS_LIBRARIES ${FFTS_LIBRARY}) | ||
endif() |
Oops, something went wrong.