Skip to content

Instantly share code, notes, and snippets.

@adamhunter
Last active December 23, 2015 11:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamhunter/6632543 to your computer and use it in GitHub Desktop.
Save adamhunter/6632543 to your computer and use it in GitHub Desktop.
using say in ruby
# after pasting the class in speaker.rb into irb, run the following,
# edit to your liking...
@speaker = Speaker.new
# other voices can be found at
# http://www.gabrielserafini.com/blog/2008/08/19/mac-os-x-voices-for-using-with-the-say-command/
@speaker.voice = 'Kathy'
@speaker.what = %[what should i say here?]
@speaker.speak
# in terminal (mac only), run irb, then paste below
class Speaker
attr_accessor :what, :voice
def speak
%x[say -v #{voice} #{what}]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment