Created
May 16, 2012 16:22
-
-
Save omniosi/2711835 to your computer and use it in GitHub Desktop.
target audio format and deliver correct format to HTML audio
This file contains hidden or 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 ispeech; | |
var message; | |
var canPlayOgg = !!(new Audio().canPlayType('audio/ogg; codecs="vorbis"')); | |
if(canPlayOgg == true){ | |
ispeech = "http://api.ispeech.org/api/rest?apikey=developerdemokeydeveloperdemokey&action=convert&voice=usenglishmale&format=ogg&text="; | |
} else{ | |
ispeech = "http://api.ispeech.org/api/rest?apikey=developerdemokeydeveloperdemokey&action=convert&voice=usenglishmale&text="; | |
} | |
$("#submit").click(function(){ | |
message = $("#text").val(); | |
$("audio").attr({ | |
"autoplay": "autoplay", | |
"src": ( ispeech + message ) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is from a online app that spoke the text from a text field.