public virtual SpeechType GetFrameSpeechType(WAVSound frame) // , int channel, double lowPassCutoffFrequency, double lowPassRatioThreshold, // double energyThreshold, double silenceThreshold) { double zeroCrossingRate = frame.GetRelativeNumberOfZeroCrossings(channel); double averageEnergy = frame.GetAverageEnergy(channel); if (averageEnergy < silenceThreshold) { return(SpeechType.Silence); } else { WAVSound lowPassFilteredFrame = frame.Copy(); lowPassFilteredFrame.LowPassFilter(lowPassCutoffFrequency); double lowPassFilteredAverageEnergy = lowPassFilteredFrame.GetAverageEnergy(channel); double energyRatio = lowPassFilteredAverageEnergy / averageEnergy; if ((energyRatio > lowPassRatioThreshold) && (averageEnergy > energyThreshold) && (zeroCrossingRate < zeroCrossingRateThreshold)) { return(SpeechType.Voiced); } else if (zeroCrossingRate < zeroCrossingRateThreshold) { return(SpeechType.Voiced); } else { return(SpeechType.Unvoiced); } } }