Skip to content

Instantly share code, notes, and snippets.

@edwinhuertas
Created July 8, 2012 20:05
Show Gist options
  • Save edwinhuertas/3072622 to your computer and use it in GitHub Desktop.
Save edwinhuertas/3072622 to your computer and use it in GitHub Desktop.
simple iSpeech with titanium
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