Giter Club home page Giter Club logo

dsp.js's People

Contributors

alexcastillo avatar almeros avatar anandkumarsp avatar corbanbrook avatar jasondavies avatar rikrd avatar spudd86 avatar superusercode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dsp.js's Issues

Can this library be used to analyse ECG data?

Hi there,

I'm looking for a Js library that allows me to analyse ECG data. as in to be able to get few useful information out of ECG data. for example, to be able to calculate RR interval or measure QRS complex.

Is there any way it can be done with this?

TypeError: Constructor Float32Array requires 'new'

Google Chrome 35.0.1916.114

branch:master

1313:  this.f = Float32Array(4);
1719:  var result = Float32Array(buffer.length);
1806:    w = Float32Array(200);
1812:  var result = Float32Array(w.length);
1912:      this.w = Float32Array(400);

DSP.mag2db uses log instead of log10

Is DSP.mag2db meant to be the same as Matlab's mag2db? Matlab uses log10, but the code here uses log. The results seem to be too large, compared to what they normally would be converting voltage gain to db.

Publish to npm

Javascript libraries like this are perfect for publishing to npmjs.org

Make this library portable and easily accessible! All you have to do is add a package.json and push to npm.

How to get this to work nowadays?

I'm getting many kinds of javascript errors on Chrome and Firefox, does anyone know how to get it compatible with today's browser?
Thanks

Bitwise "^ operator" in BiquadFilter?

There are two instance of the "^ operator" in the recalculateCoefficients() function. I think they are being used on floating point values. It's more common to use bitwise operations on Integers. Maybe the "^" were meant to be "Math.pow" instead?

Uncaught RangeError: ArrayBufferView size is not a small enough positive integer.

Hi, on chrome I got this error message and I dont know how to handle it (I am pretty new to new to Javascript). Maybe someone can help) Is audiodata supported in chrome anyway? It all works well in FF:

Uncaught RangeError: ArrayBufferView size is not a small enough positive integer.
FourierTransformdsp.js:247
FFTdsp.js:354
loadedMetadata

Thx
C

Change frequency of sample music

I want to make a project where I have any audio clip in mp3 format. I want to change its sampling frequency, bits/samples. Is there any way to do so

Duplicate code in recalculateCoefficients

Fwiw, this code...

if (type === DSP.PEAKING_EQ || type === DSP.LOW_SHELF || type === DSP.HIGH_SHELF ) {
A = Math.pow(10, (this.dBgain/40)); // for peaking and shelving EQ filters only
} else {
A = Math.sqrt( Math.pow(10, (this.dBgain/20)) );

can probably be replaced with...

A = Math.sqrt( Math.pow(10, (this.dBgain/20)) );

Missing filters

According to the documentation there is a HIGHPASS and a NOTCH filter available as part of this library but in code:

function IIRFilter(type, cutoff, resonance, sampleRate) {
  this.sampleRate = sampleRate;

  switch(type) {
    case DSP.LOWPASS:
    case DSP.LP12:
      this.func = new IIRFilter.LP12(cutoff, resonance, sampleRate);
      break;
  }
}

Am I missing something or there's no HIGHPASS or NOTCH filters implemented?

Alex
cc @teonbrooks

Document filters

Great project, thank you!

Any chance you can document how to use the filters?
I mostly interested in applying a NOTCH filter.

Thanks.

Document window functions

I'd like to apply the Hamming window function before using FFT. However, it is not documented and I do not know how to use it. Could someone please shed some light on this?

Leaky PSD when using sampling rate that is not a power of 2

Just noticed this when debugging problems that arose when moving from an EEG device sampling at 256hz to one at 1000hz.

It seems that the PSD returned by

const fft = new FFT(bins, samplingRate);
        fft.forward(samples);
        return Array.from(fft.spectrum);

Is wrong when the sampling rate of the signal is not a power of 2 (e.g. 256, 1024). With a sampling rate of 1000hz I'm getting PSDs that are far too "leaky" and spread out to represent my test.

I actually don't notice any change in the PSD output at all when I change the samplingRate parameter, which makes me think that the implementation might just be inferring sampling rate from the number of bins? It would explain why it only works when my signal's sampling rate is equal to the number of bins in the FFT

How to use the IIRFilter?

var filter = new IIRFilter(DSP.LOWPASS, cut_fre,fs); filter.process(data);

this is my code,The help document says IIRFilter should be written like this:
var filter = IIRFilter(LOWPASS, 200, 44100); filter.process(signal);

but the code which the help document gave seems wrong ,it warns me that 'LOWPASS' is not defined ,but DSP.LOWPASS is ok,and i noice that IIRFilter actually needs 4 parameters(type,cutoff,resonance,sampleRate).

so how to use IIRFilter??

[enhancement] Add missing bower.json.

Hey, maintainer(s) of corbanbrook/dsp.js!

We at VersionEye are working hard to keep up the quality of the bower's registry.

We just finished our initial analysis of the quality of the Bower.io registry:

7530 - registered packages, 224 of them doesnt exists anymore;

We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).

Sadly, your library corbanbrook/dsp.js is one of them.

Can you spare 15 minutes to help us to make Bower better?

Just add a new file bower.json and change attributes.

{
  "name": "corbanbrook/dsp.js",
  "version": "1.0.0",
  "main": "path/to/main.css",
  "description": "please add it",
  "license": "Eclipse",
  "ignore": [
    ".jshintrc",
    "**/*.txt"
  ],
  "dependencies": {
    "<dependency_name>": "<semantic_version>",
    "<dependency_name>": "<Local_folder>",
    "<dependency_name>": "<package>"
  },
  "devDependencies": {
    "<test-framework-name>": "<version>"
  }
}

Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.

NB! Please validate your bower.json with jsonlint before commiting your updates.

Thank you!

Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!

module not defined

After the latest comit I get an "uncaught referenceerror: module is not defined" when running in the browser. how can I fix it?

grapheq examples and Firefox issue

Hello,
grapheq doesn't work with Firefox.

10:35:53,433 TypeError: calling a builtin typed array constructor without new is forbidden 1 dsp.js:1912:16
GraphicalEq/this.recalculateFreqz file:///{my path}dsp.js-master/dsp.js:1912:16
GraphicalEq/this.recalculateFilters file:///{my path}dsp.js-master/dsp.js:1870:7
setup file:///{my path}dsp.js-master/examples/js/processing.js%20line%2012225%20%3E%20eval:15:9
executeSketch file:///{my path}dsp.js-master/examples/js/processing.js:10939:13
Processing file:///{my path}dsp.js-master/examples/js/processing.js:10959:7
file:///{my path}dsp.js-master/examples/js/init.js:26:11

Invalid RFFT spectrum 0th bin

Hi
I think I found a bug in spectrum calculating part of RFFT algorithm
Lets assume that we have fft_size = 2048
So, we need to fill spectrum from 0 to 1023 with values of 2 / 2048 * sqrt(real_vals[0-1023] * real_vals[0-1023] + imaginary_vals[1024-2047] * imaginary_vals[1024-2047]), right?

Now see lines 812 and 825 of this algorithm

On line 812 cycle iterator i will take values from 1023 to 1. For this reason real_vals[0] and imaginary_vals[2047] will not be affected by the loop.

So we will need to fill 0th spectrum entry after cycle. It happens on line 825 the following way spectrum[0] = bSi * x[0]; (as for now)

I think that it should be done something like this: spectrum[0] = bSi * sqrt(x[0] * x[0] + x[2047] * x[2047]);

I'm not so good at FFTs and algorithms yet, thats why i've opened an issue instead of PR

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.