Skip to content

Instantly share code, notes, and snippets.

@da3mon
Created February 4, 2015 00:24
Show Gist options
  • Save da3mon/692e0fe9760368180443 to your computer and use it in GitHub Desktop.
Save da3mon/692e0fe9760368180443 to your computer and use it in GitHub Desktop.
#!/bin/bash
volume=$(osascript -e "get output volume of (get volume settings)")
muted=$(osascript -e "get output muted of (get volume settings)")
if [[ $volume -lt 30 ]]; then
osascript -e "set volume output volume 30"
fi
afplay ~/snd/$1.mp3
osascript -e "set volume output volume $volume"
osascript -e "set volume output muted $muted"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment