Created
July 8, 2012 20:05
-
-
Save edwinhuertas/3072622 to your computer and use it in GitHub Desktop.
simple iSpeech with titanium
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
var win = Ti.UI.createWindow({ | |
backgroundColor: 'white', | |
layout:'vertical' | |
}); | |
var textField = Ti.UI.createTextField({ | |
borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED, | |
color: '#336699', | |
top: 10, | |
left: 10, | |
width: 250, | |
height: 60 | |
}); | |
var button = Titanium.UI.createButton({ | |
title: 'Speak', | |
top: 10, | |
width: 100, | |
height: 50 | |
}); | |
button.addEventListener('click',function(e){ | |
var voice = "http://api.ispeech.org/api/rest?apikey=#############&action=convert&voice=usenglishfemale&text="+textField.value; | |
var player = Ti.Media.createSound({ | |
url:voice | |
}); | |
player.play(); | |
}); | |
win.add(textField); | |
win.add(button); | |
win.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment