diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index d033246b0..d200b8d84 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -916,15 +916,13 @@ if(ENABLE_FEATURE_MORSEDECODER) endif() # For denoiser feature -if(ENABLE_FEATURE_DENOISER) +if(NOT APPLE AND ENABLE_FEATURE_DENOISER) if (WIN32) set(RNNOISE_LIBRARIES "${SDRANGEL_BINARY_LIB_DIR}/rnnoise.lib" CACHE INTERNAL "") - set(RNNOISE_ARGS "-DRNN_ENABLE_X86_RTCD=ON") + set(RNNOISE_ARGS "-DRNN_ENABLE_X86_RTCD=OFF") elseif (LINUX) set(RNNOISE_LIBRARIES "${EXTERNAL_BUILD_LIBRARIES}/lib${LIB_SUFFIX}/librnnoise${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "") set(RNNOISE_ARGS "-DRNN_ENABLE_X86_RTCD=ON") - elseif (APPLE) - set(RNNOISE_ARGS "") endif() ExternalProject_Add(rnnoise GIT_REPOSITORY https://github.com/f4exb/rnnoise.git @@ -944,11 +942,6 @@ if(ENABLE_FEATURE_DENOISER) set(RNNOISE_INCLUDE_DIR "${EXTERNAL_BUILD_LIBRARIES}/rnnoise/src/rnnoise/include" CACHE INTERNAL "") if (WIN32) install(FILES "${SDRANGEL_BINARY_BIN_DIR}/rnnoise${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}") - elseif (APPLE) - set(RNNOISE_LIBRARIES "${binary_dir}/src/librnnoise${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "") - install(DIRECTORY "${binary_dir}/src" DESTINATION "${INSTALL_LIB_DIR}" - FILES_MATCHING PATTERN "librnnoise*${CMAKE_SHARED_LIBRARY_SUFFIX}") - set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${binary_dir}/src") endif () endif() diff --git a/plugins/feature/denoiser/denoiserworker.cpp b/plugins/feature/denoiser/denoiserworker.cpp index 8571f1e84..7ba4727ef 100644 --- a/plugins/feature/denoiser/denoiserworker.cpp +++ b/plugins/feature/denoiser/denoiserworker.cpp @@ -350,7 +350,7 @@ void DenoiserWorker::processSample( m_magsq = re*re; m_channelPowerAvg(m_magsq); - if (!m_settings.m_enableDenoiser || m_settings.m_denoiserType == DenoiserSettings::DenoiserType::DenoiserType_None) + if ((!m_settings.m_enableDenoiser || m_settings.m_denoiserType == DenoiserSettings::DenoiserType::DenoiserType_None) && !m_settings.m_audioMute) { // if ((s_dbgCount % 48000) == 1) { // qDebug() << "DenoiserWorker::processSample[I16]: passthrough branch"; @@ -371,7 +371,7 @@ void DenoiserWorker::processSample( m_audioBufferFill = 0; } } - else if (m_settings.m_denoiserType == DenoiserSettings::DenoiserType::DenoiserType_RNnoise) + else if ((m_settings.m_denoiserType == DenoiserSettings::DenoiserType::DenoiserType_RNnoise) && !m_settings.m_audioMute) { // if ((s_dbgCount % 48000) == 1) { // qDebug() << "DenoiserWorker::processSample[I16]: RNNoise branch"; @@ -389,7 +389,7 @@ void DenoiserWorker::processSample( for (int j = 0; j < 480; j++) { float outSample = m_rnnoiseOut[j]; - m_sampleBuffer.push_back(Sample(outSample, 0)); + m_sampleBuffer.push_back(Sample(outSample * 181, 0)); // 181 = sqrt(32768) int16_t audioSample = static_cast(outSample); m_audioBuffer[m_audioBufferFill].l = audioSample; m_audioBuffer[m_audioBufferFill].r = audioSample; @@ -420,7 +420,7 @@ void DenoiserWorker::processSample( m_magsq = re*re + im*im; m_channelPowerAvg(m_magsq); - if (!m_settings.m_enableDenoiser || m_settings.m_denoiserType == DenoiserSettings::DenoiserType::DenoiserType_None) + if ((!m_settings.m_enableDenoiser || m_settings.m_denoiserType == DenoiserSettings::DenoiserType::DenoiserType_None) && !m_settings.m_audioMute) { // if ((s_dbgCount % 48000) == 1) { // qDebug() << "DenoiserWorker::processSample[CI16]: passthrough branch"; @@ -441,7 +441,7 @@ void DenoiserWorker::processSample( m_audioBufferFill = 0; } } - else if (m_settings.m_denoiserType == DenoiserSettings::DenoiserType::DenoiserType_RNnoise) + else if ((m_settings.m_denoiserType == DenoiserSettings::DenoiserType::DenoiserType_RNnoise) && !m_settings.m_audioMute) { // if ((s_dbgCount % 48000) == 1) { // qDebug() << "DenoiserWorker::processSample[CI16]: RNNoise branch"; @@ -459,7 +459,7 @@ void DenoiserWorker::processSample( for (int j = 0; j < 480; j++) { float outSample = m_rnnoiseOut[j]; - m_sampleBuffer.push_back(Sample(outSample, outSample)); + m_sampleBuffer.push_back(Sample(outSample * 181, outSample * 181)); // 181 = sqrt(32768) int16_t audioSample = static_cast(outSample); m_audioBuffer[m_audioBufferFill].l = audioSample; m_audioBuffer[m_audioBufferFill].r = audioSample; diff --git a/plugins/feature/denoiser/denoiserworker.h b/plugins/feature/denoiser/denoiserworker.h index 6a4b8e995..f72eca8dc 100644 --- a/plugins/feature/denoiser/denoiserworker.h +++ b/plugins/feature/denoiser/denoiserworker.h @@ -32,7 +32,7 @@ #include "denoisersettings.h" class WavFileRecord; -class DenoiseState; +struct DenoiseState; class DenoiserWorker : public QObject { Q_OBJECT diff --git a/plugins/feature/denoiser/readme.md b/plugins/feature/denoiser/readme.md index d00c22467..09d41e397 100644 --- a/plugins/feature/denoiser/readme.md +++ b/plugins/feature/denoiser/readme.md @@ -13,6 +13,8 @@ It connects to the "demod" stream of Rx channels similarly to the Demod analyzer - WFM demodulator - WDSP plugin (multimode) +Note that this plugin is not available on Mac O/S + The following noise reduction schemes are covered. It can be selected via the (6) combo box:

RNNoise