Skip to content

Commit

Permalink
Reworking the oscillation detection component of Flying Foxrecognizer
Browse files Browse the repository at this point in the history
Issue #238 Flying fox
  • Loading branch information
towsey committed Oct 26, 2019
1 parent e807743 commit a0e643b
Show file tree
Hide file tree
Showing 6 changed files with 289 additions and 230 deletions.
4 changes: 2 additions & 2 deletions src/AnalysisPrograms/Recognizers/LitoriaCaerulea.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="LitoriaCaerulea.cs" company="QutEcoacoustics">
// All code in this file and all associated files are the copyright and property of the QUT Ecoacoustics Research Group (formerly MQUTeR, and formerly QUT Bioacoustics Research Group).
// </copyright>
Expand Down Expand Up @@ -193,7 +193,7 @@ public override RecognizerResults Recognize(AudioRecording recording, Config con
double dctThreshold = recognizerConfig.DctThreshold;
double minOscRate = 1 / recognizerConfig.MaxPeriod;
double maxOscRate = 1 / recognizerConfig.MinPeriod;
var dctScores = Oscillations2012.DetectOscillations(croakScoreArray, framesPerSecond, dctDuration, minOscRate, maxOscRate, dctThreshold);
Oscillations2019.DetectOscillations(croakScoreArray, framesPerSecond, dctDuration, minOscRate, maxOscRate, dctThreshold, out double[] dctScores, out double[] oscFreq);

// ######################################################################
// ii: DO THE ANALYSIS AND RECOVER SCORES OR WHATEVER
Expand Down
15 changes: 9 additions & 6 deletions src/AnalysisPrograms/Recognizers/PteropusSpecies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private static RecognizerResults TerritorialCall(AudioRecording audioRecording,
};
sonoConfig.WindowOverlap = 0.0;
// now construct the standard decibel spectrogram WITH noise removal, and look for LimConvex
// now construct the standard decibel spectrogram WITH noise removal
// get frame parameters for the analysis
var sonogram = (BaseSonogram)new SpectrogramStandard(sonoConfig, audioRecording.WavReader);
*/
Expand Down Expand Up @@ -349,7 +349,9 @@ private static RecognizerResults WingBeats(AudioRecording audioRecording, Config
var decibelArray = SNR.CalculateFreqBandAvIntensity(sonogram.Data, minHz, maxHz, sonogram.NyquistFrequency);

// Look for wing beats using oscillation detector
Oscillations2012.Execute(
int scoreSmoothingWindow = 11; // sets a default that was good for Cane toad
//Oscillations2012.Execute(
Oscillations2019.Execute(
(SpectrogramStandard)sonogram,
minHz,
maxHz,
Expand All @@ -360,9 +362,10 @@ private static RecognizerResults WingBeats(AudioRecording audioRecording, Config
eventThreshold,
minDurationSeconds,
maxDurationSeconds,
scoreSmoothingWindow,
out var scores,
out var acousticEvents,
out var hits,
//out var hits,
segmentStartOffset);

/*
Expand Down Expand Up @@ -397,8 +400,8 @@ private static RecognizerResults WingBeats(AudioRecording audioRecording, Config
double intensityNormalisationMax = 3 * decibelThreshold;
var normThreshold = decibelThreshold / intensityNormalisationMax;
var normalisedIntensityArray = DataTools.NormaliseInZeroOne(decibelArray, 0, intensityNormalisationMax);
var plot1 = new Plot(speciesName + " Wingbeat band", normalisedIntensityArray, normThreshold);
var plot2 = new Plot(speciesName + " Wingbeat Osc Score", scores, eventThreshold);
var plot1 = new Plot(speciesName + " Wing-beat band", normalisedIntensityArray, normThreshold);
var plot2 = new Plot(speciesName + " Wing-beat Osc Score", scores, eventThreshold);
var plots = new List<Plot> { plot1, plot2 };

// ######################################################################
Expand Down Expand Up @@ -462,7 +465,7 @@ internal static BaseSonogram GetSonogram(Config configuration, AudioRecording au
WindowOverlap = 0.0,
};

// now construct the standard decibel spectrogram WITH noise removal, and look for LimConvex
// now construct the standard decibel spectrogram WITH noise removal
// get frame parameters for the analysis
var sonogram = (BaseSonogram)new SpectrogramStandard(sonoConfig, audioRecording.WavReader);
return sonogram;
Expand Down
4 changes: 2 additions & 2 deletions src/AnalysisPrograms/Sandpit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ public static void Audio2CsvOverOneFile()

// FLYING FOX RECORDINGS
//string recordingPath = @"C:\Ecoacoustics\WavFiles\BradLawData\FlyingFox\20190127_Bellingen_Feeding_SM4.wav";
//string recordingPath = @"C:\Ecoacoustics\WavFiles\FlyingFox\20190115_Bellingen_Feeding.wav";
string recordingPath = @"C:\Ecoacoustics\WavFiles\FlyingFox\20190115_Bellingen_Feeding.wav";
//string recordingPath = @"C:\Ecoacoustics\WavFiles\FlyingFox\20190115_Bellingen_Feeding_minute6.wav";
string recordingPath = @"C:\Ecoacoustics\WavFiles\FlyingFox\20190115_Bellingen_Feeding_minute6_OneChannel22050.wav";
//string recordingPath = @"C:\Ecoacoustics\WavFiles\FlyingFox\20190115_Bellingen_Feeding_minute6_OneChannel22050.wav";
//string recordingPath = @"C:\Ecoacoustics\WavFiles\FlyingFox\20190121_2_Bellingen_Feeding.wav";
//string recordingPath = @"C:\Ecoacoustics\WavFiles\FlyingFox\20190127_Bellingen_Feeding_SM4.wav";
string configPath = @"C:\Work\GitHub\audio-analysis\src\AnalysisConfigFiles\RecognizerConfigFiles\Towsey.PteropusSpecies.yml";
Expand Down
1 change: 1 addition & 0 deletions src/AudioAnalysisTools/AudioAnalysisTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@
<Compile Include="AnalysisKeys.cs" />
<Compile Include="LongDurationSpectrograms\Zooming\ZoomFocusedSpectrograms.cs" />
<Compile Include="Oscillations2014.cs" />
<Compile Include="Oscillations2019.cs" />
<Compile Include="RidgeDetection.cs" />
<Compile Include="SiteDescription.cs" />
<Compile Include="StandardSpectrograms\AmplitudeSpectrogram.cs" />
Expand Down
Loading

0 comments on commit a0e643b

Please sign in to comment.