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

dby-ai-speech-node-sdk

v1.0.21

Published

1. 需要使用 32 位的 node,版本尽量保证和 Electron 内置的 node 版本一致,防止原生模块无法编译。 Electron 和 node 版本号的对应关系可以在这里查 https://www.npmjs.com/package/electron-releases 、 https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json 、 https://nodejs.org/zh-cn/download/rel

Downloads

5

Readme

开发环境配置

  1. 需要使用 32 位的 node,版本尽量保证和 Electron 内置的 node 版本一致,防止原生模块无法编译。 Electron 和 node 版本号的对应关系可以在这里查 https://www.npmjs.com/package/electron-releases 、 https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json 、 https://nodejs.org/zh-cn/download/releases

  2. 需要配置 node-gyp 编译环境,推荐使用 https://www.npmjs.com/package/windows-build-tools


使用方法:

处理 DLL 文件

下载 dll 文件压缩包

下载地址: https://paas-electron-sdk.duobeiyun.com/sdk/win/dby-ai-speech-sdk/dlls-202010281450.zip

把 dll 文件放到指定目录下

把 dllS.zip 解压缩并把解压出来的 dll 文件放置到项目里的某个文件夹内


代码示例

const SDK = require('dby-ai-speech-node-sdk')

const sdk = new SDK(#dllFileDirPath) // #dllFileDirPath 的值为上一步的 dll 所在文件夹的绝对路径

// 初始化 sdk
sdk.init(#dbyAppId, #dbyAppKey, #aiSpeechAppId, #aiSpeechAppKey).then(async () => {

  // 高级功能,提供控制拉流和语音识别的开关
  await sdk.enableRemoteStream(true) // 开启拉流功能
  await sdk.enableAiSpeech(true) // 开启语音识别功能

  // 加入频道
  sdk.joinChannel(#channelId, #uid).then(() => {
    console.log('join channel success!')

    // 处理语音识别结果
    sdk.onUserText((uid, text) => {
      console.log('on user text ', uid, text)
    })
  }).catch((e) => {
    console.log('join channel fail! ', e.message)
  })
})

SDK 接口说明

constructor
概述

SDK 构造函数

参数

|参数 | 说明| | ---| --- | | dllFileDirPath | dll 文件所在文件夹的绝对路径。比如 path.resolve('../../dllfiles') |

返回

SDK 实例

init
sdk.init(#dbyAppId, #dbyAppKey, #aiSpeechAppId, #aiSpeechAppKey)
概述

初始化 SDK 实例,填入需要的账号信息

参数

|参数 | 说明| | ---| --- | | dbyAppId | 多贝云 AppId | | dbyAppKey | 多贝云 AppKey | | aiSpeechAppId | AISpeech AppId | | aiSpeechAppKey | AISpeech AppKey |

返回

Promise<void>

enableRemoteStream
sdk.enableRemoteStream(true/false)
概述

sdk功能开关,用来控制sdk是否拉取远端音频流。一般情况下不需要调用该接口

参数

|参数 | 说明| | ---| --- | | enable | 是否拉取远端的音频流,默认值为true |

返回

Promise<void>

enableAiSpeech
sdk.enableAiSpeech(true/false)
概述

sdk功能开关,用来控制sdk是否开启语音识别功能。sdk默认不开启语音识别功能,一般情况下需要调用该接口开启

参数

|参数 | 说明| | ---| --- | | enable | 是否拉取远端的音频流,默认值为false |

返回

Promise<void>

joinChannel
sdk.joinChannel(#channelId, #uid)
概述

加入某个频道

参数

|参数 | 说明| | ---| --- | | channelId | 需要加入的频道 ID | | uid | 用户的 id |

返回

Promise<void>

leaveChannel

sdk.leaveChannel()
概述

离开某个频道

参数

返回

Promise<void>

destroy

sdk.destroy()
概述

销毁 SDK 实例,如果已经加入了频道,需要在 leaveChannel 调用成功之后再调用 destroy

参数

返回

Promise<void>

onUserText

sdk.onUserText((uid, text) => {
  console.log('sdk.onUserText ', uid, text)
})
概述

注册语音识别结果的回调

参数

|参数 | 说明| | ---| --- | | cb | 语音识别结果的回调函数,它有两个参数,第一个是用户 id,第二个是该用户的语音识别出的文字 |

返回

undefined