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

@codeplayer71/audio-recorder-core

v1.1.0

Published

Framework-independent and fully typed browser audio recording core based on the MediaRecorder API.

Downloads

432

Readme

@codeplayer71/audio-recorder-core

Framework-independent and fully typed browser audio recording core based on the MediaRecorder API.

Installation

pnpm add @codeplayer71/audio-recorder-core
npm install @codeplayer71/audio-recorder-core
yarn add @codeplayer71/audio-recorder-core

Usage

import { createAudioRecorder } from '@codeplayer71/audio-recorder-core';

const recorder = createAudioRecorder({
  maxDurationMs: 120_000,
  maxFileSizeBytes: 10_000_000,
});

const unsubscribe = recorder.subscribe((snapshot) => {
  console.log(snapshot.state);
  console.log(snapshot.durationMs);
  console.log(snapshot.audioLevel);
  console.log(snapshot.recording);
  console.log(snapshot.error);
});

await recorder.start();

const recording = await recorder.stop();

console.log(recording.file);
console.log(recording.url);

unsubscribe();
recorder.destroy();

Live audio level

The recorder snapshot exposes a normalized live microphone level:

recorder.subscribe((snapshot) => {
  console.log(snapshot.audioLevel);
});

The value is always between:

0 <= audioLevel <= 1

The level is intended as lightweight visual feedback for microphone activity.

It is not a professional decibel measurement.

Behavior

The value is updated while the recorder is in the recording state.

It is reset to 0 when the recorder is:

  • idle
  • requesting microphone permission
  • paused
  • processing
  • completed
  • in an error state
  • cancelled
  • reset
  • destroyed

Implementation details

Live audio level monitoring uses the Web Audio API internally.

The recorder reuses the same MediaStream that is already created for MediaRecorder.

No second microphone stream is requested.

Internally, the level is calculated from time-domain samples using an RMS-based measurement and simple smoothing.

The analyser is not connected to the audio output, so microphone monitoring does not produce speaker playback or feedback.

Failure behavior

Audio level monitoring is treated as an optional enhancement.

If the required Web Audio APIs are unavailable or AudioContext initialization fails:

  • the audio recording continues normally
  • audioLevel remains 0
  • no fatal recorder error is generated solely because audio level monitoring failed

Resource cleanup

Audio level monitoring resources are cleaned up automatically.

This includes:

  • AudioContext
  • MediaStreamAudioSourceNode
  • AnalyserNode
  • requestAnimationFrame

Cleanup happens when monitoring stops, including on pause, stop, cancel, reset and destroy.

Documentation

Full documentation, framework integrations and examples are available in the main repository:

https://github.com/codeplayer71/jamit-audio-recorder

License

MIT