public double getStdevPeriod (double tmin, double tmax, double minimumPeriod, double maximumPeriod, double maximumPeriodFactor){
        if (tmax <= tmin){tmin = this.xmin; tmax = this.xmax;}   /* Autowindowing. */
	
        Triple<Integer,Integer,Integer> tri = getWindowPoints (tmin, tmax);
        int numberOfPeriods = tri.first - 1;
        int imin = tri.second;
        int imax = tri.third;
        
	if (numberOfPeriods < 2) return Pitch.NUMundefined;
	
	double sum = 0.0;
	for (int i = imin; i < imax; i ++) {
		if (isPeriod (i, minimumPeriod, maximumPeriod, maximumPeriodFactor)) {
			sum += this.t [i + 1] - this.t [i];   /* This interval counts as a period. */
		} else {
			numberOfPeriods --;   /* This interval does not count as a period. */
		}
	}
        
	if (numberOfPeriods < 2) return Pitch.NUMundefined;
        
	double mean = sum / numberOfPeriods;
	
	double sum2 = 0.0;
	for (int i = imin; i < imax; i ++) {
		if (isPeriod (i, minimumPeriod, maximumPeriod, maximumPeriodFactor)) {
			double dperiod = this.t [i + 1] - this.t [i] - mean;
			sum2 += dperiod * dperiod;
		}
	}
	
	return Math.sqrt (sum2 / (numberOfPeriods - 1));
    }