Skip to content

Commit

Permalink
Fixes window overlap calculation for generic recognizer
Browse files Browse the repository at this point in the history
  • Loading branch information
atruskie committed Feb 1, 2020
1 parent 5b1e400 commit 21f89d3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/AnalysisPrograms/Recognizers/GenericRecognizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,14 @@ public override void SummariseResults(

private static SonogramConfig ParametersToSonogramConfig(CommonParameters common)
{
const int DefaultWindow = 512;
int window = common.FrameSize ?? 512;
int step = common.FrameStep ?? 512;
double overlap = (window - step) / (double)window;

return new SonogramConfig()
{
WindowSize = common.FrameSize ?? DefaultWindow,
WindowOverlap = common.FrameStep / (common.FrameSize ?? DefaultWindow) ?? 0.0,
WindowSize = window,
WindowOverlap = overlap,
NoiseReductionType = NoiseReductionType.Standard,
NoiseReductionParameter = common.BgNoiseThreshold ?? 0.0,
};
Expand Down

0 comments on commit 21f89d3

Please sign in to comment.