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

@vuics/vui-react

v0.4.0

Published

Vuics.com React.js Component for Voice User Interface (VUI) integration

Downloads

16

Readme

vuics-vui-react

Vuics.com React.js Component for Voice User Interface (VUI) integration.

NPM JavaScript Style Guide

Description

A Set of React Components that provide easy usage of the Vuics.com API for building Voice User Interfaces for your website.

Features

  • Vuics API for building VUIs.
  • Server-side Speech Synthesis and Speech Recognition with Vuics Speech API.
  • Client-side Speech Synthesis and Speech Recognition with Web Speech API.
  • Natural language understanding with Vuics API.
  • Wake-word and sleep-word to enable/disable VUI with client-side speech recognition.
  • Recording Audio from microphone.
  • Default and custom Click-to-Speak Buttons.
  • Oscilloscope component to visualize recording.
  • Triggering actions by VUI events.
  • Examples.
  • And others.

How to start?

Please do the following steps to integrate VUI into your React.js web application.

  1. Sing up on Vuics.com.
  2. Request access to Vuics API by email or on Vuics.com.
  3. We will create a Vuics API Key for you.
  4. Integrate @vuics/vui-react component into your website.
  5. Build your voice interface with the @vuics/cli.
  6. Feel free to ask us any questions. We would love to help with the integration.

Install

npm i @vuics/vui-react

Additionally, you may need to install the following packages:

npm i prop-types react react-dom react-scripts webworkify-webpack

Usage

Please, contact us by email or on Vuics.com to get credentials such as:

export REACT_APP_VUICS_API_KEY=

You can declare the variable above in JS file, or consume variables declared in your environment. For example, react-create-app automatically consumes environment variables starting with REACT_APP_.

Then add the code below into your React.js application:

import React, {
  Component
} from 'react'

import {
  Vuics,
  initVuics,
  ButtonDefault,
  Oscilloscope,
  Consumer
} from '@vuics/vui-react'

import {
  Button,
  Loader
} from 'semantic-ui-react'
import 'semantic-ui-css/semantic.min.css'

initVuics({
  apiKey: process.env.REACT_APP_VUICS_API_KEY
})

export default class App extends Component {
  onData = data => {
    console.log('intentName:', data.intentName)
  }

  render = () => (
    <div>
      <Vuics
        name='VuicsHome'
        onConversationData={this.onData}
        fillStyle='rgb(27,28,29)'
        lineWidth={2}
        strokeStyle='rgb(33,186,70)'
      >
        <ButtonDefault
          className='button'
        />

        <Consumer>
          {
            ({ buttonRef, onClick, state, message }) => (
              <Button
                className='button'
                onClick={onClick}
                ref={buttonRef}
                size='huge'
                color='green'
              >
                {
                  state === 'Passive'
                    ? 'Click to Speak 🎙️ =>'
                    : state === 'Listening'
                      ? '🎤 Say a Phrase (e.g. "Help me")'
                      : state === 'Sending'
                        ? <Loader active inline='centered' />
                        : '🔊' + message
                }
              </Button>
            )
          }
        </Consumer>

        <Oscilloscope
          canvasWrapperClassName='canvasWrapper'
          canvasClassName='canvas'
        />
      </Vuics>

    </div>
  )
}

Manifest Permissions

To allow using Web Speech API (e.g. for wake-word), set the following permissions in your manifest.json:

  "type": "privileged",
  "permissions": {
    "audio-capture": {
      "description": "Audio capture"
    },
    "speech-recognition": {
      "description": "Speech recognition"
    }
  }

Examples

See examples in the examples dir.

  • Click-to-Speak example demonstrates usage of Click-To-Speak button for Voice User Interface.
  • Wake-Word example demontrate usage of Wake-Word and Sleep-Word for managing Voice User Interface.

API

Initialize Vuics

initVuics({
  apiKey: process.env.REACT_APP_VUICS_API_KEY, // API key
  apiUrl: process.env.REACT_APP_VUICS_API_URL, // API URL, default: https://api.vuics.com/latest
})

React.js components

  • Vuics - context provider component for voice user interface.

  • ButtonDefault - default Click-To-Speek button that enables recording from microphone and passing audio to voice user interface.

  • Oscilloscope - visualizes audio recording.

  • Consumer - makes available to use custom Click-To-Speak buttons.

Client-side Speech API classes

Synthesizer

Synthesizer is a class for client-side speech synthesis.

  • Synthesizer.speak{{ phrase }} - synthesizes text-to-speech and play the speech as audio.

Recognizer

Recognizer is a class for client-side speech recognition.

  • isSupported() - returns true if speech recognition is supported by browser, or false if it's not supported.

  • start() - start listening.

  • abort() - stop listening, and turn off mic.

  • pause() - pause listening.

  • resume() - resumes listening and restores command callback execution when a result matches. If SpeechRecognition was aborted (stopped), start it.

  • addCommands({ 'command1': handler1, ... }) - add commands that Recognizer will respond to.

  • isListening() - returns true if speech recognition is currently on. Returns false if speech recognition is off or Recognizer is paused.

Recognizer API is described additionally here

License

ISC

Questions

Some frequently asked questions answered here: FAQ

Do you have any additional questions?

Feel free to ask us any questions. We would love to help with the integration.

You could contact us by email or on Vuics.com.