def _play(self, note): if note.duration == float('inf'): self.infinite.append((self.frame, note)) else: end = self.frame + int(note.duration) bisect.insort(self.playing, (-end, self.frame, note))