// Generates the average (and variance) of the list of sound features, ASSUMING // that all sound features use the same time values public static SoundFeature GenerateAverage(List <SoundFeature> soundFeatureList) { SoundFeature averageSoundFeature = new SoundFeature(); if (soundFeatureList.Count > 0) { averageSoundFeature.Name = soundFeatureList[0].Name; int size = soundFeatureList[0].TimeList.Count; averageSoundFeature.SetSize(size); for (int jj = 0; jj < size; jj++) { averageSoundFeature.TimeList[jj] = soundFeatureList[0].TimeList[jj]; } for (int jj = 0; jj < size; jj++) { List <double> featureValueList = new List <double>(); for (int ii = 0; ii < soundFeatureList.Count; ii++) { featureValueList.Add(soundFeatureList[ii].ValueList[jj]); } double average = featureValueList.Average(); double variance = Variance.Compute(featureValueList); averageSoundFeature.ValueList[jj] = average; averageSoundFeature.VarianceList[jj] = variance; } } return(averageSoundFeature); }