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

spectrogram-drawer

v1.3.5

Published

Spectrogram drawer for heart, lung and bowel sounds

Downloads

37

Readme

Spectrogram Drawer

Spectrogram drawer for heart, lung and bowel sounds

Install the NPM Module

npm i spectrogram-drawer --save

Usage

1. Import AudioEngine

import AudioEngine from 'spectrogram-drawer';

2. Add Canvas to View:

    <canvas id="canvasID"></canvas>

3. Initialize:

    this.audioEngine = await new AudioEngine.default().initAudioEngine('canvasID', 'YOUR_SDK_KEY');
    let constraints = { audio: true }
    navigator.mediaDevices.getUserMedia(constraints)
      .then(async (stream) => {
        this.audioContext = new AudioContext();
        await this.audioEngine.startIt(false);
        this.audioEngine.loadOpusDecoder();
      })

Config:

  • mode: 'HEART' | 'LUNG'
  • gain for HEART: minimum 1 to maximum 3
  • gain for LUNG: minimum 1 to maximum 20

4. Send Audio input

Load Audio files
    const audioContext = new AudioContext();
    fetch('audio.wav')
    .then(response => response.arrayBuffer())
    .then(arrayBuffer => audioContext.decodeAudioData(arrayBuffer))
    .then(audioBuffer => {
        this.audioEngine.testAudioInput(audioBuffer.getChannelData(0));
    });
Live input stream with getUserMedia.
    navigator.mediaDevices.getUserMedia({audio: true})
        .then((stream) => {
          const context = new AudioContext({sampleRate: 16000});
            const source = context.createMediaStreamSource(stream);
            const processor = context.createScriptProcessor(1024, 1, 1);
        
            source.connect(processor);
            processor.connect(context.destination);
        
            processor.onaudioprocess = (e) => {
              this.audioEngine.testAudioInput(e.inputBuffer.getChannelData(0));
            };
        });

Properties

1. Pause
this.audioEngine.pause();
2. Stop
this.audioEngine.stop();
3. Resume
this.audioEngine.resume();
4. Change Playback Speed
this.audioEngine.playbackSpeedChange(speed); // speed [0.25, 0.5, 0.75, 1, 1.25, 1.50, 1.75, 2]
5. Disable Auto Gain and Noise Filters
this.audioEngine.setAutoGainFlag(false); // By default, the gain is enabled
this.audioEngine.setFilterFlag(false); // By default, the filter is enabled
NOTE: We are supporting 5 canvases to be displayed at the same time in a screen