Giter Site home page Giter Site logo

cordova-baidu-tts's Introduction

cordova-baidu-tts 百度离线语音合成(android)

缘起

一些cordova做的应用需要具有离线语音朗读能力

说明

不是专业做安卓开发,只是实现了js调用百度sdk,具体tts功能建议查看百度官方文档。

安装

1.远程
控制台命令

$ cordova plugin add https://github.com/xuehexi/cordova-baidu-tts.git

2.本地
下载源码后,控制台命令

$ cordova plugin add  /目录/cordova-baidu-tts

使用

1.初始化

var options_init={
                appId:"你在百度申请的id", 
                apiKey:"你的apiKey",
                secretKey:"你的secretKey",
                speed:"5", //朗读语速,取值范围[0, 9],数值越大,语速越快
                pitch:"5"  //音调,取值范围[0, 9],数值越大,音量越高
            	};
baidu_tts.init(options_init);

2.播放

var options = {txt:"新年好"};
baidu_tts.speak(
        function(ret){}, //success
        function(e){},   //error
        options);

3.停止

baidu_tts.stop();

其他

时间关系,只是完成基本功能,抛砖引玉,更多功能请自行完善。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.