Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 840 Bytes

File metadata and controls

49 lines (33 loc) · 840 Bytes

ASR In Web

A simple automatic speech recognition library

Source

Before you start, you need to download the model and placed in the public directory.

Reference: preinstall.sh.

Using

async function start() {
  stream = await navigator.mediaDevices.getUserMedia({ audio: true });
  audio.srcObject = stream;

  console.log("support", ASR.isSupport());
  const asr = new ASR(stream.getAudioTracks()[0], {
    model: "sherpa-ncnn",
  });

  asr.on("message", (result, isEndpoint) => {
    console.log(result, isEndpoint);
  });
  asr.on("sentence", (result) => {
    console.log("sentence:", result);
  });

  // start monitor
  asr.start();
  // stop monitor
  asr.stop();
}

build

yarn

yarn build

dev

yarn

yarn dev

Any questions you can contact me at ltsg0317@outlook.com