def enforce_duration(self, duration_thresh):
        """
        This method takes a quantized pitch contour and filters out
        those time sections where the contour is not long enough, as specified
        by duration threshold (given in milliseconds).

        All transactions assume data in cent scale.
        """
        i = 1
        while i < len(self.pitch)-1:
            if self.pitch[i] == -10000:
                i += 1
                continue
            if self.pitch[i]-self.pitch[i-1] != 0 and self.pitch[i+1]-self.pitch[i] == 0:
                start = i
                while i < len(self.pitch) and self.pitch[i+1]-self.pitch[i] == 0:
                    i += 1
                if (self.timestamps[i]-self.timestamps[start])*1000 < duration_thresh:
                    self.pitch[start:i+1] = np.zeros(i+1-start)-10000
            else:
                self.pitch[i] = -10000
                i += 1
def enforce_duration ( self , duration_thresh ) : i = 1 while i < len ( self . pitch ) - 1 : if self . pitch [ i ] == - 10000 : i += 1 continue if self . pitch [ i ] - self . pitch [ i - 1 ] != 0 and self . pitch [ i + 1 ] - self . pitch [ i ] == 0 : start = i while i < len ( self . pitch ) and self . pitch [ i + 1 ] - self . pitch [ i ] == 0 : i += 1 if ( self . timestamps [ i ] - self . timestamps [ start ] ) * 1000 < duration_thresh : self . pitch [ start : i + 1 ] = np . zeros ( i + 1 - start ) - 10000 else : self . pitch [ i ] = - 10000 i += 1
This method takes a quantized pitch contour and filters out
        those time sections where the contour is not long enough, as specified
        by duration threshold (given in milliseconds).

        All transactions assume data in cent scale.