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

bstt-player

v0.1.33

Published

React library for powering verbal assessments through ASR

Downloads

55

Readme

BSTT Player

A React library to conduct verbal assessments powered by ASR 🔥⚡

BSTT Player is a React library that allows users to conduct verbal assessments by leveraging an Automatic Speech Recognition (ASR) system. This library simplifies the process of incorporating verbal assessments into React projects, providing a smooth and intuitive experience for both developers and users.

Prerequisites:

Before using BSTT Player, ensure the following prerequisites are met:

  1. API Key: You need to have a valid API key to interact with the ASR backend service.
  2. BSTT Backend URL: Ensure that you have the BSTT backend URL where the ASR requests will be sent.

How to Use:

To use BSTT Player in your React application, follow these steps:

/* Sample Code snippet to incorporate BSTT Player */
// Import BsttPlayer from 'bstt-player'
import BsttPlayer from 'bstt-player';
import { useEffect } from 'react';

function App() {
  
  const onEnd = (data) => {
    console.log("Completed Assessment: ", data);
  }

  const config = {
    apiKey: "a9qnKCuC3tM0J9Z2wS1usZI8j1AH9qc9",
    bstt_base_url: "https://bstt.dev.nisai.samagra.io",
    asr_input_lang: "hi",
    asr_fuzzy_match: false,
    asr_distance_cutoff: 1
  }

  return (
    <div className="App">
      <header className="App-header">

        {/* Load the BsttPlayer component in your app providing the required props */}
        <BsttPlayer
          data={{ textContent: 'हमें अपठित गद्यांश पढ़ने चाहिए क्योंकि इससे हमारी पढ़ाई में सुधार होता है। ये हमारे व्यापक ज्ञान को बढ़ाते हैं और हमारी सोचने की क्षमता को विकसित करते हैं। जब हम इन अपठित गद्यांशों को पढ़ते हैं, तो हमारा ध्यान बढ़ता है और हमें बेहतरीन जवाब देने की क्षमता मिलती है। इसके साथ हमारी भाषा को समझने में भी सुधार होता है।अपठित गद्यांश कैसे पढ़ें?', timeLimit: 10 }}
          height='100vh'
          width='50vw'
          offline={false}
          onStart={() => { console.log("Assessment Started") }}
          onEnd={onEnd}
          onTimeOver={() => { console.log("Time Over") }}
          config={config}
        />
      </header>
    </div>
  );
}

export default App;

Props:

| Prop | Type | Description | Default | |-----------|----------|----------------------------------------------------------------------------------|---------| | data | object | The data object consisting of textContent and timeLimit in seconds | None | | height | string | Height of the player to be rendered | 100vh | | width | string | Width of the player to be rendered | 100vw | | offline | boolean | Boolean to decide whether the assessment should work offline or not | false | | onStart | function | Callback function to be executed when the assessment starts | None | | onEnd | function | Callback function to be executed when the assessment ends | None | | onTimeOver| function | Callback function to be executed when the time limit is over | None | | config | object | Configuration object for ASR, containing apiKey, bstt_base_url, asr_input_lang, asr_fuzzy_match, and asr_distance_cutoff | None |

How It Works:

BSTT Player displays the textContent in a readable format and the user starts reading the passage. The audio is recorded in chunks and sent to the backend for processing. The results are then merged on the frontend.

In offline mode, the entire recording is stored in IndexedDB and processed when the network is restored. The library uses a silence detection algorithm to create chunks when silence is detected. It captures surrounding audio for about 3 seconds at the beginning before starting the assessment to calculate a threshold decibel.

The final result of the assessment is provided in the following format:

{
  "correct_words_count": 9,
  "total_words": 18,
  "tts": 40,
  "wpm": 9,
  "correct_words": [],
  "incorrect_words": []
}

Ending Notes:

Thank you for choosing BSTT Player! I hope this library makes integrating verbal assessments into your React applications a breeze. Don't forget to star the repository if you find it useful!

🌟 Star us on GitHub: [https://github.com/your-repo/bstt-player]

Feel free to contribute, report issues, or suggest improvements. Happy coding! 💻✨