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

expo-precision-metronome

v1.0.0

Published

High-precision metronome engine for Expo and React Native with native audio scheduling support.

Readme

expo-precision-metronome

JS Android iOS npm version Expo SDK REUSE status

High-precision metronome engine for Expo and React Native. Beats are scheduled at the native audio layer — timing stays rock-solid regardless of JS thread load.

Features

  • Sample-accurate beat scheduling via AVAudioEngine (iOS) and Oboe (Android)
  • onBeat event with beat index and high-resolution timestamp
  • onStop event distinguishing explicit stop from audio interruption (phone call, alarm, etc.)
  • Live BPM change without restarting the engine
  • JSI bridge — no JSON serialization overhead
  • Full TypeScript types included

Requirements

| | Minimum | | ----------- | ------------------------------------------------ | | Expo SDK | 55 | | iOS | 15.1 | | Android API | 24 (26+ recommended for AAudio low-latency path) | | Node | 18 |

Installation

npx expo install expo-precision-metronome

[!NOTE] This package requires native code. It does not work with Expo Go — use a development build.

Usage

import { useEffect } from "react";
import { start, stop, setBpm } from "expo-precision-metronome";
import ExpoPrecisionMetronomeModule from "expo-precision-metronome";

export default function Metronome() {
  useEffect(() => {
    const beatSub = ExpoPrecisionMetronomeModule.addListener(
      "onBeat",
      ({ beat, timestamp }) => {
        console.log(`Beat ${beat} at ${timestamp}s`);
      },
    );

    const stopSub = ExpoPrecisionMetronomeModule.addListener("onStop", ({ reason }) => {
      console.log(`Stopped: ${reason}`);
    });

    start(120);

    return () => {
      stop();
      beatSub.remove();
      stopSub.remove();
    };
  }, []);
}

API

Functions

start(bpm: number): Promise<void>

Starts the metronome at the given BPM. Resolves when the audio engine has started. Throws RangeError if bpm is outside BPM_MINBPM_MAX.

stop(): Promise<void>

Stops the metronome. Emits onStop with reason: "explicit".

setBpm(bpm: number): Promise<void>

Changes the tempo on the fly without stopping the engine. Throws RangeError if bpm is outside BPM_MINBPM_MAX.


Events

Subscribe via ExpoPrecisionMetronomeModule.addListener(eventName, handler). Always call .remove() on the returned subscription to avoid leaks.

onBeat

Emitted on every beat.

| Property | Type | Description | | ----------- | -------- | ----------------------------------------------- | | beat | number | Beat index, starting at 1 | | timestamp | number | High-resolution audio clock timestamp (seconds) |

onStop

Emitted when the metronome stops for any reason.

| Property | Type | Description | | -------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------- | | reason | "explicit" \| "interruption" | "explicit" — stopped by stop(). "interruption" — stopped by the OS (incoming call, audio session interruption, etc.) |


Constants

| Constant | Value | Description | | --------- | ----- | ----------------- | | BPM_MIN | 20 | Minimum valid BPM | | BPM_MAX | 300 | Maximum valid BPM |


Types

type BeatEventPayload = {
  beat: number;
  timestamp: number;
};

type StopEventPayload = {
  reason: "explicit" | "interruption";
};

Running the example app

cd example

# iOS
npx expo run:ios

# Android
npx expo run:android

Contributing

See CONTRIBUTING.md.

License

MIT © Andrey Kotlyar