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 🙏

© 2026 – Pkg Stats / Ryan Hefner

vue-audio-analyser

v1.0.1

Published

A small toy for converting audio streams into frequencies

Readme

vue-audio-analyser

English | 繁體中文 | 简体中文

vue-audio-analyser is a Vue 3 composable function that leverages the Web Audio API to easily capture and analyze audio data from the user's microphone. It includes a simple tool to distinguish between male and female voices. The function provides methods to start and stop audio capture, as well as real-time audio data for visualization or other processing.

Live Demo: vue-audio-analyser

Installation

# npm
$ npm install vue-audio-analyser

# yarn
$ yarn add vue-audio-analyser

Usage

import { ref, watch } from 'vue';
import { useAudioAnalyser } from 'vue-audio-analyser';

const { startAudioCapture, stopAudioCapture, originAudioData, indexToFrequency } = useAudioAnalyser();

const yourStartEvent = () => {
  startAudioCapture();
}

const yourStopEvent = () => {
  try {
    const { analyserData, parsedData } = stopAudioCapture();
    // Process the captured audio data here, such as displaying results
  } catch (e) {
    console.error(e);
  }
}

watch(originAudioData, (value) => {
  // Triggered whenever the audio data updates, useful for visualization or other processing
}, { deep: true });

About indexToFrequency(index)

Since the function returns a range value, you can use a random number within that range when converting it for charts.

const freq = indexToFrequency('5');
console.log(freq); // '80~100' frequency

const yourChartData = analyserData.map((item) => {
  const segment = indexToFrequency(item.toString());
  const [ min, max ] = segment.split('~').map(Number);
  return Math.round(Math.random() * (max - min) + min);
});

API

  • startAudioCapture(): Starts audio capture, requests the user's microphone access permission, and begins real-time audio data collection.
  • stopAudioCapture(): Stops audio capture, disconnects the audio source, and returns the captured data.
    • Returns:
      • analyserData: Contains the index data from the audio analysis.
      • parsedData: Parsed data that includes the count and percentage of each frequency range.
  • indexToFrequency(index): A function to convert the analyserData index values into frequency ranges.
  • originAudioData: Real-time raw audio data, useful for visualization or other real-time processing.

Notice

  • Ensure your application runs under the HTTPS protocol, as browsers only allow microphone access in secure environments.
  • When using this package, make sure to handle cases where the user denies microphone access.
  • Since the primary purpose of the initial development was to distinguish between male and female voices, the frequency capture is currently limited to 400 Hz.