Skip to content

Commit

Permalink
Continue setting up Content description framework.
Browse files Browse the repository at this point in the history
Issue #252 Set up WindContent class to determine content of different kinds of wind sound. Set up a loop to cycle through the minutes of acoustic spectral indices.
  • Loading branch information
towsey committed Sep 6, 2019
1 parent 99a27ff commit 4847c10
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/AudioAnalysisTools/AudioAnalysisTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@
<Compile Include="BirdClefExperiment1.cs" />
<Compile Include="ChannelIntegrity.cs" />
<Compile Include="ContentDescriptionTools\ContentDescription.cs" />
<Compile Include="ContentDescriptionTools\WindContent.cs" />
<Compile Include="CrossCorrelation.cs" />
<Compile Include="DSP\Clipping.cs" />
<Compile Include="DSP\DSP_Filters.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,37 @@ public static double[] AnalyseMinutes(Dictionary<string, double[,]> dictionary)
{
int rowCount = dictionary[ContentDescription.IndexNames[0]].GetLength(0);
int freqBinCount = dictionary[ContentDescription.IndexNames[0]].GetLength(1);

// over all rows assuming one minute per row.
for (int i = 0; i < rowCount; i++)
{
var oneMinuteOfIndices = GetIndicesForOneMinute(dictionary, i);

// now send indices to various content searches
var windScores = WindContent.GetStrongWindContent(oneMinuteOfIndices);
}

var scores = new double[rowCount];
return scores;
}

public static Dictionary<string, double[]> GetIndicesForOneMinute(Dictionary<string, double[,]> allIndices, int rowId)
{
var opIndices = new Dictionary<string, double[]>();

var keys = allIndices.Keys;
foreach (string key in keys)
{
var success = allIndices.TryGetValue(key, out double[,] matrix);
if (success)
{
opIndices.Add(key, MatrixTools.GetRow(matrix, rowId));
}
}

return opIndices;
}

public static void DrawNormalisedIndexMatrices(DirectoryInfo dir, string baseName, Dictionary<string, double[,]> dictionary)
{
var list = new List<Image>();
Expand Down
21 changes: 21 additions & 0 deletions src/AudioAnalysisTools/ContentDescriptionTools/WindContent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AudioAnalysisTools.ContentDescriptionTools
{
using TowseyLibrary;

public static class WindContent
{

public static double GetStrongWindContent(Dictionary<string, double[]> oneMinuteOfIndices)
{
var rn = new RandomNumber();
var score = rn.GetDouble();
return score;
}
}
}

0 comments on commit 4847c10

Please sign in to comment.