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

vue-voice-input-component

v0.0.3

Published

This component adds a button that allows users to record audio through their microphone using Web APIs‘ [MediaRecorder interface](https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder) and send the audio data to a specified backend server URL for

Downloads

20

Readme

Vue voice input component

This component adds a button that allows users to record audio through their microphone using Web APIs‘ MediaRecorder interface and send the audio data to a specified backend server URL for processing. It also provides a component to display the response or other input with a „typing effect“ (similar to chatGPT).

Features

Packages has three components:

  • VoiceButton – allows to send record audio input using Web API MediaRecorder interaface and send it to a specified backend URL
  • VoiceTranscript – allows to display input string as being typed out one letter at a time
  • VoiceTranscriptComponent – combines both components to have an interface component that records audio, sends it to the backend for processing and then displays the response

Usage examples

Install using this command:

npm -i vue-voice-inout-component

Then to use the voice input button:

<script setup lang="ts">
import { VoiceButton } from 'vue-voice-input-component';
</script>

<template>
  <div>
    <VoiceButton
      api-endpoint="http://localhost:3000/api/speech-to-text"
    />
  </div>
</template>

To use the transcript component seperately:

<script setup lang="ts">
import { VoiceTranscript } from 'vue-voice-input-component';
</script>

<template>
  <div>
    <VoiceTranscript
      transcription="This is a test transcription"
    />
  </div>
</template>

And finally the combined component has both the button and the transcript component:

<script setup lang="ts">
import { VoiceTranscriptComponent } from 'vue-voice-input-component';
</script>

<template>
  <div>
    <VoiceTranscriptComponent
      api-endpoint="http://localhost:3000/api/speech-to-text"
    />
  </div>
</template>

Note: the combined VoiceTranscriptComponent expects the backend response to have a transcription key value pairs that is then passed to the transcription component to be validated and displayed.

Component properties

VoiceButton component properties:

| Name | Type | Optional | Default value | Description | |------|------|----------|---------------|-------------| | apiEndpoint | String | False | - | API URL where the audio binary data is sent | | maxDuration | Number | True | 5000ms | Maximum recording duration | | apiHeaders | Object | True | undefined | Custom HTTP request headers that are added to API request | | formDataTag | String | True | audio | Audio data value name in API request body | | audioContraints | Object | True | {channelCount: 1, echoCancellation: false, sampleRate: 16000} | Audio stream constraints. More options can be found here | | blobType | String | True | audio/webm;codecs=opus | The MIME type of blob in which the audio chucks are stored and passed to backend | | timeslice | Number | True | 1000ms | The size of timeslices in milliseconds in which the audio chucks are saved. Note: the max duration is dividated by timeslice to calculate how many timeslices to record so take that into account when setting both properties |

Here is the list of emited events:

| Name | Properties | Description | |------|------------|-------------| | recordingStart | - | Emits event when the recording is started | | recordingStop | response | Emits event when recording is stopped with the API response |

VoiceTransript component properties:

| Name | Type | Optional | Default value | Description | | -----|------|----------|---------------|-------------| | transcription | String | True | "" | The transcription string that is displayed by the component | | typeSpeed | Number | True | 50 | The speed at which the transcription is written out | | singleWordLimit | Number | True | 1000 | The max limit of word used in validating the transcription |

The combined VoiceTranscriptComponent has all the properties mention above since it combines both the VoiceButton and VoiceTransript components.

Demo

Here are a few screenshots of the component added to a empty Vue app:

button when not recording

button when recording

button and transcript after recording

Components have minimal styling that could be changed with custom classes. However, it will be updated in the future.