Skip to content

Commit

Permalink
a little work on harmonic recognizer
Browse files Browse the repository at this point in the history
Issue #281 set up  test recording for harmonic recognizer.
  • Loading branch information
towsey committed Feb 8, 2020
1 parent 1dfaa92 commit 4571c2d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
40 changes: 37 additions & 3 deletions src/AnalysisPrograms/Recognizers/Base/HarmonicParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,40 @@ namespace AnalysisPrograms.Recognizers.Base
[YamlTypeTag(typeof(HarmonicParameters))]
public class HarmonicParameters : CommonParameters
{
//ComponentName: Harmonic
//SpeciesName: Curlew
//FrameSize: 512
//FrameStep: 512
//WindowFunction: HANNING
//BgNoiseThreshold: 0.0
//# min and max of the freq band to search
//MinHertz: 1000
//MaxHertz: 6500
//MinDuration: 0.5
//MaxDuration: 3.0
//DecibelThreshold: 1.5
//# Parameters for the finding formants.
//# duration of DCT in seconds
//#DctDuration: 0.5
//# minimum acceptable value of a DCT coefficient
//DctThreshold: 0.5
//MinFormantGap: 800
//MaxFormantGap: 2200

/// <summary>
/// Gets or sets the bottom bound of the rectangle. Units are Hertz.
/// </summary>
public int? MinFormantGap { get; set; }

/// <summary>
/// Gets or sets the the top bound of the rectangle. Units are Hertz.
/// </summary>
public int? MaxFormantGap { get; set; }

//#IntensityThreshold: 0.15
//# Event threshold - Determines FP / FN trade-off for events.
//EventThreshold: 0.2

public static (List<AcousticEvent>, double[]) GetComponentsWithHarmonics(
SpectrogramStandard sonogram,
int minHz,
Expand All @@ -29,12 +63,12 @@ public static (List<AcousticEvent>, double[]) GetComponentsWithHarmonics(
double decibelThreshold,
double minDuration,
double maxDuration,
int minFormantGap,
int maxFormantGap,
TimeSpan segmentStartOffset)
{
// paramters to be passed
// parameters to be passed
double harmonicIntensityThreshold = 0.15;
int minFormantGap = 180;
int maxFormantGap = 450;

// Event threshold - Determines FP / FN trade-off for events.
//double eventThreshold = 0.2;
Expand Down
2 changes: 2 additions & 0 deletions src/AnalysisPrograms/Recognizers/GenericRecognizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ public override RecognizerResults Recognize(
hp.DecibelThreshold.Value,
hp.MinDuration.Value,
hp.MaxDuration.Value,
hp.MinFormantGap.Value,
hp.MaxFormantGap.Value,
segmentStartOffset);

var plot = PreparePlot(scoreArray, $"{profileName} (Harmonics:dB Intensity)", hp.DecibelThreshold.Value);
Expand Down

0 comments on commit 4571c2d

Please sign in to comment.