@neurodevs/node-signal-processing
TypeScript icon, indicating that this package has built-in type declarations

3.0.4 • Public • Published

npm version

node-signal-processing

Object-oriented algorithms for digital signal processing.

Table of Contents

Overview

This package contains object-oriented algorithms for digital signal processing.

Installation

Install the package with your preferred package manager, such as:

npm install @neurodevs/node-signal-processing

or:

yarn add @neurodevs/node-signal-processing

Usage

Fft

import { Fft } from '@neurodevs/node-signal-processing'

function runFftForwardAndInverse() {
    const signal = [1, 2, 3, 4]

    const fft = Fft.Create({ radix: signal.length })
    const frequencies = fft.forward(signal)
    const original = fft.inverse(frequencies)
}

FirBandpassFilter

import { FirBandpassFilter } from '@neurodevs/node-signal-processing'

function filterLowAndHighFrequenciesFromPpgSignal() {

    const rawPpgSignal: number[] = [...]

    const filter = FirBandpassFilter.Create({
        sampleRate: 64,       // PPG sample rate
        lowCutoffHz: 0.4,     // Filter under 24 bpm heart rate
        highCutoffHz: 4.0,    // Filter over 240 bpm heart rate
        numTaps: 4 * 64 + 1,  // Heuristic: 4 * sampleRate + 1
        attenuation: 50       // Frequencies outside bandpass reduced by 50 dB
    })

    const filteredPpgSignal = filter.run(rawPpgSignal)
}

HilbertPeakDetector

import { HilbertPeakDetector } from '@neurodevs/node-signal-processing'

function detectPpgPeaksFromFilteredSignal() {
    const filteredPpgSignal: number[] = [...]  // See FirBandpassFilter example
    const timestamps: number[] = [...]         // Must be same length as filteredPpgSignal

    const detector = HilbertPeakDetector.Create()
    const results = detector.run(filteredPpgSignal, timestamps)
}

HilbertTransformer

import { HilbertTransformer } from '@neurodevs/node-signal-processing'

function calculateAnalyticSignalAndEnvelopeFromSignal() {
    const signal = [1, 2, 3, 4]

    const transformer = HilbertTransformer.Create()
    const { analyticSignal, envelope } = transformer.run(signal)
}

Readme

Keywords

none

Package Sidebar

Install

npm i @neurodevs/node-signal-processing

Weekly Downloads

50

Version

3.0.4

License

none

Unpacked Size

185 kB

Total Files

124

Last publish

Collaborators

  • ericthecurious