Exemplo n.º 1
0
def __sound_notification_success(*args):
    HZ = 540
    sound = Triangle(HZ).to_audio_segment(
        duration=100).apply_gain(-20).fade_in(20).fade_out(20)
    sound += AudioSegment.silent(duration=100)
    sound += Triangle(HZ).to_audio_segment(
        duration=100).apply_gain(-20).fade_in(20).fade_out(20)
    display(InvisibleAudio(data=sound.export().read(), autoplay=True))
Exemplo n.º 2
0
    def display(self, *args, **kwargs):
        progress_rate = self.n / self.total
        pan = max(min(-1.0 + progress_rate * 2, 1.0), -1.0)

        sound = Triangle(523.23 + progress_rate*523.27).to_audio_segment(duration=100)\
            .apply_gain(-10)\
            .fade_in(20)\
            .fade_out(20)\
            .pan(pan)

        display(InvisibleAudio(data=sound.export().read(), autoplay=True))

        super(tqdm, self).display(*args, **kwargs)