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

@nextcas/voice

v1.0.2

Published

@nextcas/sdk的语音拓展

Downloads

9

Readme

注意:录音需要 Https,或者本地 localhost 才可以调用

手动录音

instance( token: string, actorId: string ): Record

token: 授权 token actorId: 智能体ID

start():Promise<void>

开始录音(需要页面交互触发)

stopToText(model?:Model):Promise<string>

model: 语言模型见最下方表格

demo

import { Record } from "@nextcas/voice";

const record = new Record(token.data, "641811add41a3f2f91247af5");

record.start().then(() => {
  recording = true;
});

record
  .stopToText(model?:Model)
  .then((text) => {
    console.log(text);
  })
  .finally(() => {
    recording = false;
  });

ASR 集成

instance( token: string, options: AsrOptions ): Asr

token: 授权 token

AsrOptions

AsrOptions{
  actorId: string;
  model?: Model;
}

actorId 智能体ID model: 语言模型见最下方表格

start():<void>

开启ASR(需要页面交互触发)

stop():void

关闭ASR

Events

| model | 语言 | event值| | :------------- | ---------------: |---------------: | | ready | 初始化完成 | _ | | sentenceBegin | 监测到新的句子开始 | _ | | sentenceChange | 识别中(可以查看识别过程中的句子变化) | string | | sentenceEnd | 当前句子识别结束 |string | | error | 错误 |error,string |

AsrOptions{
  actorId: string;
  model?: Model;
}
 Asr(token:string, options: AsrOptions)

demo

const record = new Asr(token, { actorId: "actor_100990" });

let recording = false;
let inited = false;
record.on("ready", () => {
  inited = true;
  // ready 后再开始识别
});
record.on("error", (err) => {
  console.log(err);
});
record.on("sentenceBegin", () => {
  console.log("一句话识别开始");
  speacking = true;
});

record.on("sentenceChange", (text: string) => {
  console.log("一句话识别中", text);
  sentenceRes = text;
});

record.on("sentenceEnd", (text: string) => {
  console.log("一句话识别结束", text);
  speacking = false;
});

function start() {
  if (inited) {
    record.start();
  }
}

function stop() {
  record.stop();
}

Model

| model | 语言 | | :------------- | ---------------: | | 中文通用 | '16k_zh' | | 中英粤 | '16k_zh-PY' | | 中文繁体(台湾) | '16k_zh-TW' | | 中文教育 | '16k_zh_edu' | | 中文医疗 | '16k_zh_medical' | | 中文法庭 | '16k_zh_court' | | 中文多地方言 | '16k_zh_dialect' | | 中文粤语 | '16k_yue' | | 英文通用 | '16k_en' | | 英文游戏 | '16k_en_game' | | 英文教育 | '16k_en_edu' | | 韩语 | '16k_ko' | | 日语 | '16k_ja' | | 泰语 | '16k_th' | | 印度尼西亚语 | '16k_id' | | 越南语 | '16k_vi' | | 马来语 | '16k_ms' | | 菲律宾语 | '16k_fil' | | 葡萄牙语 | '16k_pt' | | 土耳其语 | '16k_tr' | | 阿拉伯语 | '16k_ar' | | 西班牙语 | '16k_es' | | 印地语 | '16k_hi' |