def setUp(self):
        garbage.GarbageTrackerTest.setUp(self)

        self._leveller = leveller.Leveller('/tmp')
        # cheat and put values in here
        self._half_dB = common.rawToDecibel(0.5)
        self._quarter_dB = common.rawToDecibel(0.25)
        self._leveller.rmsdBs = [
            level.Level(
                sequence=[(level.SECOND, self._half_dB)],
                scale=level.SCALE_DECIBEL),
            level.Level(
                sequence=[(level.SECOND, self._quarter_dB)],
                scale=level.SCALE_DECIBEL),
        ]
Beispiel #2
0
 def setUp(self):
     # cheat and put values in here
     self._half_dB = common.rawToDecibel(0.5)
     self._quarter_dB = common.rawToDecibel(0.25)
Beispiel #3
0
 def testZero(self):
     self.assertEquals(common.rawToDecibel(0.0), -1000.0)
Beispiel #4
0
        if end is None:
            end = self.end()

        l = self.convert(SCALE_RAW)

        squaresum = 0.0
        for endtime, value in l:
            if endtime < start:
                continue
            if endtime > end:
                continue
            squaresum += value * value
            
        ret = math.sqrt(squaresum / len(l))
        if self._scale == SCALE_DECIBEL:
            ret = common.rawToDecibel(ret)
            
        return ret
         

    def trim(self, start=None, end=None):
        """
        Return a trimmed level with the given start and end, inclusive.

        @rtype: L{Level}
        """
        if start is None and end is None:
            return self

        if start is None:
            start = 0L