Skip to content

Instantly share code, notes, and snippets.

@barek2k2
Created October 26, 2016 14:16
Show Gist options
  • Save barek2k2/51c8cc5cce488d7d83420e7ab86ffd0d to your computer and use it in GitHub Desktop.
Save barek2k2/51c8cc5cce488d7d83420e7ab86ffd0d to your computer and use it in GitHub Desktop.
text=File.open('song.txt').read # reads the lyrics from song.txt file
text.gsub!(/\n\n\n/, "$") # detecting song gap time after a para
text.each_line do |line|
ch = line.split("")
ch.collect{|c| c == '$' ? (sleep(2);print("\n\n")) : (sleep(0.08);print(c))} # prints each character and delay between para or character
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment