https://github.com/ccoreilly/vosk-browser

A speech recognition library running in the browser thanks to a WebAssembly build of Vosk

https://github.com/ccoreilly/vosk-browser

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.1%) to scientific vocabulary

Keywords

asr kaldi speech-recognition speech-to-text stt typescript vosk wasm webassembly
Last synced: 5 months ago · JSON representation

Repository

A speech recognition library running in the browser thanks to a WebAssembly build of Vosk

Basic Info
  • Host: GitHub
  • Owner: ccoreilly
  • License: apache-2.0
  • Language: JavaScript
  • Default Branch: master
  • Homepage:
  • Size: 707 MB
Statistics
  • Stars: 474
  • Watchers: 18
  • Forks: 76
  • Open Issues: 31
  • Releases: 0
Topics
asr kaldi speech-recognition speech-to-text stt typescript vosk wasm webassembly
Created about 5 years ago · Last pushed about 2 years ago
Metadata Files
Readme License

README.md

Vosk-Browser

A somewhat opinionated speech recognition library for the browser using a WebAssembly build of Vosk

This library picks up the work done by Denis Treskunov and packages an updated Vosk WebAssembly build as an easy-to-use browser library.

Note: WebAssembly builds can target NodeJS, the browser's main thread or web workers. This library explicitly compiles Vosk to be used in a WebWorker context. If you want to use Vosk in a NodeJS application it is recommended to use the official node bindings.

Live Demo

Checkout the demo running in-browser speech recognition of microphone input or audio files in 13 languages.

Vosk-Browser Live Demo

Installation

You can install vosk-browser as a module:

$ npm i vosk-browser

You can also use a CDN like jsdelivr to add the library to your page, which will be accessible via the global variable Vosk:

<script type="application/javascript" src="https://cdn.jsdelivr.net/npm/vosk-browser@0.0.5/dist/vosk.js"></script>

Usage

See the README in ./lib for API reference documentation or check out the examples folder for some ways of using the library

Basic example

One of the simplest examples that assumes vosk-browser is loaded via a script tag. It loads the model named model.tar.gzlocated in the same path as the script and starts listening to the microphone. Recognition results are logged to the console.

```js async function init() { const model = await Vosk.createModel('model.tar.gz');

const recognizer = new model.KaldiRecognizer();
recognizer.on("result", (message) => {
    console.log(`Result: ${message.result.text}`);
});
recognizer.on("partialresult", (message) => {
    console.log(`Partial result: ${message.result.partial}`);
});

const mediaStream = await navigator.mediaDevices.getUserMedia({
    video: false,
    audio: {
        echoCancellation: true,
        noiseSuppression: true,
        channelCount: 1,
        sampleRate: 16000
    },
});

const audioContext = new AudioContext();
const recognizerNode = audioContext.createScriptProcessor(4096, 1, 1)
recognizerNode.onaudioprocess = (event) => {
    try {
        recognizer.acceptWaveform(event.inputBuffer)
    } catch (error) {
        console.error('acceptWaveform failed', error)
    }
}
const source = audioContext.createMediaStreamSource(mediaStream);
source.connect(recognizerNode);

}

window.onload = init; ```

Todos

  • Write tests
  • Automate npm publish
  • Automate demo publishing
  • Example with speaker model
  • Better documentation

Owner

  • Name: Ciaran O'Reilly
  • Login: ccoreilly
  • Kind: user
  • Location: Berlin
  • Company: @parloa

GitHub Events

Total
  • Issues event: 9
  • Watch event: 100
  • Issue comment event: 39
  • Pull request event: 1
  • Fork event: 14
Last Year
  • Issues event: 9
  • Watch event: 100
  • Issue comment event: 39
  • Pull request event: 1
  • Fork event: 14

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 67
  • Total Committers: 7
  • Avg Commits per committer: 9.571
  • Development Distribution Score (DDS): 0.179
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Ciaran O'Reilly c****n@f****m 55
Yahweasel g****o@y****m 3
Mirko Geissler m****r@a****e 3
Steven Nyman 3****n 2
Clement c****t@m****o 2
davidatbu 5****u 1
Igor z****n@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 71
  • Total pull requests: 20
  • Average time to close issues: 26 days
  • Average time to close pull requests: 20 days
  • Total issue authors: 60
  • Total pull request authors: 13
  • Average comments per issue: 3.51
  • Average comments per pull request: 1.05
  • Merged pull requests: 14
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 9
  • Pull requests: 1
  • Average time to close issues: about 2 months
  • Average time to close pull requests: N/A
  • Issue authors: 7
  • Pull request authors: 1
  • Average comments per issue: 0.33
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • wizVR-zhangjun (4)
  • JerryGeis (2)
  • lavrenkov-sketch (2)
  • lheine10 (2)
  • Nata0801 (2)
  • DanielUsselmann (2)
  • MichaelaMer (2)
  • Yahweasel (2)
  • tab-zero (2)
  • denkiunagi (1)
  • Omarnabk (1)
  • kavyamanohar (1)
  • robin12jbj (1)
  • Rodeoclash (1)
  • Clement-mim (1)
Pull Request Authors
  • ccoreilly (6)
  • kavyamanohar (3)
  • AndreasKueck (1)
  • stevennyman (1)
  • vikasharma005 (1)
  • Yahweasel (1)
  • Clement-mim (1)
  • xadh00m (1)
  • m-abdi (1)
  • dnaaun (1)
  • zavalyshyn (1)
  • DiegoZunino (1)
  • simonfn (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • npm 14,579 last-month
  • Total dependent packages: 3
    (may contain duplicates)
  • Total dependent repositories: 8
    (may contain duplicates)
  • Total versions: 11
  • Total maintainers: 1
npmjs.org: vosk-browser

Kaldi in-browser speech recognition based on a WASM build of the Vosk library

  • Versions: 10
  • Dependent Packages: 2
  • Dependent Repositories: 8
  • Downloads: 14,527 Last month
Rankings
Downloads: 0.6%
Stargazers count: 3.7%
Forks count: 3.9%
Average: 4.2%
Dependent repos count: 4.3%
Dependent packages count: 8.8%
Maintainers (1)
Last synced: 6 months ago
npmjs.org: vosk-wasm

WebAssembly build of the Vosk library

  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 52 Last month
Rankings
Stargazers count: 4.6%
Forks count: 4.8%
Dependent packages count: 16.2%
Average: 17.7%
Dependent repos count: 25.3%
Downloads: 37.2%
Maintainers (1)
Last synced: 6 months ago

Dependencies

examples/react/package-lock.json npm
  • 1688 dependencies
examples/react/package.json npm
  • @types/readable-stream ^2.3.9 development
  • @types/styled-components ^5.1.7 development
  • @ant-design/icons ^4.5.0
  • @types/node ^12.20.4
  • @types/react ^17.0.2
  • @types/react-dom ^17.0.1
  • antd ^4.13.0
  • microphone-stream 5.1.0
  • react ^17.0.1
  • react-dom ^17.0.1
  • react-scripts 4.0.2
  • readable-stream ^3.6.0
  • styled-components 5.2.1
  • typescript ^4.1.5
  • vosk-browser ../../lib
builder/Dockerfile docker
  • dockcross/web-wasm 20210901-4a98c0e build