Skip to content

Instantly share code, notes, and snippets.

@bradbatt
Created June 9, 2015 19:22
Show Gist options
  • Save bradbatt/041ecbcf78f2b4a89d38 to your computer and use it in GitHub Desktop.
Save bradbatt/041ecbcf78f2b4a89d38 to your computer and use it in GitHub Desktop.
Universal Play / Pause script for afplay
#!/bin/zsh
afplay_status=$(ps -clx | grep 'afplay' | awk '{print $11}')
if [[ $afplay_status == T ]] then
killall -CONT -c "afplay"
else
killall -STOP -c "afplay"
fi
@TheChuChuTrain
Copy link

This doesn't actually pause afplay :/ it effectively just mutes it. I think afplay takes note of the time it is started and picks position to fill the audio buffer based on the time since start (probably in case a frame is missed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment