-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Building more of code structure for content descirption
Issue #252 Writing methods to calculate and display acoustic content.
- Loading branch information
Showing
7 changed files
with
280 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/AudioAnalysisTools/ContentDescriptionTools/DescriptionResult.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace AudioAnalysisTools.ContentDescriptionTools | ||
{ | ||
/// <summary> | ||
/// This class holds the results of content description for a unit of recording, assumed to be one-minute. | ||
/// The results are held in a dictionary. | ||
/// </summary> | ||
public class DescriptionResult | ||
{ | ||
private readonly Dictionary<string, double> descriptionDictionary = new Dictionary<string, double>(); | ||
|
||
public DescriptionResult(int startTimeInMinutes) | ||
{ | ||
this.StartTimeInCurrentRecordingFile = TimeSpan.FromMinutes(startTimeInMinutes); | ||
} | ||
|
||
public TimeSpan StartTimeInCurrentRecordingFile { get; set; } | ||
|
||
public void AddDescription(KeyValuePair<string, double> kvp) => this.descriptionDictionary.Add(kvp.Key, kvp.Value); | ||
|
||
public Dictionary<string, double> GetDescriptionDictionary() => this.descriptionDictionary; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/AudioAnalysisTools/ContentDescriptionTools/RainContent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace AudioAnalysisTools.ContentDescriptionTools | ||
{ | ||
using TowseyLibrary; | ||
|
||
public static class RainContent | ||
{ | ||
public static KeyValuePair<string, double> GetStrongRainContent(Dictionary<string, double[]> oneMinuteOfIndices) | ||
{ | ||
const string name = "StrongRain1"; | ||
var rn = new RandomNumber((int)DateTime.Now.Ticks + 27); | ||
var score = rn.GetDouble(); | ||
return new KeyValuePair<string, double>(name, score); | ||
} | ||
|
||
public static KeyValuePair<string, double> GetLightRainContent(Dictionary<string, double[]> oneMinuteOfIndices) | ||
{ | ||
const string name = "LightRain1"; | ||
var rn = new RandomNumber(DateTime.Now.Millisecond + 9); | ||
var score = rn.GetDouble(); | ||
return new KeyValuePair<string, double>(name, score); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters