Created
December 13, 2009 01:59
-
-
Save devth/255206 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
require 'tempfile' | |
get '/audio' do | |
text = params['text'] | |
temp_file = Tempfile.new 'mp3' | |
# generate mp3 to temp file | |
system("echo \"#{text.to_s}\" | text2wave | /opt/local/bin/lame - - > #{temp_file.path}") | |
# output it | |
headers 'Content-Type' => 'audio/mp3' | |
send_file temp_file.path | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment