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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@webnect/webnect

v0.0.5

Published

a webUSB driver for the xbox360 kinect

Downloads

6

Readme

webnect

(try live demo)

this is a webusb driver for microsoft's xbox360 kinect.

https://github.com/turbocrime/webnect/assets/134443988/40879425-cd91-4bae-a14f-633dc0f8d88c

chrome only :'C mozzy dont do webusb

i have never written a usb driver before, nor even a typescript library, so critique is welcome.

this driver at least works with "Xbox NUI Motor" PID 0x02b0 and "Xbox NUI Camera" PID 0x02ae devices, labelled "Model 1414", because that's what i found at goodwill. i there may be a few externally-identical models of "kinect", some with dramatic hardware revisions. if your device doesn't work with this, please verify that it works at all, and then send me the details.

what

the kinect is an early consumer depth sensor based on structured light projection, plus some other goodies. it was released in 2010 as a gamer thing and nobody cares about it anymore except me

they're fun, and they go for like $5 now. plus they're usb2, so i can drive them with throwaway SBCs like an rpi3. maybe not with this driver, but that's how i got familiar. i been using them for video synth input, and interactive generative art installations

a webusb driver lets more folks see it in person :) after i rewrite everything :)

ware

original kinect only.

Xbox NUI Motor

  • accelerometer
  • tilt servo
  • blinkenlights

Xbox NUI Camera

  • depth 11bpp, 10bpp
  • visible 8bpp bayer, 16bpp yuv
  • infrared 10bpp
  • arbitrary register manipulation

visible and infrared stream from the same endpoint, so you can only have one at a time. you can use my pipeline and get a ReadableStream<ImageData> that you just blit to canvas, or set a custom deraw function.

why

building libfreenect with emscripten turned out to be impossible for various reasons. whatever. it's the future and webusb is real

how

go dig your kinect out of the closet. plug it in. open https://turbocrime.github.io/webnect

for a local demo, clone this repo.

diy

available on npm as @webnect/webnect

no docs yet, but it's pretty simple. you can grab a new kinect camera with

import k from "@webnect/webnect";
const dev: USBDevice = await k.claimNuiCamera();
const kcam = k.Camera(dev);
kcam.mode({ depth: k.DEPTH_MODE });
const depthStream: ReadableStream<ImageData> = kcam.depth.getReader();

alternatively, if you want raw frames in a specific mode, you could

import k, { Modes, CamType, CamFmtVisible } from "@webnect/webnect";
const dev: USBDevice = await k.claimNuiCamera();
const kcam = k.Camera(dev, {
        modes: { depth: Modes.OFF, video: { stream: CamType.VISIBLE, format: CamFmtVisible.YUV_16B } },
        deraw: { depth: false, video: false }
});
const yuvFrameStream: ReadableStream<ArrayBuffer> = kcam.video.getReader();

um its broekn??

if you see an empty device selection modal, you probably have the wrong model kinect. you can check your usb devices with lsusb on linux or on system_profiler SPUSBDataType on macos

if you see glitchy stream output, haha nice. cool

bad parts

a single kinect is technically three devices in a trenchcoat. afaict there's no way to associate them, because webusb won't expose bus position. it doesn't matter; you probably only plugged in one kinect anyway.

also, typescript aint exactly the optimal language for bitmath or destructuring binary data

way

probably going after pose features next, maybe alignment of video to depth. and then firmware/audio stuff.

someday.... kinect2?