From 039ce8001a7ab227bf09e23f9d0befc5182941e5 Mon Sep 17 00:00:00 2001 From: Pierre Alexandre Tremblay Date: Thu, 20 Jan 2022 11:14:15 +0000 Subject: [PATCH 1/2] fix issue #23 - zeroing the output vector in the mTracker loop --- include/clients/rt/ChromaClient.hpp | 1 + include/clients/rt/MFCCClient.hpp | 1 + include/clients/rt/MelBandsClient.hpp | 1 + 3 files changed, 3 insertions(+) diff --git a/include/clients/rt/ChromaClient.hpp b/include/clients/rt/ChromaClient.hpp index 58cc720f6..8ef364567 100644 --- a/include/clients/rt/ChromaClient.hpp +++ b/include/clients/rt/ChromaClient.hpp @@ -90,6 +90,7 @@ class ChromaClient : public FluidBaseClient, public AudioIn, public ControlOut { mMagnitude.resize(get().frameSize()); mChroma.resize(get()); + output[0].fill(0);//zero the output mAlgorithm.init(get(), get().frameSize(), get(), sampleRate()); } diff --git a/include/clients/rt/MFCCClient.hpp b/include/clients/rt/MFCCClient.hpp index 0bdabfaa4..493f9261e 100644 --- a/include/clients/rt/MFCCClient.hpp +++ b/include/clients/rt/MFCCClient.hpp @@ -103,6 +103,7 @@ class MFCCClient : public FluidBaseClient, public AudioIn, public ControlOut mMagnitude.resize(get().frameSize()); mBands.resize(get()); mCoefficients.resize(get() + !has0); + output[0].fill(0);//zero the output mMelBands.init(get(), get(), get(), get().frameSize(), sampleRate(), get().winSize()); diff --git a/include/clients/rt/MelBandsClient.hpp b/include/clients/rt/MelBandsClient.hpp index 8f36a791d..7f09d234b 100644 --- a/include/clients/rt/MelBandsClient.hpp +++ b/include/clients/rt/MelBandsClient.hpp @@ -93,6 +93,7 @@ class MelBandsClient : public FluidBaseClient, public AudioIn, public ControlOut { mMagnitude.resize(get().frameSize()); mBands.resize(get()); + output[0].fill(0);//zero the output mMelBands.init(get(), get(), get(), get().frameSize(), sampleRate(), get().winSize()); From 55d4ca4e9e5edbc39354f0a379ab295e1143ecb8 Mon Sep 17 00:00:00 2001 From: Pierre Alexandre Tremblay Date: Thu, 20 Jan 2022 13:25:14 +0000 Subject: [PATCH 2/2] now really corrected thanks to @weefuzzy --- include/clients/rt/ChromaClient.hpp | 2 +- include/clients/rt/MFCCClient.hpp | 2 +- include/clients/rt/MelBandsClient.hpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/clients/rt/ChromaClient.hpp b/include/clients/rt/ChromaClient.hpp index 8ef364567..f34de86a9 100644 --- a/include/clients/rt/ChromaClient.hpp +++ b/include/clients/rt/ChromaClient.hpp @@ -90,7 +90,6 @@ class ChromaClient : public FluidBaseClient, public AudioIn, public ControlOut { mMagnitude.resize(get().frameSize()); mChroma.resize(get()); - output[0].fill(0);//zero the output mAlgorithm.init(get(), get().frameSize(), get(), sampleRate()); } @@ -103,6 +102,7 @@ class ChromaClient : public FluidBaseClient, public AudioIn, public ControlOut }); output[0](Slice(0,get())) = mChroma; + output[0](Slice(get(), get() - get())).fill(0); } index latency() { return get().winSize(); } diff --git a/include/clients/rt/MFCCClient.hpp b/include/clients/rt/MFCCClient.hpp index 493f9261e..0cab8c696 100644 --- a/include/clients/rt/MFCCClient.hpp +++ b/include/clients/rt/MFCCClient.hpp @@ -103,7 +103,6 @@ class MFCCClient : public FluidBaseClient, public AudioIn, public ControlOut mMagnitude.resize(get().frameSize()); mBands.resize(get()); mCoefficients.resize(get() + !has0); - output[0].fill(0);//zero the output mMelBands.init(get(), get(), get(), get().frameSize(), sampleRate(), get().winSize()); @@ -119,6 +118,7 @@ class MFCCClient : public FluidBaseClient, public AudioIn, public ControlOut output[0](Slice(0, get())) = mCoefficients(Slice(get(), get())); + output[0](Slice(get(), get() - get())).fill(0); } index latency() { return get().winSize(); } diff --git a/include/clients/rt/MelBandsClient.hpp b/include/clients/rt/MelBandsClient.hpp index 7f09d234b..4af861c4d 100644 --- a/include/clients/rt/MelBandsClient.hpp +++ b/include/clients/rt/MelBandsClient.hpp @@ -93,7 +93,6 @@ class MelBandsClient : public FluidBaseClient, public AudioIn, public ControlOut { mMagnitude.resize(get().frameSize()); mBands.resize(get()); - output[0].fill(0);//zero the output mMelBands.init(get(), get(), get(), get().frameSize(), sampleRate(), get().winSize()); @@ -108,6 +107,7 @@ class MelBandsClient : public FluidBaseClient, public AudioIn, public ControlOut // for (index i = 0; i < get(); ++i) // output[asUnsigned(i)](0) = static_cast(mBands(i)); output[0](Slice(0,get())) = mBands; + output[0](Slice(get(), get() - get())).fill(0); } index latency() { return get().winSize(); }