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

@tilawi/react-native-quran-asr

v0.1.0

Published

On-device Quran recitation recognition for React Native / Expo: onnxruntime runner, recognition pipeline and a lifecycle-safe microphone hook.

Readme

@tilawi/react-native-quran-asr

On-device Quran recitation recognition for React Native / Expo. Record a recitation, find the verse, or get a transcript for word-by-word memorization feedback, entirely on the phone: no server, and the audio never leaves the device.

This is the React Native layer of the Tilawi app's voice search and memorization checks:

What's inside

| Export | | |---|---| | createQuranAsr({ loadAssets }) | Loads the model and data once (you decide from where), then transcribeClip(pcm) for voice search or transcribeTextOnly(pcm) for memorization. Clips without speech throw asr_no_speech. transcribeTextOnly handles clips over 60 s in overlapping 30 s windows to bound memory; transcribeClip runs in one pass, so keep voice-search clips short (inference memory grows about 13 MB per second of audio). | | useAsrRecorder({ ensurePermission }) | A recorder hook: start(), stop() returns the whole clip as a Float32Array, cancel(), plus isRecording, durationMs and a live metering level. Safe against unmounts and double taps mid-start. | | createOnnxRunner(modelPath) | The onnxruntime-react-native runner used by default. |

Install

npx expo install @tilawi/react-native-quran-asr @tilawi/expo-pcm-recorder onnxruntime-react-native expo-audio expo-asset expo-file-system

This needs a development build (native code). Two setup notes, both learned the hard way:

  1. Android + Expo SDK 54: onnxruntime-react-native isn't linked. It ships a legacy unimodule.json, so Expo autolinking treats it as an Expo module and skips React Native linking; NativeModules.Onnxruntime is then null on Android (microsoft/onnxruntime#29004, closed as stale but still present on main). Fix it with a react-native.config.js in your app:

    module.exports = {
      dependencies: {
        'onnxruntime-react-native': { platforms: { android: { sourceDir: 'android' } } },
      },
    };
  2. Android builds use an unpinned ONNX Runtime. onnxruntime-react-native's Gradle file resolves onnxruntime-android:latest.integration, so a build can silently pick up a newer native runtime than the JS expects (microsoft/onnxruntime#32744). Tilawi pins it with a patch-package patch replacing latest.integration with 1.24.3.

Add the model files to Metro's asset extensions (metro.config.js) if you bundle them with the app:

config.resolver.assetExts.push('onnx', 'bin'); // ship the JSON files renamed to .bin so they stay out of the JS bundle

Usage

import { createQuranAsr, useAsrRecorder } from '@tilawi/react-native-quran-asr';
import { requestRecordingPermissionsAsync } from 'expo-audio';

const asr = createQuranAsr({
  // Return { modelPath, vocab, quranCtcTokens, quran }. The model must be a
  // local file path; the three JSON files come from the Hugging Face repo.
  loadAssets: async () => loadMyAssets(),
});

function VoiceSearch() {
  const recorder = useAsrRecorder({
    ensurePermission: async () => {
      const { granted } = await requestRecordingPermissionsAsync();
      if (!granted) throw new Error('asr_permission_denied');
    },
  });

  const onStart = async () => {
    asr.warmUp(); // load the model while the user recites
    await recorder.start();
  };

  const onStop = async () => {
    const pcm = await recorder.stop();
    const result = await asr.transcribeClip(pcm);
    if (result.surah > 0) navigateTo(result.surah, result.ayah);
    // surah/ayah are 0 when no verse was matched confidently
  };
  // ...
}

For memorization feedback, pass await asr.transcribeTextOnly(pcm) and the expected verse words to judgeAttempt from @tilawi/quran-asr.

Tilawi's own asset loader (bundled with expo-asset, model copied to the document directory on first use) is a good template: it resolves each bundled file with Asset.fromModule, reads the JSON files, and copies the model to Paths.document so onnxruntime gets a stable path.

License

MIT. The model is CC-BY-4.0 (fine-tuned from NVIDIA's FastConformer) and the Quran text is from the Tanzil Project; see the Hugging Face model card.