From cc786d3bc09e6c33c96c1a101091c85403fde76c Mon Sep 17 00:00:00 2001 From: Pierre Alexandre Tremblay Date: Sat, 10 Oct 2026 10:24:56 +0200 Subject: [PATCH] this seems to be a dangling leftover of a previous life --- include/flucoma/clients/nrt/NoveltyClient.hpp | 119 ------------------ 1 file changed, 119 deletions(-) delete mode 100644 include/flucoma/clients/nrt/NoveltyClient.hpp diff --git a/include/flucoma/clients/nrt/NoveltyClient.hpp b/include/flucoma/clients/nrt/NoveltyClient.hpp deleted file mode 100644 index a718ac0c8..000000000 --- a/include/flucoma/clients/nrt/NoveltyClient.hpp +++ /dev/null @@ -1,119 +0,0 @@ -/* -Part of the Fluid Corpus Manipulation Project (http://www.flucoma.org/) -Copyright University of Huddersfield. -Licensed under the BSD-3 License. -See license.md file in the project root for full license information. -This project has received funding from the European Research Council (ERC) -under the European Union’s Horizon 2020 research and innovation programme -(grant agreement No 725899). -*/ - -#pragma once - -#include "../common/ParameterTypes.hpp" -#include "../common/ParameterConstraints.hpp" -#include "../common/FluidBaseClient.hpp" -#include "../common/FluidContext.hpp" -#include "../common/SpikesToTimes.hpp" -#include "../../algorithms/public/NoveltySegmentation.hpp" -#include "../../algorithms/public/STFT.hpp" -#include "FluidNRTClientWrapper.hpp" - -namespace fluid { -namespace client { - -enum NoveltyParamIndex {kSource, kOffset, kNumFrames, kStartChan, kNumChans, kTransBuf, kKernelSize, kThreshold,kFilterSize,kFFT}; - -auto constexpr NoveltyParams =defineParameters( - BufferParam("source","Source Buffer"), - LongParam("startFrame","Source Offset",0,Min(0)), - LongParam("numFrames","Number of Frames",-1), - LongParam("startChan","Start Channel",0,Min(0)), - LongParam("numChans","Number of Channels",-1), - BufferParam("indices", "Indices Buffer"), - LongParam("kernelSize", "Kernel Size", 3, Min(3), Odd()), - FloatParam("threshold", "Threshold", 0.8, Min(0.)), - LongParam("filterSize", "Smoothing Filter Size", 1, FrameSizeUpperLimit()), - FFTParam("fftSettings", "FFT Settings", 1024, -1, -1) - ); - - -class NoveltyClient: public FluidBaseClient, public OfflineIn, public OfflineOut -{ - -public: - - NoveltyClient(ParamSetViewType& p) : FluidBaseClient(p) - {} - - template - Result process(FluidContext& c) - { - - if(!get().get()) - return {Result::Status::kError, "No input buffer supplied"}; - - BufferAdaptor::Access source(get().get()); - - if(!source.exists()) - return {Result::Status::kError, "Input buffer not found"}; - - if(!source.valid()) - return {Result::Status::kError, "Can't access input buffer"}; - - - { - BufferAdaptor::Access idx(get().get()); - - if(!idx.exists()) - return {Result::Status::kError, "Output buffer not found"}; - - } - -// if(!idx.valid()) -// return {Result::Status::kError, "Can't access output buffer"}; - - - auto& fftParams = get(); - - size_t nChannels = get() == -1 ? source.numChans() : get(); - size_t nFrames = get() == -1 ? source.numFrames(): get(); - size_t nWindows = std::floor((nFrames + fftParams.hopSize()) / fftParams.hopSize()); - size_t nBins = fftParams.frameSize(); - - FluidTensor monoSource(nFrames); - - // Make a mono sum; - for (size_t i = 0; i < nChannels; ++i) { - monoSource.apply( - source.samps(get(), nFrames, get() + i), - [](double &x, double y) { x += y; }); - } - - - algorithm::STFT stft(fftParams.winSize(), fftParams.fftSize(), fftParams.hopSize()); - algorithm::ISTFT istft(fftParams.winSize(), fftParams.fftSize(), fftParams.hopSize()); - - algorithm::NoveltySegmentation processor(get(), get(), - get()); - - auto spectrum = FluidTensor,2>(nWindows,nBins); - auto magnitude = FluidTensor(nWindows,nBins); - auto outputMags = FluidTensor(nWindows,nBins); - - stft.process(monoSource, spectrum); - algorithm::STFT::magnitude(spectrum,magnitude); - - auto changePoints = FluidTensor(magnitude.rows()); - - processor.process(magnitude, changePoints); - - impl::spikesToTimes(changePoints(Slice(0)), get().get(), fftParams.hopSize(), get(), nFrames, source.sampleRate()); - return {Result::Status::kOk,""}; - } -}; - -using NRTThreadedNoveltyClient = NRTThreadingAdaptor; - -} // namespace client -} // namespace fluid