Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/slicer blocksize dependency #96

Merged
merged 1 commit into from
Feb 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions include/clients/rt/NoveltySliceClient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class NoveltySliceClient : public FluidBaseClient,
RealMatrix in(1, hostVecSize);
in.row(0) = input[0];
RealMatrix out(1, hostVecSize);
index frameOffset = 0; // in case kHopSize < hostVecSize

mBufferedProcess.push(RealMatrixView(in));
mBufferedProcess.process(
windowSize, windowSize, get<kFFT>().hopSize(), c,
Expand Down Expand Up @@ -184,11 +184,15 @@ class NoveltySliceClient : public FluidBaseClient,
mLoudness.processFrame(in.row(0), mFeature, true, true);
break;
}
if (frameOffset < out.row(0).size())
out.row(0)(frameOffset) = mNovelty.processFrame(
if (mFrameOffset < out.row(0).size())
out.row(0)(mFrameOffset) = mNovelty.processFrame(
mFeature, get<kThreshold>(), get<kDebounce>());
frameOffset += get<kFFT>().hopSize();
mFrameOffset += get<kFFT>().hopSize();
});

mFrameOffset =
mFrameOffset < hostVecSize ? mFrameOffset : mFrameOffset - hostVecSize;

output[0] = out.row(0);
}

Expand All @@ -203,6 +207,7 @@ class NoveltySliceClient : public FluidBaseClient,
void reset()
{
mBufferedProcess.reset();
mFrameOffset = 0;
initAlgorithms(get<kFeature>(), get<kFFT>().winSize());
}

Expand All @@ -221,6 +226,7 @@ class NoveltySliceClient : public FluidBaseClient,
algorithm::ChromaFilterBank mChroma;
algorithm::YINFFT mYinFFT;
algorithm::Loudness mLoudness;
index mFrameOffset{0}; // in case kHopSize < hostVecSize
};
} // namespace noveltyslice

Expand Down
14 changes: 10 additions & 4 deletions include/clients/rt/OnsetSliceClient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,28 @@ class OnsetSliceClient : public FluidBaseClient, public AudioIn, public AudioOut
RealMatrix in(1, hostVecSize);
in.row(0) = input[0];
RealMatrix out(1, hostVecSize);
index frameOffset = 0; // in case kHopSize < hostVecSize

mBufferedProcess.push(RealMatrixView(in));
mBufferedProcess.processInput(
totalWindow, get<kFFT>().hopSize(), c, [&, this](RealMatrixView in) {
out.row(0)(frameOffset) = mAlgorithm.processFrame(
out.row(0)(mFrameOffset) = mAlgorithm.processFrame(
in.row(0), get<kFunction>(), get<kFilterSize>(),
get<kThreshold>(), get<kDebounce>(), get<kFrameDelta>());
frameOffset += get<kFFT>().hopSize();
mFrameOffset += get<kFFT>().hopSize();
});

mFrameOffset =
mFrameOffset < hostVecSize ? mFrameOffset : mFrameOffset - hostVecSize;

output[0] = out.row(0);
}

index latency() { return static_cast<index>(get<kFFT>().hopSize()); }

void reset()
{
{
mBufferedProcess.reset();
mFrameOffset = 0;
mAlgorithm.init(get<kFFT>().winSize(), get<kFFT>().fftSize(),
get<kFilterSize>());
}
Expand All @@ -132,6 +137,7 @@ class OnsetSliceClient : public FluidBaseClient, public AudioIn, public AudioOut
ParameterTrackChanges<index, index, index> mBufferParamsTracker;
ParameterTrackChanges<index, index> mParamsTracker;
BufferedProcess mBufferedProcess;
index mFrameOffset{0}; // in case kHopSize < hostVecSize
};
} // namespace onsetslice

Expand Down