语音转换

<script type="text/javascript">
var zhText = "你好";//需要转换的文字
zhText = encodeURI(zhText);
document.write("<audio autoplay=\"autoplay\">");
document.write("<source src=\"http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&spd=2&text="+ zhText +"\" type=\"audio/mpeg\">");
document.write("<embed height=\"0\" width=\"0\" src=\"http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&spd=2&text="+ zhText +"\">");
document.write("</audio>");
</script>

你可能感兴趣的:(语音转换)