Hacker News new | ask | show | jobs
by matgessel 1800 days ago
Some ideas for playing a notification sound in a script runtime:

Shell

  # system beep; also flashes the screen if you have that enabled in accessibility
  osascript -e 'beep'
  
  # play the sound file given by the file system the path
  afplay /System/Library/Sounds/Hero.aiff
AppleScript

  beep
  
  do shell script "afplay '/System/Library/Sounds/Hero.aiff'"
  
JXA + Cocoa API

  $.NSBeep()
  
  // search for and play a sound file; the lookup path is defined by macOS
  $.NSSound.soundNamed('Glass').play
1 comments

Also shell (edit: as noted elsewhere):

$ say "Your build is done."