mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-26 00:44:47 -04:00
wasm-music
This commit is contained in:
committed by
Peter Salomonsen
parent
70080c2b9d
commit
1ca16043bc
15
testwasm.mjs
Normal file
15
testwasm.mjs
Normal file
@ -0,0 +1,15 @@
|
||||
import { readFile, writeFile } from 'fs/promises';
|
||||
|
||||
const wasm = (await readFile('./chords.wasm'));
|
||||
|
||||
const mod = await WebAssembly.instantiate(wasm, {
|
||||
m: {
|
||||
pow: Math.pow,
|
||||
log2: Math.log2,
|
||||
sin: Math.sin
|
||||
}
|
||||
});
|
||||
|
||||
const mem = mod.instance.exports.m;
|
||||
|
||||
await writeFile('test.raw', new Uint8Array(mem.buffer));
|
Reference in New Issue
Block a user