From f8af65ab16915ee91475c57abb8ef3e8429e05b0 Mon Sep 17 00:00:00 2001 From: wo80 Date: Sun, 16 Jun 2024 20:21:11 +0200 Subject: [PATCH] Disable Gaia and Tensorflow algorithms if libraries are not available. --- src/algorithms/essentia_algorithms_reg_2.cpp | 16 ++++++++++++++++ src/algorithms/extractor/CMakeLists.txt | 9 +++++++-- src/algorithms/rhythm/CMakeLists.txt | 9 +++++++-- src/algorithms/tonal/CMakeLists.txt | 9 +++++++-- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/algorithms/essentia_algorithms_reg_2.cpp b/src/algorithms/essentia_algorithms_reg_2.cpp index 64d3edbaa..2cd82b574 100644 --- a/src/algorithms/essentia_algorithms_reg_2.cpp +++ b/src/algorithms/essentia_algorithms_reg_2.cpp @@ -23,7 +23,9 @@ #include "algorithms/extractor/lowlevelspectraleqloudextractor.h" #include "algorithms/extractor/lowlevelspectralextractor.h" #include "algorithms/extractor/musicextractor.h" +#if ENABLE_GAIA2 #include "algorithms/extractor/musicextractorsvm.h" +#endif #include "algorithms/extractor/rhythmdescriptors.h" #include "algorithms/extractor/tonalextractor.h" #include "algorithms/extractor/tuningfrequencyextractor.h" @@ -96,7 +98,9 @@ #include "algorithms/rhythm/superfluxextractor.h" #include "algorithms/rhythm/superfluxnovelty.h" #include "algorithms/rhythm/superfluxpeaks.h" +#if ENABLE_TENSORFLOW #include "algorithms/rhythm/tempocnn.h" +#endif #include "algorithms/rhythm/temposcalebands.h" #include "algorithms/rhythm/tempotap.h" #include "algorithms/rhythm/tempotapdegara.h" @@ -283,7 +287,9 @@ #include "algorithms/tonal/pitchcontoursmelody.h" #include "algorithms/tonal/pitchcontoursmonomelody.h" #include "algorithms/tonal/pitchcontoursmultimelody.h" +#if ENABLE_TENSORFLOW #include "algorithms/tonal/pitchcrepe.h" +#endif #include "algorithms/tonal/pitchfilter.h" #include "algorithms/tonal/pitchmelodia.h" #include "algorithms/tonal/pitchsaliencefunction.h" @@ -325,7 +331,9 @@ ESSENTIA_API void registerAlgorithm() { AlgorithmFactory::Registrar regLowLevelSpectralEqloudExtractor; AlgorithmFactory::Registrar regLowLevelSpectralExtractor; AlgorithmFactory::Registrar regMusicExtractor; +#if ENABLE_GAIA2 AlgorithmFactory::Registrar regMusicExtractorSVM; +#endif AlgorithmFactory::Registrar regRhythmDescriptors; AlgorithmFactory::Registrar regTonalExtractor; AlgorithmFactory::Registrar regTuningFrequencyExtractor; @@ -397,7 +405,9 @@ ESSENTIA_API void registerAlgorithm() { AlgorithmFactory::Registrar regSuperFluxExtractor; AlgorithmFactory::Registrar regSuperFluxNovelty; AlgorithmFactory::Registrar regSuperFluxPeaks; +#if ENABLE_TENSORFLOW AlgorithmFactory::Registrar regTempoCNN; +#endif AlgorithmFactory::Registrar regTempoScaleBands; AlgorithmFactory::Registrar regTempoTap; AlgorithmFactory::Registrar regTempoTapDegara; @@ -576,7 +586,9 @@ ESSENTIA_API void registerAlgorithm() { AlgorithmFactory::Registrar regPitchContoursMelody; AlgorithmFactory::Registrar regPitchContoursMonoMelody; AlgorithmFactory::Registrar regPitchContoursMultiMelody; +#if ENABLE_TENSORFLOW AlgorithmFactory::Registrar regPitchCREPE; +#endif AlgorithmFactory::Registrar regPitchFilter; AlgorithmFactory::Registrar regPitchMelodia; AlgorithmFactory::Registrar regPitchSalienceFunction; @@ -680,7 +692,9 @@ ESSENTIA_API void registerAlgorithm() { AlgorithmFactory::Registrar regSuperFluxExtractor; AlgorithmFactory::Registrar regSuperFluxNovelty; AlgorithmFactory::Registrar regSuperFluxPeaks; +#if ENABLE_TENSORFLOW AlgorithmFactory::Registrar regTempoCNN; +#endif AlgorithmFactory::Registrar regTempoScaleBands; AlgorithmFactory::Registrar regTempoTap; AlgorithmFactory::Registrar regTempoTapDegara; @@ -864,7 +878,9 @@ ESSENTIA_API void registerAlgorithm() { AlgorithmFactory::Registrar regPitchContoursMelody; AlgorithmFactory::Registrar regPitchContoursMonoMelody; AlgorithmFactory::Registrar regPitchContoursMultiMelody; +#if ENABLE_TENSORFLOW AlgorithmFactory::Registrar regPitchCREPE; +#endif AlgorithmFactory::Registrar regPitchFilter; AlgorithmFactory::Registrar regPitchMelodia; AlgorithmFactory::Registrar regPitchSalienceFunction; diff --git a/src/algorithms/extractor/CMakeLists.txt b/src/algorithms/extractor/CMakeLists.txt index 942a990f5..e854b3b7d 100644 --- a/src/algorithms/extractor/CMakeLists.txt +++ b/src/algorithms/extractor/CMakeLists.txt @@ -8,7 +8,6 @@ target_sources(essentia lowlevelspectraleqloudextractor.cpp lowlevelspectralextractor.cpp musicextractor.cpp - musicextractorsvm.cpp rhythmdescriptors.cpp tonalextractor.cpp tuningfrequencyextractor.cpp @@ -20,7 +19,13 @@ target_sources(essentia lowlevelspectraleqloudextractor.h lowlevelspectralextractor.h musicextractor.h - musicextractorsvm.h rhythmdescriptors.h tonalextractor.h tuningfrequencyextractor.h) + +if(ESSENTIA_USE_GAIA2) + target_sources(essentia + PRIVATE + musicextractorsvm.cpp + musicextractorsvm.h) +endif() diff --git a/src/algorithms/rhythm/CMakeLists.txt b/src/algorithms/rhythm/CMakeLists.txt index 908447186..651d1d6ae 100644 --- a/src/algorithms/rhythm/CMakeLists.txt +++ b/src/algorithms/rhythm/CMakeLists.txt @@ -25,7 +25,6 @@ target_sources(essentia superfluxextractor.cpp superfluxnovelty.cpp superfluxpeaks.cpp - tempocnn.cpp temposcalebands.cpp tempotap.cpp tempotapdegara.cpp @@ -56,9 +55,15 @@ target_sources(essentia superfluxextractor.h superfluxnovelty.h superfluxpeaks.h - tempocnn.h temposcalebands.h tempotap.h tempotapdegara.h tempotapmaxagreement.h tempotapticks.h) + +if(ESSENTIA_USE_TENSORFLOW) + target_sources(essentia + PRIVATE + tempocnn.cpp + tempocnn.h) +endif() diff --git a/src/algorithms/tonal/CMakeLists.txt b/src/algorithms/tonal/CMakeLists.txt index 8d9cb4339..63caa35c1 100644 --- a/src/algorithms/tonal/CMakeLists.txt +++ b/src/algorithms/tonal/CMakeLists.txt @@ -17,7 +17,6 @@ target_sources(essentia pitchcontoursmelody.cpp pitchcontoursmonomelody.cpp pitchcontoursmultimelody.cpp - pitchcrepe.cpp pitchfilter.cpp pitchmelodia.cpp pitchsaliencefunction.cpp @@ -49,7 +48,6 @@ target_sources(essentia pitchcontoursmelody.h pitchcontoursmonomelody.h pitchcontoursmultimelody.h - pitchcrepe.h pitchfilter.h pitchmelodia.h pitchsaliencefunction.h @@ -64,3 +62,10 @@ target_sources(essentia tristimulus.h tuningfrequency.h vibrato.h) + +if(ESSENTIA_USE_TENSORFLOW) + target_sources(essentia + PRIVATE + pitchcrepe.cpp + pitchcrepe.h) +endif()