Skip to content

Commit

Permalink
[Release] 1.0.0-beta6 (#126)
Browse files Browse the repository at this point in the history
* Add pointwise inversion to PCA

* batchsize was not capped down, leading to hilarious crashes (#63)

* updating credits with the new team

* Include SHAs for flucoma-core and current project in version string

* Conform version string with SHAs to semantic versioning spec

* add chroma feature to NoveltySlice

* Toggle BLAS settings for compiling on APPLE (#67)

* disable blas for compiling on macos

* remove line according to O's suggestion

* error in the client of (buf)noveltyslice since introducing chroma as feature

* Enhance/versioning (#75)

* Remove old header template

* Add in TU template and declaration header

* update CMake to new version scheme

* Get SHA from top level source folder

* ensure git is found

* fix issue #23 - zeroing the output vector in the mTracker loop (#82)

* fix issue #23 - zeroing the output vector in the mTracker loop

* now really corrected thanks to @weefuzzy

* Initial unit tests for `include/data` (#83)

* initial FluidTensor tests

* add assert death test to cmake

* more assert death

* fix compile tests

* Working assertion tests, it seems

* Add first FluidTensorView tests

* tidy up cmake a bit

* factor out EqualRange matcher to own header

* Add FluidTensorSupport tests

* rollback to Catch2 

for compatability with approvaltests.cpp

* add tests for FluidDataSet

bubba's first approval test ✨

* test print for bigger range as well

* tidy cmake

* make building tests optional

* remove spurious files from tracking

* add workflow for CI

* make workflow manually triggerable

* correct workflow file extention

* pleading and bargaining with github

* getting event name right

* FluidTensorSlice: fix terrible and aged typename mistake

* workflow: try and cache whole build folder

* wotkflow: unbreak yaml

* workflow: disable fail-fast

* Amend upper frequency limit of mel bands in NoveltySlice to 20kHz

* [Enhance] FluCoMa-wide DataSets as a resource (#88)

* treat wav files as binary

* move audio files to resources folder

* add datasets

* add pre-trained neural networks

* add flucoma corpus

* move datasets to data

* BufAudioTransport now has A-B based arguments

* fix mistakenly fixed type signature in FluidSink

* Tests for framing and overlap add bits

* remove build folder caching as a bad job 

(failing forever once cache goes bad)

* Test/sc ports/slicers (#91)

* Working port of SC NoveltySlice tests

* formatting and constifying

* use generated path for test signal loading

* update testsignals header and cmake

* Add TestOnsetSegmention, update TestNoveltySeg for new resource loading

* Add Onsets and update novelty in CMake

* Add EnvelopeSeg tests and some missing headers

* Add EnvelopeGate tests

* Add TransientSlice tests

* update location of audio files

* add missing function to signals.cpp.in

* Fix test signal for AmpSlice test

* try and speed up test run

* FluidSource test blackholed on MSVC

It doesn't like GENERATE_REF nested in GENERATE. Nosir.

* ignore all build folders for a quieter life

* bump Eigen version (#93)

* bump Eigen version

* note new Eigen version in readme

* add mammoth dataset

* OnsetSlice and NoveltySlice clients: fix block size dependency (#96)

Makes tracking of `frameOffset` stateful across calls to `process` so that odd hop sizes are handled correctly

* `SliceIterator::end()` fix (#97)

* fix problem with 0-size slices and end() sentinels

* adds basic test for slice ietrator fix

* annotate datasets

* add mfcc for fluid_corpus

* update mfcc dataset

* bump version to beta5 (#101)

* Add pointwise inversion to PCA

* Enhance `ParameterSet` (#103)

* Meta: Add HO function to apply function only to select indicies of a tuple

* ParameterSet: Easier application of functions by type with lambdas + discovering the count of params by type

* BufStats: Weights should be an input buffer

* [Fix] Make error language more consistent (#118)

* replace incorrect use of label where identifier is intended

* dont shorten identifier to id

* rename DuplicateLabel to DuplicateIdentifier

* Enhance/slicer detection curves (#114)

* EnvelopeSegmentation: refactor into feature curve + detector

* NoveltySegementation: refactor into feature curve + detector

* OnsetSegmentation: refactor into feature curve + detector

* Add OnsetFeatureClient

* Add NoveltyFeatureClient

* Add AmpFeatureClient

* correct novelty and onset curves for nrt

* fix longstanding assumption in NRT wrapper that client latency == window size

* Update NoveltyFeatureClient to new analysisSettings method

* remove old FIXME comment

* fix cout call killing test on windows

* Missing update change to OnsetFeatureClient::analysisSettings()

* algorithms: NoveltyCurve -> NoveltyFeature

* Novelty: Update algorihtm class name, and change 'feature' param to algorithm

* Also update names in NovletySegmentation

* BufOnsetFeature correct output buffer name

* Novelty / OnsetFeature - cache descriptor values for when sigvs < hop

* more information on failing test thx

Co-authored-by: Owen Green <gungwho@gmail.com>
Co-authored-by: tremblap <info@pierrealexandretremblay.com>
Co-authored-by: g-roma <gerard.roma@gmail.com>
Co-authored-by: James Bradbury <me@jamesbradbury.net>
Co-authored-by: Ted Moore <ted@tedmooremusic.com>
  • Loading branch information
6 people authored Mar 30, 2022
1 parent cdbe03c commit 47f57c7
Show file tree
Hide file tree
Showing 29 changed files with 983 additions and 148 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/flucoma-core-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ jobs:

- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}} -j3


run: ctest -C ${{env.BUILD_TYPE}} -j3 --output-on-failure

83 changes: 83 additions & 0 deletions include/algorithms/public/Envelope.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
Part of the Fluid Corpus Manipulation Project (http://www.flucoma.org/)
Copyright 2017-2019 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 "../util/ButterworthHPFilter.hpp"
#include "../util/FluidEigenMappings.hpp"
#include "../util/SlideUDFilter.hpp"
#include "../../data/FluidIndex.hpp"
#include "../../data/TensorTypes.hpp"
#include <Eigen/Core>
#include <cmath>

namespace fluid {
namespace algorithm {

class Envelope
{

using ArrayXd = Eigen::ArrayXd;

public:
void init(double floor, double hiPassFreq)
{
mFastSlide.init(floor);
mSlowSlide.init(floor);
initFilters(hiPassFreq);
mHiPassFreq = hiPassFreq;
mInitialized = true;
}

double processSample(const double in,
double floor, index fastRampUpTime, index slowRampUpTime,
index fastRampDownTime, index slowRampDownTime,
double hiPassFreq)
{
using namespace std;
assert(mInitialized);
mFastSlide.updateCoeffs(fastRampUpTime, fastRampDownTime);
mSlowSlide.updateCoeffs(slowRampUpTime, slowRampDownTime);
double filtered = in;
if (hiPassFreq != mHiPassFreq)
{
initFilters(hiPassFreq);
mHiPassFreq = hiPassFreq;
}
if (mHiPassFreq > 0){
filtered = mHiPass2.processSample(mHiPass1.processSample(in));
}
double rectified = abs(filtered);
double dB = 20 * log10(rectified);
double clipped = max(dB, floor);
double fast = mFastSlide.processSample(clipped);
double slow = mSlowSlide.processSample(clipped);
return fast - slow;
}

bool initialized() { return mInitialized; }

private:
void initFilters(double cutoff)
{
mHiPass1.init(cutoff);
mHiPass2.init(cutoff);
}

double mHiPassFreq{0};
bool mInitialized{false};

ButterworthHPFilter mHiPass1;
ButterworthHPFilter mHiPass2;
SlideUDFilter mFastSlide;
SlideUDFilter mSlowSlide;
};
} // namespace algorithm
} // namespace fluid
82 changes: 45 additions & 37 deletions include/algorithms/public/EnvelopeSegmentation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ under the European Union’s Horizon 2020 research and innovation programme

#pragma once

#include "Envelope.hpp"
#include "../util/ButterworthHPFilter.hpp"
#include "../util/FluidEigenMappings.hpp"
#include "../util/SlideUDFilter.hpp"
Expand All @@ -29,40 +30,46 @@ class EnvelopeSegmentation
public:
void init(double floor, double hiPassFreq)
{
mFastSlide.init(floor);
mSlowSlide.init(floor);
// mFastSlide.init(floor);
// mSlowSlide.init(floor);
mEnvelope.init(floor,hiPassFreq);
mDebounceCount = 1;
initFilters(hiPassFreq);
mHiPassFreq = hiPassFreq;
// initFilters(hiPassFreq);
// mHiPassFreq = hiPassFreq;
mPrevValue = 0;
mState = false;
mInitialized = true;
// mInitialized = true;
}

double processSample(const double in, double onThreshold, double offThreshold,
double floor, index fastRampUpTime, index slowRampUpTime,
index fastRampDownTime, index slowRampDownTime,
double hiPassFreq, index debounce)
{
using namespace std;
assert(mInitialized);
mFastSlide.updateCoeffs(fastRampUpTime, fastRampDownTime);
mSlowSlide.updateCoeffs(slowRampUpTime, slowRampDownTime);
double filtered = in;
if (hiPassFreq != mHiPassFreq)
{
initFilters(hiPassFreq);
mHiPassFreq = hiPassFreq;
}
if (mHiPassFreq > 0){
filtered = mHiPass2.processSample(mHiPass1.processSample(in));
}
double rectified = abs(filtered);
double dB = 20 * log10(rectified);
double clipped = max(dB, floor);
double fast = mFastSlide.processSample(clipped);
double slow = mSlowSlide.processSample(clipped);
double value = fast - slow;
// using namespace std;
// assert(mInitialized);
// mFastSlide.updateCoeffs(fastRampUpTime, fastRampDownTime);
// mSlowSlide.updateCoeffs(slowRampUpTime, slowRampDownTime);
// double filtered = in;
// if (hiPassFreq != mHiPassFreq)
// {
// initFilters(hiPassFreq);
// mHiPassFreq = hiPassFreq;
// }
// if (mHiPassFreq > 0){
// filtered = mHiPass2.processSample(mHiPass1.processSample(in));
// }
// double rectified = abs(filtered);
// double dB = 20 * log10(rectified);
// double clipped = max(dB, floor);
// double fast = mFastSlide.processSample(clipped);
// double slow = mSlowSlide.processSample(clipped);
// double value = fast - slow;


double value =
mEnvelope.processSample(in, floor, fastRampUpTime, slowRampUpTime,
fastRampDownTime, slowRampUpTime, hiPassFreq);
double detected = 0;

if (!mState && value > onThreshold && mPrevValue < onThreshold &&
Expand All @@ -81,25 +88,26 @@ class EnvelopeSegmentation
return detected;
}

bool initialized() { return mInitialized; }
bool initialized() { return mEnvelope.initialized(); }

private:
void initFilters(double cutoff)
{
mHiPass1.init(cutoff);
mHiPass2.init(cutoff);
}

double mHiPassFreq{0};
// void initFilters(double cutoff)
// {
// mHiPass1.init(cutoff);
// mHiPass2.init(cutoff);
// }

Envelope mEnvelope;
// double mHiPassFreq{0};
index mDebounceCount{1};
double mPrevValue{0};
bool mInitialized{false};
// bool mInitialized{false};
bool mState{false};

ButterworthHPFilter mHiPass1;
ButterworthHPFilter mHiPass2;
SlideUDFilter mFastSlide;
SlideUDFilter mSlowSlide;
// ButterworthHPFilter mHiPass1;
// ButterworthHPFilter mHiPass2;
// SlideUDFilter mFastSlide;
// SlideUDFilter mSlowSlide;
};
} // namespace algorithm
} // namespace fluid
62 changes: 62 additions & 0 deletions include/algorithms/public/NoveltyFeature.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
Part of the Fluid Corpus Manipulation Project (http://www.flucoma.org/)
Copyright 2017-2019 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 "../util/FluidEigenMappings.hpp"
#include "../util/Novelty.hpp"
#include "../../data/FluidIndex.hpp"
#include "../../data/TensorTypes.hpp"
#include <Eigen/Core>

namespace fluid {
namespace algorithm {

class NoveltyFeature
{

public:
using ArrayXd = Eigen::ArrayXd;

NoveltyFeature(index maxKernelSize, index maxFilterSize)
: mFilterBufferStorage(maxFilterSize), mNovelty(maxKernelSize)
{}

void init(index kernelSize, index filterSize, index nDims)
{
assert(kernelSize % 2);
mNovelty.init(kernelSize, nDims);
mFilterBuffer = mFilterBufferStorage.segment(0, filterSize);
mFilterBuffer.setZero();
}

double processFrame(const RealVectorView input)
{
double novelty = mNovelty.processFrame(_impl::asEigen<Eigen::Array>(input));
index filterSize = mFilterBuffer.size();

if (filterSize > 1)
{
mFilterBuffer.segment(0, filterSize - 1) =
mFilterBuffer.segment(1, filterSize - 1);
}

mFilterBuffer(filterSize - 1) = novelty;

return mFilterBuffer.mean();
}

private:
ArrayXd mFilterBuffer;
ArrayXd mFilterBufferStorage;
Novelty mNovelty;
};
} // namespace algorithm
} // namespace fluid
29 changes: 9 additions & 20 deletions include/algorithms/public/NoveltySegmentation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ under the European Union’s Horizon 2020 research and innovation programme

#pragma once

#include "NoveltyFeature.hpp"
#include "../util/FluidEigenMappings.hpp"
#include "../util/Novelty.hpp"
#include "../../data/FluidIndex.hpp"
#include "../../data/TensorTypes.hpp"
#include <Eigen/Core>
Expand All @@ -26,32 +26,23 @@ class NoveltySegmentation
using ArrayXd = Eigen::ArrayXd;

NoveltySegmentation(index maxKernelSize, index maxFilterSize)
: mFilterBufferStorage(maxFilterSize), mNovelty(maxKernelSize)
: mNovelty(maxFilterSize, maxKernelSize)
{}

void init(index kernelSize, index filterSize, index nDims)
{
assert(kernelSize % 2);
mNovelty.init(kernelSize, nDims);
mFilterBuffer = mFilterBufferStorage.segment(0, filterSize);
mFilterBuffer.setZero();
mNovelty.init(kernelSize, filterSize, nDims);
mDebounceCount = 1;
}

double processFrame(const RealVectorView input, double threshold,
index minSliceLength)
{
double novelty = mNovelty.processFrame(_impl::asEigen<Eigen::Array>(input));
double detected = 0.;
index filterSize = mFilterBuffer.size();
if (filterSize > 1)
{
mFilterBuffer.segment(0, filterSize - 1) =
mFilterBuffer.segment(1, filterSize - 1);
}

mPeakBuffer.segment(0, 2) = mPeakBuffer.segment(1, 2);
mFilterBuffer(filterSize - 1) = novelty;
mPeakBuffer(2) = mFilterBuffer.mean();
mPeakBuffer(2) = mNovelty.processFrame(input);

if (mPeakBuffer(1) > mPeakBuffer(0) && mPeakBuffer(1) > mPeakBuffer(2) &&
mPeakBuffer(1) > threshold && mDebounceCount == 0)
{
Expand All @@ -66,11 +57,9 @@ class NoveltySegmentation
}

private:
ArrayXd mFilterBuffer;
ArrayXd mFilterBufferStorage;
ArrayXd mPeakBuffer{3};
Novelty mNovelty;
index mDebounceCount{1};
NoveltyFeature mNovelty;
ArrayXd mPeakBuffer{3};
index mDebounceCount{1};
};
} // namespace algorithm
} // namespace fluid
Loading

0 comments on commit 47f57c7

Please sign in to comment.