SkillAgentSearch skills...

StackmatSignalProcessor

🎼An Audio Worklet to process Stackmat Signals in real time and communicating an event stream through the Worklet's messagePort.

Install / Use

/learn @Kubiverse/StackmatSignalProcessor
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Stackmat Signal Processor

An Audio Worklet to process Stackmat Signals in real time and communicating an event stream through the Worker's message broker.

Installation

You can install it using NPM

npm i stackmat-signal-processor

Example usage

A simple example of how to implement the Stackmat Signal Processor with an Analyser.

import StackmatSignalProcessor from 'stackmat-signal-processor'

async function connect() {
  // Connect to media device
  let stream = await navigator.mediaDevices.getUserMedia({
    "audio": {"optional": [{"echoCancellation": false}]}
  })

  // Get the Audio Context
  const audioContext = new AudioContext({
    "echoCancellation": false,
    "noiseSuppression": false
  })

  // Create relevant Audio Nodes
  const microphone = audioContext.createMediaStreamSource(stream)

  // Connecting the StackmatSignalProcessor
  await audioContext.audioWorklet.addModule(StackmatSignalProcessor)

  // Create an Audio Node for the Stackmat Signal Processor
  const stackmatSignal = new AudioWorkletNode(audioContext, 'StackmatSignalProcessor')

  microphone.connect(stackmatSignal)
  stackmatSignal.connect(audioContext.destination)

  stackmatSignal.port.onmessage = event => {
    handle(event.data)
  }
}

Note: Do not connect the Audio nodes to the device, as the Stackmat Signal Processor using the audio output for data states, doesn't sound pleasant.

Message format

{
    "state": {
      "id": 6,
      "descriptor": "LEFT",
    },
    "rightHand": false,
    "leftHand": true,
    "bothHands": false,
    "isReset": false,
    "isRunning": true,
    "time": 12373
  }

Timers Supported so far

βœ” Stackmat Timer Gen 4

βœ” Stackmat Timer Gen 4 (with faulty pad detection)

❌ Stackmat Timer Gen 3

❌ Yuxin Timer v2

❌ Moyu Timer

View on GitHub
GitHub Stars8
CategoryDevelopment
Updated1y ago
Forks0

Languages

JavaScript

Security Score

70/100

Audited on Oct 25, 2024

No findings