Class Oscillations2010
Inherited Members
Namespace: AudioAnalysisTools
Assembly: AudioAnalysisTools.dll
Syntax
public static class Oscillations2010
Methods
| Improve this Doc View SourceConvertODScores2Events(Double[], Double[], Int32, Int32, Double, Double, Int32, Double, Double, Double, String, TimeSpan)
Converts the Oscillation Detector score array to a list of AcousticEvents. NOTE: Method assumes passed score array was normalised. See the CousticEvent class for a generic version of this method.
Declaration
public static List<AcousticEvent> ConvertODScores2Events(double[] scores, double[] oscFreq, int minHz, int maxHz, double framesPerSec, double freqBinWidth, int freqBinCount, double scoreThreshold, double minDuration, double maxDuration, string fileName, TimeSpan segmentStartOffset)
Parameters
Type | Name | Description |
---|---|---|
Double[] | scores | the array of OD scores. |
Double[] | oscFreq | |
Int32 | minHz | lower freq bound of the acoustic event. |
Int32 | maxHz | upper freq bound of the acoustic event. |
Double | framesPerSec | the time scale required by AcousticEvent class. |
Double | freqBinWidth | the freq scale required by AcousticEvent class. |
Int32 | freqBinCount | |
Double | scoreThreshold | OD score must exceed this threshold to count as an event. |
Double | minDuration | duration of event must exceed this to count as an event. |
Double | maxDuration | duration of event must be less than this to count as an event. |
String | fileName | name of source file to be added to AcousticEvent class. |
TimeSpan | segmentStartOffset |
Returns
Type | Description |
---|---|
List<AcousticEvent> |
DetectOscillationsInScoreArray(Double[], Double, Double, Double, Boolean, Int32, Int32)
Declaration
public static double[] DetectOscillationsInScoreArray(double[] scoreArray, double dctDuration, double timeScale, double dctThreshold, bool normaliseDCT, int minOscilFreq, int maxOscilFreq)
Parameters
Type | Name | Description |
---|---|---|
Double[] | scoreArray | |
Double | dctDuration | |
Double | timeScale | |
Double | dctThreshold | |
Boolean | normaliseDCT | |
Int32 | minOscilFreq | |
Int32 | maxOscilFreq |
Returns
Type | Description |
---|---|
Double[] |
DetectOscillationsInSonogram(SpectrogramStandard, Int32, Int32, Double, Double, Boolean, Double, Double, List<AcousticEvent>)
Detects oscillations in a given freq bin. there are several important parameters for tuning. a) dctDuration: Good values are 0.25 to 0.50 sec. Do not want too long because DCT requires stationarity. Do not want too short because too small a range of oscillations b) dctThreshold: minimum acceptable value of a DCT coefficient if hit is to be accepted. The algorithm is sensitive to this value. A lower value results in more oscillation hits being returned. c) Min and Max Oscillaitons: Sets lower & upper bound for oscillations of interest. Array has same length as the length of the DCT. Low freq oscillations occur more often by chance. Want to exclude them.
Declaration
public static double[, ] DetectOscillationsInSonogram(SpectrogramStandard sonogram, int minHz, int maxHz, double dctDuration, double dctThreshold, bool normaliseDCT, double minOscilFreq, double maxOscilFreq, List<AcousticEvent> events)
Parameters
Type | Name | Description |
---|---|---|
SpectrogramStandard | sonogram | |
Int32 | minHz | min freq bin of search band. |
Int32 | maxHz | max freq bin of search band. |
Double | dctDuration | |
Double | dctThreshold | |
Boolean | normaliseDCT | |
Double | minOscilFreq | |
Double | maxOscilFreq | |
List<AcousticEvent> | events |
Returns
Type | Description |
---|---|
Double[,] |
DetectOscillationsInSonogram(SpectrogramStandard, Int32, Int32, Double, Double, Boolean, Int32, Int32, List<AcousticEvent>)
Calls the above method but converts integer oscillations rate to doubles.
Declaration
public static double[, ] DetectOscillationsInSonogram(SpectrogramStandard sonogram, int minHz, int maxHz, double dctDuration, double dctThreshold, bool normaliseDCT, int minOscilFreq, int maxOscilFreq, List<AcousticEvent> events)
Parameters
Type | Name | Description |
---|---|---|
SpectrogramStandard | sonogram | |
Int32 | minHz | |
Int32 | maxHz | |
Double | dctDuration | |
Double | dctThreshold | |
Boolean | normaliseDCT | |
Int32 | minOscilFreq | |
Int32 | maxOscilFreq | |
List<AcousticEvent> | events |
Returns
Type | Description |
---|---|
Double[,] |
Execute(SpectrogramStandard, Boolean, Int32, Int32, Double, Double, Boolean, Int32, Int32, Double, Double, Double, out Double[], out List<AcousticEvent>, out Double[,], out Double[], out TimeSpan)
FINDS OSCILLATIONS IN A SONOGRAM But first it segments the sonogram based on acoustic energy in freq band of interest.
Declaration
public static void Execute(SpectrogramStandard sonogram, bool doSegmentation, int minHz, int maxHz, double dctDuration, double dctThreshold, bool normaliseDCT, int minOscilFreq, int maxOscilFreq, double scoreThreshold, double minDuration, double maxDuration, out double[] scores, out List<AcousticEvent> events, out double[, ] hits, out double[] intensity, out TimeSpan totalTime)
Parameters
Type | Name | Description |
---|---|---|
SpectrogramStandard | sonogram | sonogram derived from the recording. |
Boolean | doSegmentation | |
Int32 | minHz | min bound freq band to search. |
Int32 | maxHz | max bound freq band to search. |
Double | dctDuration | duration of DCT in seconds. |
Double | dctThreshold | minimum amplitude of DCT. |
Boolean | normaliseDCT | |
Int32 | minOscilFreq | ignore oscillation frequencies below this threshold. |
Int32 | maxOscilFreq | ignore oscillation frequencies greater than this. |
Double | scoreThreshold | used for FP/FN. |
Double | minDuration | ignore hits whose duration is shorter than this. |
Double | maxDuration | ignore hits whose duration is longer than this. |
Double[] | scores | return an array of scores over the entire recording. |
List<AcousticEvent> | events | return a list of acoustic events. |
Double[,] | hits | a matrix that show where there is an oscillation of sufficient amplitude in the correct range. Values in the matrix are the oscillation rate. i.e. if OR = 2.0 = 2 oscillations per second. |
Double[] | intensity | |
TimeSpan | totalTime |
FillScoreArray(Double[], Double, Double)
fills the gaps in an array of scores.
Declaration
public static double[] FillScoreArray(double[] oscillations, double fillDuration, double timeScale)
Parameters
Type | Name | Description |
---|---|---|
Double[] | oscillations | |
Double | fillDuration | duration in seconds. |
Double | timeScale | frames per Second. |
Returns
Type | Description |
---|---|
Double[] |
GetOscillationFrequency(Double[,], Int32, Int32, Double)
for each frame, returns the average oscilation rate for those freq bins that register a hit.
Declaration
public static double[] GetOscillationFrequency(double[, ] hits, int minHz, int maxHz, double freqBinWidth)
Parameters
Type | Name | Description |
---|---|---|
Double[,] | hits | |
Int32 | minHz | |
Int32 | maxHz | |
Double | freqBinWidth |
Returns
Type | Description |
---|---|
Double[] |
GetOscillationScores(Double[,], Int32, Int32, Double)
Converts the hits in the "hit matrix" derived from the oscilation detector into a score for each frame. Score is normalised - the fraction of bins in the correct frequncy band that have an oscilation hit.
Declaration
public static double[] GetOscillationScores(double[, ] hits, int minHz, int maxHz, double freqBinWidth)
Parameters
Type | Name | Description |
---|---|---|
Double[,] | hits | sonogram as matrix showing location of oscillation hits. |
Int32 | minHz | lower freq bound of the acoustic event. |
Int32 | maxHz | upper freq bound of the acoustic event. |
Double | freqBinWidth | the freq scale required by AcousticEvent class. |
Returns
Type | Description |
---|---|
Double[] |
PeriodicityAnalysis(Double[])
returns the periodicity in an array of values.
Declaration
public static double[] PeriodicityAnalysis(double[] array)
Parameters
Type | Name | Description |
---|---|---|
Double[] | array |
Returns
Type | Description |
---|---|
Double[] |
RemoveIsolatedOscillations(Double[,])
Removes single lines of hits from Oscillation matrix.
Declaration
public static double[, ] RemoveIsolatedOscillations(double[, ] matrix)
Parameters
Type | Name | Description |
---|---|---|
Double[,] | matrix | the Oscillation matrix. |
Returns
Type | Description |
---|---|
Double[,] |