Example #1
0
    def analyze(self):
        """
        Example output:

          394Hz (   28 Samples) exist:    1
          613Hz (   18 Samples) exist:    1
          788Hz (   14 Samples) exist:    1
          919Hz (   12 Samples) exist:  329 *********
         1002Hz (   11 Samples) exist: 1704 **********************************************
         1103Hz (   10 Samples) exist: 1256 **********************************
         1225Hz (    9 Samples) exist: 1743 ***********************************************
         1378Hz (    8 Samples) exist:    1
         1575Hz (    7 Samples) exist:  322 *********
         1838Hz (    6 Samples) exist: 1851 **************************************************
         2205Hz (    5 Samples) exist: 1397 **************************************
         2756Hz (    4 Samples) exist:  913 *************************
        """
        log.debug("enable half sinus scan")
        self.half_sinus = True
        statistics = self._get_statistics()

        width = 50
        max_count = max(statistics.values())

        print
        print "Found this zeror crossing timings in the wave file:"
        print

        for duration, count in sorted(statistics.items(), reverse=True):
            hz = duration2hz(duration, self.framerate / 2)
            w = int(round(float(width) / max_count * count))
            stars = "*" * w
            print "%5sHz (%5s Samples) exist: %4s %s" % (hz, duration, count,
                                                         stars)

        print
        print "Notes:"
        print " - Hz values are converted to full sinus cycle duration."
        print " - Sample cound is from half sinus cycle."
Example #2
0
    def analyze(self):
        """
        Example output:

          394Hz (   28 Samples) exist:    1
          613Hz (   18 Samples) exist:    1
          788Hz (   14 Samples) exist:    1
          919Hz (   12 Samples) exist:  329 *********
         1002Hz (   11 Samples) exist: 1704 **********************************************
         1103Hz (   10 Samples) exist: 1256 **********************************
         1225Hz (    9 Samples) exist: 1743 ***********************************************
         1378Hz (    8 Samples) exist:    1
         1575Hz (    7 Samples) exist:  322 *********
         1838Hz (    6 Samples) exist: 1851 **************************************************
         2205Hz (    5 Samples) exist: 1397 **************************************
         2756Hz (    4 Samples) exist:  913 *************************
        """
        log.debug("enable half sinus scan")
        self.half_sinus = True
        statistics = self._get_statistics()

        width = 50
        max_count = max(statistics.values())

        print
        print "Found this zeror crossing timings in the wave file:"
        print

        for duration, count in sorted(statistics.items(), reverse=True):
            hz = duration2hz(duration, self.framerate / 2)
            w = int(round(float(width) / max_count * count))
            stars = "*"*w
            print "%5sHz (%5s Samples) exist: %4s %s" % (hz, duration, count, stars)

        print
        print "Notes:"
        print " - Hz values are converted to full sinus cycle duration."
        print " - Sample cound is from half sinus cycle."
Example #3
0
 def _duration2hz(self, duration):
     return duration2hz(duration, framerate=self.framerate)
Example #4
0
 def _duration2hz(self, duration):
     return duration2hz(duration, framerate=self.framerate)