Skip to content

Instantly share code, notes, and snippets.

@stefania11
Created August 14, 2015 02:00
Show Gist options
  • Save stefania11/f54d2e407931a3556ab4 to your computer and use it in GitHub Desktop.
Save stefania11/f54d2e407931a3556ab4 to your computer and use it in GitHub Desktop.
def say_with_music(text: 'Space is cool.',
music: MUSIC.sample,
voice: NONMUSICAL_VOICES.sample,
volume: 0.8)
cmd = "say -v #{voice} \"#{text}\""\
" & sleep 3 && afplay -v #{volume} #{music} &"
system(cmd)
end
def kill_say
cmd = "kill -15 $(ps aux | pgrep -l say | egrep -o '\\d+') &> /dev/null"
system(cmd)
end
def kill_afplay
cmd = "kill -15 $(ps aux | pgrep -l afplay | egrep -o '\\d+') &> /dev/null"
system(cmd)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment