shamadee / web-dsp Goto Github PK
View Code? Open in Web Editor NEWA client-side signal processing library utilizing the power of WebAssembly (.wasm)
Home Page: http://tiny.cc/webdsp
License: MIT License
A client-side signal processing library utilizing the power of WebAssembly (.wasm)
Home Page: http://tiny.cc/webdsp
License: MIT License
In which license the source code is released?
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.
See https://github.com/dyne/frei0r
Let me know if interesting I'm glad to help (but my knowledge of javascript is limited).
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);
})();
});
The URL, listed for this project, http://tiny.cc/webdsp links to a affiliate (scam) page about purchasing"best" products.
I assume that's wrong, isn't?
.
Would be great to add some simple examples to the repo. Feel free to close if this is not something you're interested in.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.