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 🙏

© 2024 – Pkg Stats / Ryan Hefner

xfyun-nls

v0.2.4

Published

a xfyun nls node module.

Downloads

46

Readme

XFYun NLS

js-standard-style action license NPM version npm download

讯飞云智能语音处理 Node 模块。

目录

开始

from npm

$ npm install xfyun-nls

在线语音合成

用例

const { XFYunTTS } = require('xfyun-nls');
const path = require('path');
const fs = require('fs');

!(async () => {
  const cachePath = path.join(process.cwd(), new Date().getTime().toString());
  fs.mkdirSync(cachePath);

  const _xfyTTS = new XFYunTTS(
    {
      appId: '5e3b7ffe',
      apiSecret: '8440c6f3dc6e3b864a043dbb6c37afd0',
      apiKey: '1394021f9ef53a9a9400b4d8a5f4652a',
      host: 'tts-api.xfyun.cn',
      uri: '/v2/tts',
      hostUrl: 'wss://tts-api.xfyun.cn/v2/tts'
    } /** XFYunTTS.Config **/,
    cachePath /** catchPath (optional) **/
  );

  // send
  console.log('TTS COMPLETE:', JSON.stringify(await _xfyTTS.send('你好')));
  // more ...
})();

了解更多 TTS Define.

函数

XFYunTTS 有如下方法:

checkConfig(): Promise<boolean>

返回值 Promise<boolean> - 返回讯飞云语音配置密钥是否有效。

const checkRlt = await _XFYunTTS.checkConfig();
console.log(checkRlt ? 'the config is passed' : 'error config');

send(text: string, options?: XFYunTTS.BusinessOption): Promise<XFYunTTS.TTSComplete>

  • text string - 要转换的文本。
  • options XFYunTTS.BusinessOption (optional) - 合成设置。

返回值 Promise<XFYunTTS.TTSComplete> - 转换完成对象。

定义

XFYunTTS.BusinessOption

合成语言的业务参数,有如下参数:

  • tte string - 文本编码格式。
  • aux string - 音频编码。
  • vcn string - 发音人。

更多请看定义 BusinessOption

官方文档参考

XFYunTTS.TTSComplete

合成结果对象,有如下属性:

  • filePath string - 音频文件最终保存路径。
  • suffix string - 文件后缀。
  • rootPath string - 所在父文件夹路径。
  • text string - 合成的原文本。
  • options XFYunTTS.BusinessOption - 合成的高级选项。
  • startTime number - 合成任务开始的时间戳(毫秒)。
  • elapsed number - 合成所耗费的时间(毫秒)。

更多请看定义 TTSComplete

Author

| twitter/funnyzak | | ------------------------------------------------------------------------------------------------------------------------------------------------------ | | funnyzak |

参考

License

Apache-2.0 License © 2021 funnyzak