Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Here's what I did to make sound come after a command:

  import os
  from random import seed
  from random import random
  seed(a=None)
  def rnd():
          return 200 + (random() * (2100 - 200))
  duration = 0.5
  freq = rnd()
  os.system('play -nq -t alsa synth {} sine {}'.format(duration, freq))
The only requirements are python and sox[0].

Used like this:

  mycommand && python3 sound.py
--

[0] - https://manpages.debian.org/jessie/sox/play.1.en.html



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: