npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

satd-tts

v1.1.6

Published

科大讯飞离线语音合成,node-gyp扩展成nodejs模块

Downloads

8

Readme

satd-text-to-speech-module

介绍

科大讯飞离线语音合成新版轻量级
通过node-addon-api封装C++,
通过配置node-gyp将C++文件封装成nodejs模块

软件架构

  • binding.gyp node-gyp 构建配置
  • SoundPlayer.h 语音合成头文件
  • SoundPlayer.cpp 语音合成函数定义
  • tts.cpp 基于node-addon-api将c++扩展成nodejs可用模块代码
  • demo.js nodejs调用模块示例代码

安装教程

  1. 从科大讯飞下载对应离线设备的sdk(新版轻量级)
  2. 新建nodejs项目,将sdk中的aisound,include,libs目录复制到项目根目录下,或者新建一个单独的目录
  3. 将项目下五个文件复制到项目根目录,或指定目录
  4. 修改SoundPlayer.cpp中的initaikit方法,将app ID,apikey,apisecret替换成你自己的
  5. 安装库node-gyp,node-addon-api
  6. 播放音频需要安装lsdl2库,Ubuntu系统执行sudo apt-get install libsdl2-dev
  7. 编译C++模块需要安装python2.7以上版本,C++编译器,安装完后,执行命令node-gyp configure build,构建模块,模块路径位于新生成的build目录,build/Release/tts.node
  8. 需要配置环境变量 export LD_LIBRARY_PATH=./libs:$LD_LIBRARY_PATH,
  9. 在bin目录下新建js文件,示例代码可见demo.js(js文件同级目录下必须有aisound目录下的resource文件夹,里面有语音资源,不然会报错)

待完善

  1. 语音接口目前不能并发调用,同时调用多次语音播报,如果当前的语音播报未完成,后续的语音播报会失败,问题待解决,目前解决方案:如果再次调用语音播报,会结束前一次的语音播报
  2. 目前指定的默认音频设备,是否需要参数指定设备