Skip to content

Commit

Permalink
Update OnebinTrackAlgorithm.cs
Browse files Browse the repository at this point in the history
Issue #390 Due to implementation of a new way of finding events with multiple decibel thresholds, have had to change the Algorithms used by Generic recognizers. So far only done one of hte seven algorithms.
  • Loading branch information
towsey authored and atruskie committed Nov 1, 2020
1 parent 631ec94 commit 43ab9f9
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/AudioAnalysisTools/Tracks/OnebinTrackAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,26 @@ public static class OnebinTrackAlgorithm
public static (List<EventCommon> Events, List<Plot> DecibelPlots) GetOnebinTracks(
SpectrogramStandard spectrogram,
OnebinTrackParameters parameters,
double? decibelThreshold,
TimeSpan segmentStartOffset,
string profileName)
{
var decibelThresholds = parameters.DecibelThresholds;
var spectralEvents = new List<EventCommon>();
var plots = new List<Plot>();

foreach (var threshold in decibelThresholds)
{
double[] decibelArray;
List<EventCommon> events;
double[] decibelArray;
List<EventCommon> events;

(events, decibelArray) = GetOnebinTracks(
spectrogram,
parameters,
segmentStartOffset,
threshold.Value);
(events, decibelArray) = GetOnebinTracks(
spectrogram,
parameters,
segmentStartOffset,
decibelThreshold.Value);

spectralEvents.AddRange(events);
spectralEvents.AddRange(events);

var plot = Plot.PreparePlot(decibelArray, $"{profileName} (Whistles:{threshold.Value:F0}dB)", threshold.Value);
plots.Add(plot);
}
var plot = Plot.PreparePlot(decibelArray, $"{profileName} (Whistles:{decibelThreshold.Value:F0}dB)", decibelThreshold.Value);
plots.Add(plot);

return (spectralEvents, plots);
}
Expand Down

0 comments on commit 43ab9f9

Please sign in to comment.