(self)
Generator to read a half-pulse and yield its length.
Generator to read a half-pulse and yield its length.
Generator to read a half - pulse and yield its length .
def _gen_read_halfpulse(self):
        """Generator to read a half-pulse and yield its length."""
        length = 0
        frame = 1
        prezero = 1
        pos_in_frame = 0
        frame_buf = []
        while True:
            try:
                sample = frame_buf[pos_in_frame]
                pos_in_frame += 1
            except IndexError:
                frame_buf = self._fill_buffer()
                pos_in_frame = 0
                continue
            length += 1
            last, frame = frame, (sample > self.zero_threshold) + (sample >= -self.zero_threshold) - 1
            if last != frame and (last != 0 or frame == prezero):
                if frame == 0 and last != 0:
                    prezero = last
                self.wav_pos += length
                yield length
                length = 0
def _gen_read_halfpulse ( self ) : length = 0 frame = 1 prezero = 1 pos_in_frame = 0 frame_buf = [ ] while True : try : sample = frame_buf [ pos_in_frame ] pos_in_frame += 1 except IndexError : frame_buf = self . _fill_buffer ( ) pos_in_frame = 0 continue length += 1 last , frame = frame , ( sample > self . zero_threshold ) + ( sample >= - self . zero_threshold ) - 1 if last != frame and ( last != 0 or frame == prezero ) : if frame == 0 and last != 0 : prezero = last self . wav_pos += length yield length length = 0