@mimium/mimium-webaudio 4.0.0 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Readme.md CHANGED
@@ -6,4 +6,74 @@ https://mimium.org
6
6
 
7
7
  The main entrypoint of compiler on web platform is [`mimium-web`](https://www.npmjs.com/package/mimium-web), which is directory exported from Rust code using wasm-pack.
8
8
 
9
- The reason to split package for audioworklet module is because wasm-pack is not fully compatible with WebAudio AudioWorklet and need to write some wrapper code to load wasm modules.
9
+ The reason to split package for audioworklet module is because wasm-pack is not fully compatible with WebAudio AudioWorklet and need to write some wrapper code to load wasm modules.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install @mimium/mimium-webaudio
15
+ ```
16
+
17
+ ## Basic usage
18
+
19
+ ```ts
20
+ import {
21
+ preloadMimiumLibCache,
22
+ setupMimiumAudioWorklet,
23
+ } from "@mimium/mimium-webaudio";
24
+ import processorUrl from "@mimium/mimium-webaudio/dist/audioprocessor.mjs?url";
25
+
26
+ const ctx = new AudioContext();
27
+
28
+ const src = `
29
+ fn dsp(){
30
+ 0.0
31
+ }
32
+ `;
33
+
34
+ await preloadMimiumLibCache({
35
+ libBaseUrl: "https://raw.githubusercontent.com/mimium-org/mimium-rs/dev/lib/",
36
+ });
37
+
38
+ const node = await setupMimiumAudioWorklet(ctx, src, processorUrl);
39
+ node.connect(ctx.destination);
40
+ ```
41
+
42
+ `setupMimiumAudioWorklet` returns `MimiumProcessorNode` (`AudioWorkletNode`).
43
+
44
+ ## API
45
+
46
+ ```ts
47
+ preloadMimiumLibCache(options?: {
48
+ libBaseUrl?: string;
49
+ }): Promise<void>
50
+
51
+ setupMimiumAudioWorklet(
52
+ ctx: AudioContext,
53
+ src: string,
54
+ MimiumProcessorUrl: string,
55
+ options?: {
56
+ libBaseUrl?: string;
57
+ moduleBaseUrl?: string;
58
+ }
59
+ ): Promise<MimiumProcessorNode>
60
+ ```
61
+
62
+ - `libBaseUrl`: Base URL for standard mimium libraries (default: `https://raw.githubusercontent.com/mimium-org/mimium-rs/dev/lib/`).
63
+ - `moduleBaseUrl`: Base URL for user modules resolved by `mod` / `include` (default: current page base URL).
64
+
65
+ For code that uses standard library modules (`use osc::sinwave`, etc.), calling `preloadMimiumLibCache` before `setupMimiumAudioWorklet` is recommended.
66
+
67
+ ## Notes
68
+
69
+ - Compilation and library/module fetch are done on the main thread.
70
+ - AudioWorklet uses preloaded virtual file cache and does not fetch files directly.
71
+
72
+ ## Testing (Playwright)
73
+
74
+ ```bash
75
+ npx playwright install chromium
76
+ npx playwright test tests/compile.spec.ts
77
+ ```
78
+
79
+ This test opens a browser page, creates `AudioContext` + `AudioWorklet`, compiles a mimium source, and verifies compile completion.
@@ -0,0 +1,14 @@
1
+ import { Context } from 'mimium-web';
2
+ export declare class MimiumProcessor extends AudioWorkletProcessor {
3
+ context: Context | null;
4
+ isCompiled: boolean;
5
+ interleaved_input: Float32Array;
6
+ interleaved_output: Float32Array;
7
+ constructor();
8
+ onmessage(event: MessageEvent<any>): void;
9
+ compile(samplerate: number, buffersize: number, src: string, moduleBaseUrl?: string, libBaseUrl?: string, virtualFiles?: Array<{
10
+ path: string;
11
+ content: string;
12
+ }>): Promise<void>;
13
+ process(inputs: Float32Array[][], outputs: Float32Array[][], parameter: Record<string, Float32Array>): boolean;
14
+ }
@@ -0,0 +1,142 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import "./textencoder-B0AgIAQT.js";
5
+ import { initSync as g, Config as f, Context as y } from "./mimium_web-DPSIpWn3.js";
6
+ const d = [
7
+ "core.mmm",
8
+ "delay.mmm",
9
+ "env.mmm",
10
+ "filter.mmm",
11
+ "math.mmm",
12
+ "noise.mmm",
13
+ "osc.mmm",
14
+ "reactive.mmm",
15
+ "reverb.mmm"
16
+ ];
17
+ function _(n) {
18
+ return n.replace(/\\/g, "/").replace(/^\.\//, "").replace(/^\//, "");
19
+ }
20
+ function w(n) {
21
+ const s = _(n).replace(/^lib\//, "");
22
+ return [.../* @__PURE__ */ new Set([n, s, `./${s}`, `lib/${s}`, `/lib/${s}`])];
23
+ }
24
+ class b extends AudioWorkletProcessor {
25
+ constructor() {
26
+ super();
27
+ __publicField(this, "context");
28
+ __publicField(this, "isCompiled");
29
+ __publicField(this, "interleaved_input", new Float32Array());
30
+ __publicField(this, "interleaved_output", new Float32Array());
31
+ this.context = null, this.isCompiled = false, this.port.onmessage = (e) => {
32
+ this.onmessage(e.data);
33
+ };
34
+ }
35
+ onmessage(e) {
36
+ switch (console.log("onmessage ", e), e.type) {
37
+ case "send-wasm-module": {
38
+ console.log("start_loading");
39
+ const s = e.data;
40
+ WebAssembly.compile(s).then((r) => {
41
+ g({ module: r }), console.log("wasm module loaded,sending message"), this.port.postMessage({ type: "wasm-module-loaded" });
42
+ }).catch((r) => {
43
+ console.error("wasm module load error, ", r), this.port.postMessage({ type: "error_wasm_load", data: r });
44
+ });
45
+ break;
46
+ }
47
+ case "compile":
48
+ this.compile(
49
+ e.data.samplerate,
50
+ e.data.buffersize,
51
+ e.data.src,
52
+ e.data.moduleBaseUrl,
53
+ e.data.libBaseUrl,
54
+ e.data.virtualFiles
55
+ );
56
+ break;
57
+ }
58
+ }
59
+ async compile(e, s, r, m = "", p = "https://raw.githubusercontent.com/mimium-org/mimium-rs/dev/lib/", c = []) {
60
+ this.isCompiled = false, this.context = null, this.interleaved_input = new Float32Array(), this.interleaved_output = new Float32Array();
61
+ let l = f.new();
62
+ l.sample_rate = e, l.buffer_size = s;
63
+ const t = new y(l);
64
+ let a = {
65
+ type: "compile_error",
66
+ data: { message: "compile did not complete." }
67
+ };
68
+ try {
69
+ m && t.set_module_base_url(m);
70
+ const i = new Set(
71
+ c.map((o) => _(o.path).replace(/^lib\//, ""))
72
+ );
73
+ if (!d.every(
74
+ (o) => i.has(o)
75
+ )) {
76
+ const o = d.filter((u) => !i.has(u));
77
+ throw new Error(
78
+ `virtual lib cache is incomplete. missing=[${o.join(", ")}]. worklet does not fetch libs; preload on main thread is required. baseUrl=${p}`
79
+ );
80
+ }
81
+ c.forEach((o) => {
82
+ w(o.path).forEach((u) => {
83
+ t.put_virtual_file_cache(u, o.content);
84
+ });
85
+ }), t.compile_direct(r);
86
+ const h = t.get_output_channels() || 0;
87
+ if (h <= 0) {
88
+ this.context = null, this.isCompiled = false, this.interleaved_input = new Float32Array(), this.interleaved_output = new Float32Array(), a = {
89
+ type: "compile_error",
90
+ data: { message: "compile failed: compile finished with zero output channels." }
91
+ };
92
+ return;
93
+ }
94
+ this.interleaved_input = new Float32Array(
95
+ s * t.get_input_channels()
96
+ ), this.interleaved_output = new Float32Array(
97
+ s * h
98
+ ), this.context = t, this.isCompiled = true, a = {
99
+ type: "compile_finished",
100
+ data: { output_channels: h }
101
+ };
102
+ } catch (i) {
103
+ this.context = null, this.isCompiled = false, this.interleaved_input = new Float32Array(), this.interleaved_output = new Float32Array(), a = {
104
+ type: "compile_error",
105
+ data: {
106
+ message: `compile failed: ${i instanceof Error ? i.message : String(i)}`
107
+ }
108
+ };
109
+ } finally {
110
+ this.port.postMessage(a);
111
+ }
112
+ }
113
+ process(e, s, r) {
114
+ var _a, _b2;
115
+ if (this.context && this.isCompiled) {
116
+ const m = this.context.get_input_channels(), p = this.context.get_output_channels(), c = e[0], l = s[0];
117
+ if (this.interleaved_input.length !== (((_a = c == null ? void 0 : c[0]) == null ? void 0 : _a.length) ?? 0) * m || this.interleaved_output.length !== (((_b2 = l == null ? void 0 : l[0]) == null ? void 0 : _b2.length) ?? 0) * p)
118
+ return true;
119
+ c.forEach((t, a) => {
120
+ for (let i = 0; i < t.length; i++)
121
+ this.interleaved_input[m * i + a] = t[i];
122
+ }), this.interleaved_output.fill(0);
123
+ try {
124
+ this.context.process(this.interleaved_input, this.interleaved_output);
125
+ } catch (t) {
126
+ return this.context = null, this.isCompiled = false, this.port.postMessage({
127
+ type: "runtime_error",
128
+ data: { message: t instanceof Error ? t.message : String(t) }
129
+ }), true;
130
+ }
131
+ l.forEach((t, a) => {
132
+ for (let i = 0; i < t.length; i++)
133
+ t[i] = this.interleaved_output[p * i + a];
134
+ });
135
+ }
136
+ return true;
137
+ }
138
+ }
139
+ registerProcessor("MimiumProcessor", b);
140
+ export {
141
+ b as MimiumProcessor
142
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audioprocessor.mjs","sources":["../src/audioprocessor.mts"],"sourcesContent":["import \"./textencoder.mjs\";\nimport { initSync, Context, Config } from \"mimium-web\";\n\nconst STANDARD_LIB_FILES = [\n \"core.mmm\",\n \"delay.mmm\",\n \"env.mmm\",\n \"filter.mmm\",\n \"math.mmm\",\n \"noise.mmm\",\n \"osc.mmm\",\n \"reactive.mmm\",\n \"reverb.mmm\",\n];\n\nfunction normalizeVirtualPath(path: string): string {\n return path.replace(/\\\\/g, \"/\").replace(/^\\.\\//, \"\").replace(/^\\//, \"\");\n}\n\nfunction expandVirtualPathAliases(path: string): string[] {\n const normalized = normalizeVirtualPath(path);\n const strippedLib = normalized.replace(/^lib\\//, \"\");\n return [...new Set([path, strippedLib, `./${strippedLib}`, `lib/${strippedLib}`, `/lib/${strippedLib}`])];\n}\n\nexport class MimiumProcessor extends AudioWorkletProcessor {\n context: Context | null;\n isCompiled: boolean;\n interleaved_input: Float32Array = new Float32Array();\n interleaved_output: Float32Array = new Float32Array();\n\n constructor() {\n super();\n this.context = null;\n this.isCompiled = false;\n this.port.onmessage = (event) => {\n this.onmessage(event.data);\n };\n }\n onmessage(event: MessageEvent<any>) {\n console.log(\"onmessage \", event);\n switch (event.type) {\n case \"send-wasm-module\": {\n console.log(\"start_loading\");\n const wasmBinary = event.data as ArrayBuffer; //this is invalid conversion for workaround.\n WebAssembly.compile(wasmBinary)\n .then((wasm) => {\n initSync({ module: wasm });\n console.log(\"wasm module loaded,sending message\");\n this.port.postMessage({ type: \"wasm-module-loaded\" });\n })\n .catch((e) => {\n console.error(\"wasm module load error, \", e);\n this.port.postMessage({ type: \"error_wasm_load\", data: e });\n });\n\n break;\n }\n case \"compile\":\n void this.compile(\n event.data.samplerate,\n event.data.buffersize,\n event.data.src,\n event.data.moduleBaseUrl,\n event.data.libBaseUrl,\n event.data.virtualFiles\n );\n break;\n }\n }\n public async compile(\n samplerate: number,\n buffersize: number,\n src: string,\n moduleBaseUrl: string = \"\",\n libBaseUrl: string = \"https://raw.githubusercontent.com/mimium-org/mimium-rs/dev/lib/\",\n virtualFiles: Array<{ path: string; content: string }> = []\n ) {\n this.isCompiled = false;\n this.context = null;\n this.interleaved_input = new Float32Array();\n this.interleaved_output = new Float32Array();\n\n let config = Config.new();\n config.sample_rate = samplerate;\n config.buffer_size = buffersize;\n const nextContext = new Context(config); //io channel is written in context.vonfig\n\n let compileMessage: {\n type: \"compile_finished\" | \"compile_error\";\n data: { output_channels?: number; message?: string };\n } = {\n type: \"compile_error\",\n data: { message: \"compile did not complete.\" },\n };\n\n try {\n if (moduleBaseUrl) {\n nextContext.set_module_base_url(moduleBaseUrl);\n }\n const virtualFileNames = new Set(\n virtualFiles.map((file) => normalizeVirtualPath(file.path).replace(/^lib\\//, \"\"))\n );\n const hasStdLibVirtualFiles = STANDARD_LIB_FILES.every((libFile) =>\n virtualFileNames.has(libFile)\n );\n\n if (!hasStdLibVirtualFiles) {\n const missing = STANDARD_LIB_FILES.filter((libFile) => !virtualFileNames.has(libFile));\n throw new Error(\n `virtual lib cache is incomplete. missing=[${missing.join(\", \")}]. worklet does not fetch libs; preload on main thread is required. baseUrl=${libBaseUrl}`\n );\n }\n\n virtualFiles.forEach((file) => {\n expandVirtualPathAliases(file.path).forEach((alias) => {\n nextContext.put_virtual_file_cache(alias, file.content);\n });\n });\n nextContext.compile_direct(src);\n\n const outputChannels = nextContext.get_output_channels() || 0;\n if (outputChannels <= 0) {\n this.context = null;\n this.isCompiled = false;\n this.interleaved_input = new Float32Array();\n this.interleaved_output = new Float32Array();\n compileMessage = {\n type: \"compile_error\",\n data: { message: \"compile failed: compile finished with zero output channels.\" },\n };\n return;\n }\n\n this.interleaved_input = new Float32Array(\n buffersize * nextContext.get_input_channels()\n );\n this.interleaved_output = new Float32Array(\n buffersize * outputChannels\n );\n this.context = nextContext;\n this.isCompiled = true;\n\n compileMessage = {\n type: \"compile_finished\",\n data: { output_channels: outputChannels },\n };\n } catch (e) {\n this.context = null;\n this.isCompiled = false;\n this.interleaved_input = new Float32Array();\n this.interleaved_output = new Float32Array();\n\n compileMessage = {\n type: \"compile_error\",\n data: {\n message: `compile failed: ${e instanceof Error ? e.message : String(e)}`,\n },\n };\n } finally {\n this.port.postMessage(compileMessage);\n }\n }\n public process(\n inputs: Float32Array[][],\n outputs: Float32Array[][],\n parameter: Record<string, Float32Array>\n ) {\n if (this.context && this.isCompiled) {\n const ichannels = this.context.get_input_channels();\n const ochannels = this.context.get_output_channels();\n const input = inputs[0];\n const output = outputs[0];\n if (\n this.interleaved_input.length !== (input?.[0]?.length ?? 0) * ichannels ||\n this.interleaved_output.length !== (output?.[0]?.length ?? 0) * ochannels\n ) {\n return true;\n }\n input.forEach((input, ich) => {\n for (let i = 0; i < input.length; i++) {\n this.interleaved_input[ichannels * i + ich] = input[i];\n }\n });\n this.interleaved_output.fill(0);\n try {\n this.context.process(this.interleaved_input, this.interleaved_output);\n } catch (e) {\n this.context = null;\n this.isCompiled = false;\n this.port.postMessage({\n type: \"runtime_error\",\n data: { message: e instanceof Error ? e.message : String(e) },\n });\n return true;\n }\n output.forEach((output, och) => {\n for (let i = 0; i < output.length; i++) {\n output[i] = this.interleaved_output[ochannels * i + och];\n }\n });\n }\n return true;\n }\n}\n\nregisterProcessor(\"MimiumProcessor\", MimiumProcessor);\n"],"names":["STANDARD_LIB_FILES","normalizeVirtualPath","path","expandVirtualPathAliases","strippedLib","MimiumProcessor","event","wasmBinary","wasm","initSync","e","samplerate","buffersize","src","moduleBaseUrl","libBaseUrl","virtualFiles","config","Config","nextContext","Context","compileMessage","virtualFileNames","file","libFile","missing","alias","outputChannels","inputs","outputs","parameter","ichannels","ochannels","input","output","ich","och"],"mappings":";;AAGA,MAAMA,IAAqB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAASC,EAAqBC,GAAsB;AAClD,SAAOA,EAAK,QAAQ,OAAO,GAAG,EAAE,QAAQ,SAAS,EAAE,EAAE,QAAQ,OAAO,EAAE;AACxE;AAEA,SAASC,EAAyBD,GAAwB;AAExD,QAAME,IADaH,EAAqBC,CAAI,EACb,QAAQ,UAAU,EAAE;AACnD,SAAO,CAAC,GAAG,oBAAI,IAAI,CAACA,GAAME,GAAa,KAAKA,CAAW,IAAI,OAAOA,CAAW,IAAI,QAAQA,CAAW,EAAE,CAAC,CAAC;AAC1G;AAEO,MAAMC,UAAwB,sBAAsB;AAAA,EACzD;AAAA,EACA;AAAA,EACA,oBAAkC,IAAI,aAAA;AAAA,EACtC,qBAAmC,IAAI,aAAA;AAAA,EAEvC,cAAc;AACZ,UAAA,GACA,KAAK,UAAU,MACf,KAAK,aAAa,IAClB,KAAK,KAAK,YAAY,CAACC,MAAU;AAC/B,WAAK,UAAUA,EAAM,IAAI;AAAA,IAC3B;AAAA,EACF;AAAA,EACA,UAAUA,GAA0B;AAElC,YADA,QAAQ,IAAI,cAAcA,CAAK,GACvBA,EAAM,MAAA;AAAA,MACZ,KAAK,oBAAoB;AACvB,gBAAQ,IAAI,eAAe;AAC3B,cAAMC,IAAaD,EAAM;AACzB,oBAAY,QAAQC,CAAU,EAC3B,KAAK,CAACC,MAAS;AACd,UAAAC,EAAS,EAAE,QAAQD,GAAM,GACzB,QAAQ,IAAI,oCAAoC,GAChD,KAAK,KAAK,YAAY,EAAE,MAAM,sBAAsB;AAAA,QACtD,CAAC,EACA,M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AAO,CAAC,GAChBM,IAASL,EAAQ,CAAC;AACxB,UACE,KAAK,kBAAkB,YAAYI,IAAQ,CAAC,GAAG,UAAU,KAAKF,KAC9D,KAAK,mBAAmB,YAAYG,IAAS,CAAC,GAAG,UAAU,KAAKF;AAEhE,eAAO;AAET,MAAAC,EAAM,QAAQ,CAACA,GAAOE,MAAQ;AAC5B,iBAAS,IAAI,GAAG,IAAIF,EAAM,QAAQ;AAChC,eAAK,kBAAkBF,IAAY,IAAII,CAAG,IAAIF,EAAM,CAAC;AAAA,MAEzD,CAAC,GACD,KAAK,mBAAmB,KAAK,CAAC;AAC9B,UAAI;AACF,aAAK,QAAQ,QAAQ,KAAK,mBAAmB,KAAK,kBAAkB;AAAA,MACtE,SAASvB,GAAG;AACV,oBAAK,UAAU,MACf,KAAK,aAAa,IAClB,KAAK,KAAK,YAAY;AAAA,UACpB,MAAM;AAAA,UACN,MAAM,EAAE,SAASA,aAAa,QAAQA,EAAE,UAAU,OAAOA,CAAC,EAAA;AAAA,QAAE,CAC7D,GACM;AAAA,MACT;AACA,MAAAwB,EAAO,QAAQ,CAACA,GAAQE,MAAQ;AAC9B,iBAAS,IAAI,GAAG,IAAIF,EAAO,QAAQ;AACjCA,UAAAA,EAAO,CAAC,IAAI,KAAK,mBAAmBF,IAAY,IAAII,CAAG;AAAA,MAE3D,CAAC;AAAA,IACH;AACA,WAAO;AAAA,EACT;AACF;AAEA,kBAAkB,mBAAmB/B,CAAe;"}
@@ -0,0 +1,9 @@
1
+ import { MimiumProcessorNode } from './workletnode.ts';
2
+ export type { MimiumProcessorNode };
3
+ export type { CompileData } from './workletnode.ts';
4
+ type SetupOptions = {
5
+ libBaseUrl?: string;
6
+ moduleBaseUrl?: string;
7
+ };
8
+ export declare function preloadMimiumLibCache(options?: Pick<SetupOptions, "libBaseUrl">): Promise<void>;
9
+ export declare function setupMimiumAudioWorklet(ctx: AudioContext, src: string, MimiumProcessorUrl: string, options?: SetupOptions): Promise<MimiumProcessorNode>;