Coder Social home page Coder Social logo

shamadee / web-dsp Goto Github PK

View Code? Open in Web Editor NEW
1.5K 66.0 113.0 914 KB

A client-side signal processing library utilizing the power of WebAssembly (.wasm)

Home Page: http://tiny.cc/webdsp

License: MIT License

Shell 0.16% C++ 94.83% JavaScript 4.95% Batchfile 0.06%
webassembly wasm dsp

web-dsp's People

Contributors

krzysztof-grzybek avatar matzewagner avatar sdeep27 avatar shahrodkh 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  avatar  avatar  avatar  avatar

web-dsp's Issues

what does glue code do?

The repo is great, but there some code inside I don't understand.

There is a global variable -- Module. However, the glue code is like a black box, how do i know what .wasm exposed. Yes, I could get some exposed fn using WebAssembly.Module.exports/imports, but in this glue code, I should need to do this by Module.ccall.

so, how can get information from glue code? like:

wam['grayScale'] = function (pixelData) {
              const len = pixelData.length
              const mem = _malloc(len); // get the memory of wasm
              HEAPU8.set(pixelData, mem); // transfer the pixelData
              _grayScale(mem, len); // trigger the grayScale fun
              const filtered = HEAPU8.subarray(mem, mem + len); // get the resulted data
              _free(mem); // release memory
              return filtered; // return buffer
            };

where could I find some explanation of the above code, like HEAPU8, or _free.

I feel a little confused.

No error, but still not working...

I have this code, can you explain why this doesn't show any result?

    var c = document.getElementById("c2");
    var ctx = c.getContext("2d");

    // Create gradient
    var grd = ctx.createLinearGradient(0, 0, 200, 0);
    grd.addColorStop(0, "red");
    grd.addColorStop(1, "white");

    // Fill with gradient
    ctx.fillStyle = grd;
    ctx.fillRect(10, 10, 150, 80);
         /*webassembly*/
        let wam;
        loadWASM()
          .then(module => {
            wam = module;
        }).catch((err) => {
          console.log('Error in fetching module: ', err);
        }).then(() => {
            window.onload = (() => {
                var pixels = ctx.getImageData(0, 0, 400, 300);
                //console.log(pixels);
                var xx = pixels.data.set(wam.goodMorning(pixels.data, 400, 300));
                //var xx = wam.goodMorning(pixels.data, 400, 300);
                //console.log(xx);
                pixels.data.set(xx);
            })();
        });

Examples

Would be great to add some simple examples to the repo. Feel free to close if this is not something you're interested in.

webassembly is slower than javascript

I have seen a nice video which was talking about performance of web-assembly, but running your example
the javascript is playing with similar speed, but on the graph it has been shown that the wasm is -97% is faster than javascript.

https://youtu.be/6v4E6oksar0?t=1796

my green line is showing 2.3, and my blue line is showing 400-500

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.