script for rendering wasm to raw audio file

This commit is contained in:
Peter Salomonsen 2023-04-07 12:09:20 +02:00
parent 03b79dbbde
commit 6078239821
2 changed files with 10 additions and 0 deletions

8
renderwasm.mjs Normal file
View File

@ -0,0 +1,8 @@
import { readFile, writeFile } from 'fs/promises';
const wasm = (await readFile('./temp_song_file.wasm'));
const mod = await WebAssembly.instantiate(wasm, {});
mod.instance.exports.render();
const mem = mod.instance.exports.m;
await writeFile('temp_song_file.raw', new Uint8Array(mem.buffer,mod.instance.exports.s,mod.instance.exports.l));

View File

@ -882,6 +882,8 @@
{{- if .RenderOnStart }}
(start $render) ;; we run render automagically when the module is instantiated
{{- else}}
(export "render" (func $render))
{{- end}}
(func $render (param)