You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I meet a issue, when i test a wav file to get it's key by keyOfAudio function, I found a crash issue at below code stack:
finaChromagram()-->preprocess()-->lpf->filter() -->audio.advanceWriteIterator(shortcutFactor)
After debug, I think the flush remainder buffer has some issue, after first progressiveChromagram() operation of keyOfAudio(), the remainder buffer data is not enough for downsample(remainder lenght is small than downsampleFactor), so we will fail when we want to advance the flush buffer's write iterator.
_key_t KeyFinder::keyOfAudio(const AudioData& originalAudio) {
}_ I think we can just erase the workspace's remainder buffer, since it's downsample result would be empty. void KeyFinder::finalChromagram(Workspace& workspace) {
// flush remainder buffer
if (workspace.remainderBuffer.getSampleCount() > 0) {
AudioData flush;
preprocess(flush, workspace, true);
}
......
}
So I modified the code like below, and it works: void KeyFinder::finalChromagram(Workspace& workspace) {
// flush remainder buffer
if (workspace.remainderBuffer.getSampleCount() > 0) {
//AudioData flush;
//preprocess(flush, workspace, true);
//remained data not enough for downsample, just skip them
workspace.remainderBuffer.discardFramesFromFront(workspace.remainderBuffer.getFrameCount());
}
.....
}
The text was updated successfully, but these errors were encountered:
I meet a issue, when i test a wav file to get it's key by keyOfAudio function, I found a crash issue at below code stack:
finaChromagram()-->preprocess()-->lpf->filter() -->audio.advanceWriteIterator(shortcutFactor)
After debug, I think the flush remainder buffer has some issue, after first progressiveChromagram() operation of keyOfAudio(), the remainder buffer data is not enough for downsample(remainder lenght is small than downsampleFactor), so we will fail when we want to advance the flush buffer's write iterator.
_key_t KeyFinder::keyOfAudio(const AudioData& originalAudio) {
}_
I think we can just erase the workspace's remainder buffer, since it's downsample result would be empty.
void KeyFinder::finalChromagram(Workspace& workspace) {
// flush remainder buffer
if (workspace.remainderBuffer.getSampleCount() > 0) {
AudioData flush;
preprocess(flush, workspace, true);
}
......
}
So I modified the code like below, and it works:
void KeyFinder::finalChromagram(Workspace& workspace) {
// flush remainder buffer
if (workspace.remainderBuffer.getSampleCount() > 0) {
//AudioData flush;
//preprocess(flush, workspace, true);
//remained data not enough for downsample, just skip them
workspace.remainderBuffer.discardFramesFromFront(workspace.remainderBuffer.getFrameCount());
}
.....
}
The text was updated successfully, but these errors were encountered: