News for hackers. Stuff that matters.
Re:Show HN: Jazz up your Python scripts with sound effects by Resinderate on Tuesday September 15, 2020 @04:18PM (#24486249)
Do this sometimes on mac, simply with:

  long_running_command && say "That's all folks"
Re:Show HN: Jazz up your Python scripts with sound effects by jedberg on Tuesday September 15, 2020 @04:30PM (#24486359)
My favorite cron of all time was:

    0 17 * * 1-5 say "You're gonna miss the train go now!!"
Which I put on my work computer. Since it came out of the speaker most of the time, not only did I not miss the train, but everyone else knew I had to go and respected that.
Re:Show HN: Jazz up your Python scripts with sound effects by computronus on Tuesday September 15, 2020 @05:34PM (#24486975)
The built-in `afplay` shell command works for mp3s and for the stock aiff sounds under /System/Library/Sounds.

I use this after my long-running Maven builds to play either a happy sound if the build succeeds or a sad (mocking) sound if it fails, based on the value of $?.

Re:Show HN: Jazz up your Python scripts with sound effects by lozf on Tuesday September 15, 2020 @09:21PM (#24488619)
Love the idea of checking the exit code! Seems I have some modifications to do.

On Linux there's usually `aplay` but you'll need play (sox) or mpv etc. to play lossy-compressed audio... a bunch of sounds can be found under /usr/share/sounds/ depending on what's installed.

`espeak-ng` doesn't have as good voices as `say`, but some `festival` ones come close, although these days I usually use Googles tts, and save the ones I use frequently.

Re:Show HN: Jazz up your Python scripts with sound effects by gknoy on Tuesday September 15, 2020 @04:37PM (#24486424)
I do the same thing with a shell alias called `SUCCESS`:

  alias SUCCESS='echo -e '\''\n\nSUCCESS'\'' 
    && bash -c '\''mpv ~/bin/kazoo-fanfare.mp3 &'\'' 
    || echo FAILED' # or play sad trombone sound
  # (some escaping might not survive ...)
    
It's an always too-loud and too-annoying "Tadaa!" style fanfare that is very clearly NOT my music, and I will very frequently use it in the context of `make test && SUCCESS` to monitor long-running test suites while I do other work.