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

mudraka

v0.3.1

Published

C++ sEMG engine for Mudra Link raw SNC decoding — WASM/embind build.

Readme

mudraka

npm

WASM build of mudraka — a C++17 engine that decodes the Mudra Link wristband's raw surface-EMG (SNC) BLE stream into int32 samples, buffers them in a ring, and serves the latest window for real-time use. Built for the browser (Web Bluetooth), Web Workers, and Node. Ships mudraka.js + mudraka.wasm and TypeScript types.

The engine is transport-agnostic: you own the BLE connection (Web Bluetooth) and hand each notification's bytes to feed(). mudraka does the decode + buffering.

Install

npm install mudraka

Quick start

import createMudraka from "mudraka";

const M = await createMudraka();          // instantiate the WASM module
const CH = 3, MAX = 256;                   // 3 channels; max samples per pull
const stream = new M.Stream(M.makeConfig(CH, 834, 4)); // 3ch, ~834 Hz, 4 s ring

// A destination region in the WASM heap: channel-major (CH * MAX) int32.
const ptr = M._malloc(CH * MAX * 4);
const base = ptr >> 2;                      // int32 index into HEAP32
let cursor = 0;

// Per BLE notification (bytes = Uint8Array), decode then drain the new samples:
function onNotification(bytes, recvTimeS) {
  stream.feed(bytes, recvTimeS);
  const r = stream.pullInto(cursor, ptr, MAX);
  for (let i = 0; i < r.written; i++) {
    const ulnar  = M.HEAP32[base + 0 * MAX + i];
    const median = M.HEAP32[base + 1 * MAX + i];
    const radial = M.HEAP32[base + 2 * MAX + i];
    // …plot / forward…
  }
  cursor = r.next_cursor;                   // r.lost > 0 means the ring overwrote unread samples
}

// When done:
M._free(ptr);
stream.delete();                            // free the C++ object (embind)

Web Bluetooth wiring

char.addEventListener("characteristicvaluechanged", (e) => {
  const bytes = new Uint8Array(e.target.value.buffer); // DataView -> Uint8Array
  onNotification(bytes, performance.now() / 1000);
});
await char.startNotifications();

The SNC characteristic is 0000fff4-0000-1000-8000-00805f9b34fb.

Loading the .wasm with a bundler

By default the module fetches mudraka.wasm from the same URL as mudraka.js. Bundlers that hash/relocate assets may break that — point locateFile at the emitted asset:

import wasmUrl from "mudraka/mudraka.wasm?url"; // Vite; webpack: use asset/resource
const M = await createMudraka({ locateFile: () => wasmUrl });

API

createMudraka(options?)Promise<Module>. options.locateFile?(path, dir) resolves the .wasm. The module exposes:

  • makeConfig(channels, nominalRateHz, ringSeconds)Config
  • new Stream(config) — decode stream (one per connection):
    • feed(bytes: Uint8Array, recvTimeS: number) → samples written per channel (0 if malformed)
    • pullInto(cursor, dstPtr, max){ written, next_cursor, lost } (writes channel-major int32 at dstPtr)
    • head() — total samples per channel so far (the newest cursor)
    • channels(), estimatedRateHz(), malformedFrames(), totalOverwritten()
    • lastDeviceTimeUs() — device-clock µs of the last notification (−1 if none)
    • timestamp(i) — reconstructed host time (s) for absolute sample index i
    • delete() — free the C++ object
  • _malloc(bytes) / _free(ptr) and HEAP32 for the pullInto destination.

Types are bundled (mudraka.d.ts).

Links

Source, design docs, and the Python (PyPI) build: https://github.com/ttktjmt/mudraka. Licensed Apache-2.0.