LoginSignup
1
2

Python実行終了時に音で知らせたい!(Jupyter-Beeperの使い方)

Last updated at Posted at 2023-10-28

はじめに

Pythonで重い処理を実行して、実行が終わったら通知音が鳴るようにしたい時があると思います。

その方法を松尾研のLLM講座のSlackで知ったので、メモも兼ねてこの記事を作成しました。

方法

Jupyter-Beeperというライブラリを使います。

  1. インストール

    pip install Jupyter-Beeper
    

  2. 実行

    import juyter_beeper
    
    b = jupyter_beeper.Beeper()
    # (重い処理)
    b.beep(frequency=100, secs=1, blocking=True) # ここでブザー音が鳴る
    

    frequencyで音の周波数を, secsで音の長さを秒数で指定します。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2