Skip to content

Commit

Permalink
Fix merge commit, add noise reduction type to generic recognizer
Browse files Browse the repository at this point in the history
  • Loading branch information
atruskie committed Apr 9, 2021
1 parent a89b786 commit c2e49ab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/technical/apidoc/HarmonicParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ at that index is the formant amplitude. The index with largest amplitude
indicates the likely formant gap, but `DctThreshold` sets the minimum
acceptable amplitude value. Lowering `DctThreshold` increases the likelihood
that random noise will be accepted as a true set of formants; increasing
`DctThreshold` increases the likelihood that a target set of formants is rejected.
`DctThreshold` increases the likelihood that a target set of formants is rejected.
3 changes: 1 addition & 2 deletions src/AnalysisPrograms/Recognizers/GenericRecognizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ public override RecognizerResults Recognize(
}
}
}

return results;
}

Expand Down Expand Up @@ -461,7 +460,7 @@ private static SonogramConfig ParametersToSonogramConfig(CommonParameters common
WindowStep = windowStep,
WindowOverlap = (windowSize - windowStep) / (double)windowSize,
WindowFunction = common.WindowFunction?.ToString(),
NoiseReductionType = NoiseReductionType.Standard,
NoiseReductionType = common.NoiseReductionType ?? NoiseReductionType.Standard,
NoiseReductionParameter = common.BgNoiseThreshold ?? 0.0,
};
}
Expand Down
8 changes: 8 additions & 0 deletions src/AudioAnalysisTools/CommonParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace AnalysisPrograms.Recognizers.Base
{
using AudioAnalysisTools.DSP;
using TowseyLibrary;

/// <summary>
Expand Down Expand Up @@ -81,5 +82,12 @@ public abstract class CommonParameters
/// Units are decibels.
/// </summary>
public double?[] DecibelThresholds { get; set; }

/// <summary>
/// The type of noise reduction to use.
/// Defaults to <see cref="NoiseReductionType.Standard"/>.
/// </summary>
/// <value>One of the <see cref="NoiseReductionType"/> values.</value>
public NoiseReductionType? NoiseReductionType { get; set; }
}
}

0 comments on commit c2e49ab

Please sign in to comment.