@onda-lang/wasm-compiler 0.8.19 → 0.8.21
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 +4 -2
- package/api.md +12 -1
- package/bin/onda-wasm.js +3 -3
- package/dist/build.json +3 -3
- package/dist/frontend/onda_compiler_web.d.ts +6 -0
- package/dist/frontend/onda_compiler_web.js +17 -0
- package/dist/frontend/onda_compiler_web_bg.wasm +0 -0
- package/dist/frontend/onda_compiler_web_bg.wasm.d.ts +1 -0
- package/dist/frontend/package.json +1 -1
- package/dist/licenses/RUST-DEPENDENCIES.txt +8 -8
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/src/config.js +2 -0
- package/src/index.js +2 -2
package/README.md
CHANGED
|
@@ -6,13 +6,15 @@ See [api.md](api.md) for the complete public Web API shared with the released pa
|
|
|
6
6
|
self-contained WebAssembly processor artifact. It runs in modern browsers and Node.js and does not
|
|
7
7
|
require LLVM, a Wasm linker, Rust, or `wasm-pack` after installation.
|
|
8
8
|
|
|
9
|
+
Compilation defaults to 48000 Hz and 512 frames per block.
|
|
10
|
+
|
|
9
11
|
```js
|
|
10
12
|
import { createCompiler } from "@onda-lang/wasm-compiler";
|
|
11
13
|
|
|
12
14
|
const compiler = await createCompiler();
|
|
13
15
|
const { artifact, sourceFiles } = await compiler.compileSource(source, {
|
|
14
16
|
sampleRate: 48_000,
|
|
15
|
-
blockSize:
|
|
17
|
+
blockSize: 512,
|
|
16
18
|
});
|
|
17
19
|
|
|
18
20
|
console.log(artifact.wasm, artifact.metadata, sourceFiles);
|
|
@@ -83,7 +85,7 @@ const { artifact, sourceFiles } = await compiler.compileWorkspace({
|
|
|
83
85
|
},
|
|
84
86
|
}, {
|
|
85
87
|
sampleRate: 48_000,
|
|
86
|
-
blockSize:
|
|
88
|
+
blockSize: 512,
|
|
87
89
|
});
|
|
88
90
|
|
|
89
91
|
// Entry first, then transitive imports/includes. Embedded stdlib is excluded.
|
package/api.md
CHANGED
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
const compiler = await createCompiler();
|
|
31
31
|
const { artifact } = await compiler.compileSource(source, {
|
|
32
32
|
sampleRate: audioContext.sampleRate,
|
|
33
|
-
blockSize:
|
|
33
|
+
blockSize: 512,
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
const print = ({ text }) => console.debug(text);
|
|
@@ -78,6 +78,7 @@ The returned instance provides:
|
|
|
78
78
|
- `dispose()`, an idempotent terminal release of compiler and worker resources.
|
|
79
79
|
|
|
80
80
|
Compile options accept `sampleRate`, `blockSize`, typed compile-constant overrides, and `codegen`.
|
|
81
|
+
The sample rate defaults to 48000 Hz and the block size to 512 frames.
|
|
81
82
|
Code generation can select optimization level `0..4`, shrink level `0..2`, strict or fast math,
|
|
82
83
|
SIMD, loop-containing inlining, and optional WAT emission. A successful compilation returns an
|
|
83
84
|
`OndaCompilationResult` containing the artifact, resolved source paths, and the exact source graph
|
|
@@ -206,12 +207,22 @@ the artifact metadata as the adapter constructor's second argument and
|
|
|
206
207
|
`processorOptions.executionOutputRing` as its fourth argument. Event encoding and numeric
|
|
207
208
|
unknown-index classification require that metadata.
|
|
208
209
|
|
|
210
|
+
`paramSmoothingSeconds` is an optional **host** setting on `OndaAudioProcessorOptions`, defaulting
|
|
211
|
+
to `0`. It applies finite linear ramps to continuous floating-point parameters and array elements;
|
|
212
|
+
integer, boolean, and stepped parameters update directly. Ramps publish once per logical compile
|
|
213
|
+
block, independent of Web Audio callback sizes. Durations round up to host samples and are bypassed
|
|
214
|
+
when they fit within one block. A changed target starts a fresh ramp from the published value;
|
|
215
|
+
repeated writes of the same target keep its deadline. Initial values and reinitialization settle
|
|
216
|
+
immediately, and processor snapshots do not contain the host ramps. The browser playground opts
|
|
217
|
+
into `0.03` seconds (30 ms). These block-level updates do not interpolate inside `sample:`.
|
|
218
|
+
|
|
209
219
|
### `OndaAudioProcessor`
|
|
210
220
|
|
|
211
221
|
The adapter exposes its `node` and validated `metadata`, plus these operations:
|
|
212
222
|
|
|
213
223
|
- `setParam(nameOrIndex, plain)` and `setParamNormalized(nameOrIndex, normalized)` for whole
|
|
214
224
|
parameters.
|
|
225
|
+
- `resetParams()` to restore parameter defaults immediately and cancel host ramps, retaining DSP state.
|
|
215
226
|
- `setParamElement(nameOrIndex, element, plain)` and
|
|
216
227
|
`setParamElementNormalized(nameOrIndex, element, normalized)` for one scalar or fixed-array
|
|
217
228
|
element.
|
package/bin/onda-wasm.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
createCompiler,
|
|
10
10
|
createProcessorArtifactFiles,
|
|
11
11
|
} from "../src/index.js";
|
|
12
|
-
import { MAX_BLOCK_SIZE } from "../src/config.js";
|
|
12
|
+
import { DEFAULT_BLOCK_SIZE, MAX_BLOCK_SIZE } from "../src/config.js";
|
|
13
13
|
|
|
14
14
|
const HELP = `Usage:
|
|
15
15
|
onda-wasm compile <input.onda> [options]
|
|
@@ -19,7 +19,7 @@ Options:
|
|
|
19
19
|
--output, -o <file> Output Wasm path (default: <input>.wasm)
|
|
20
20
|
--meta-out <file> Output descriptor path (default: <output>.onda.json)
|
|
21
21
|
--sample-rate <number> Compile-time sample rate (default: 48000)
|
|
22
|
-
--block-size <integer> Compile-time block size (default:
|
|
22
|
+
--block-size <integer> Compile-time block size (default: ${DEFAULT_BLOCK_SIZE})
|
|
23
23
|
--optimize-level <0..4> Binaryen optimization level (default: 4)
|
|
24
24
|
--shrink-level <0..2> Binaryen shrink level (default: 0)
|
|
25
25
|
--fast-math Enable relaxed floating-point rewrites
|
|
@@ -116,7 +116,7 @@ function parseCompileArguments(args) {
|
|
|
116
116
|
output: undefined,
|
|
117
117
|
metaOut: undefined,
|
|
118
118
|
sampleRate: 48_000,
|
|
119
|
-
blockSize:
|
|
119
|
+
blockSize: DEFAULT_BLOCK_SIZE,
|
|
120
120
|
optimizeLevel: 4,
|
|
121
121
|
shrinkLevel: 0,
|
|
122
122
|
fastMath: false,
|
package/dist/build.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"ondaVersion": "0.8.
|
|
2
|
+
"ondaVersion": "0.8.21",
|
|
3
3
|
"binaryenVersion": "130.0.0",
|
|
4
4
|
"frontendPackage": "onda_compiler_web",
|
|
5
5
|
"frontendOptimization": {
|
|
6
6
|
"tool": "wasm-opt",
|
|
7
7
|
"binaryenVersion": "130.0.0",
|
|
8
8
|
"optimizeLevel": 4,
|
|
9
|
-
"inputBytes":
|
|
10
|
-
"outputBytes":
|
|
9
|
+
"inputBytes": 11004225,
|
|
10
|
+
"outputBytes": 7977339
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -104,6 +104,11 @@ export function materialize_project_image(image_bytes: Uint8Array, asset_file_na
|
|
|
104
104
|
|
|
105
105
|
export function mir_schema_version(): number;
|
|
106
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Returns the Onda compiler release version.
|
|
109
|
+
*/
|
|
110
|
+
export function onda_version(): string;
|
|
111
|
+
|
|
107
112
|
export function project_image_format_version(): number;
|
|
108
113
|
|
|
109
114
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
@@ -138,6 +143,7 @@ export interface InitOutput {
|
|
|
138
143
|
readonly inspect_source_workspace_compile_constants: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
|
|
139
144
|
readonly materialize_project_image: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
140
145
|
readonly mir_schema_version: () => number;
|
|
146
|
+
readonly onda_version: () => [number, number];
|
|
141
147
|
readonly ondalsp_handle_message: (a: number, b: number, c: number) => [number, number, number, number];
|
|
142
148
|
readonly ondalsp_new: () => number;
|
|
143
149
|
readonly ondalsp_set_analysis_options: (a: number, b: number, c: number) => [number, number];
|
|
@@ -752,6 +752,23 @@ export function mir_schema_version() {
|
|
|
752
752
|
return ret >>> 0;
|
|
753
753
|
}
|
|
754
754
|
|
|
755
|
+
/**
|
|
756
|
+
* Returns the Onda compiler release version.
|
|
757
|
+
* @returns {string}
|
|
758
|
+
*/
|
|
759
|
+
export function onda_version() {
|
|
760
|
+
let deferred1_0;
|
|
761
|
+
let deferred1_1;
|
|
762
|
+
try {
|
|
763
|
+
const ret = wasm.onda_version();
|
|
764
|
+
deferred1_0 = ret[0];
|
|
765
|
+
deferred1_1 = ret[1];
|
|
766
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
767
|
+
} finally {
|
|
768
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
|
|
755
772
|
/**
|
|
756
773
|
* @returns {number}
|
|
757
774
|
*/
|
|
Binary file
|
|
@@ -29,6 +29,7 @@ export const inspect_source_compile_constants: (a: number, b: number, c: number,
|
|
|
29
29
|
export const inspect_source_workspace_compile_constants: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
|
|
30
30
|
export const materialize_project_image: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
31
31
|
export const mir_schema_version: () => number;
|
|
32
|
+
export const onda_version: () => [number, number];
|
|
32
33
|
export const ondalsp_handle_message: (a: number, b: number, c: number) => [number, number, number, number];
|
|
33
34
|
export const ondalsp_new: () => number;
|
|
34
35
|
export const ondalsp_set_analysis_options: (a: number, b: number, c: number) => [number, number];
|
|
@@ -675,7 +675,7 @@ SOFTWARE.
|
|
|
675
675
|
MIT License (MIT)
|
|
676
676
|
|
|
677
677
|
Used by:
|
|
678
|
-
- onda_compiler_web 0.8.
|
|
678
|
+
- onda_compiler_web 0.8.21 (https://github.com/onda-lang/onda)
|
|
679
679
|
|
|
680
680
|
MIT License
|
|
681
681
|
|
|
@@ -704,13 +704,13 @@ SOFTWARE.
|
|
|
704
704
|
MIT License (MIT)
|
|
705
705
|
|
|
706
706
|
Used by:
|
|
707
|
-
- onda_frontend 0.8.
|
|
708
|
-
- onda_host_protocol 0.8.
|
|
709
|
-
- onda_lsp 0.8.
|
|
710
|
-
- onda_mir 0.8.
|
|
711
|
-
- onda_processor_abi 0.8.
|
|
712
|
-
- onda_project 0.8.
|
|
713
|
-
- onda_semantics 0.8.
|
|
707
|
+
- onda_frontend 0.8.21
|
|
708
|
+
- onda_host_protocol 0.8.21
|
|
709
|
+
- onda_lsp 0.8.21
|
|
710
|
+
- onda_mir 0.8.21
|
|
711
|
+
- onda_processor_abi 0.8.21
|
|
712
|
+
- onda_project 0.8.21
|
|
713
|
+
- onda_semantics 0.8.21
|
|
714
714
|
|
|
715
715
|
MIT License
|
|
716
716
|
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ONDA_VERSION = "0.8.
|
|
1
|
+
export const ONDA_VERSION = "0.8.21";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onda-lang/wasm-compiler",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Onda source-to-WebAssembly compiler for browsers and Node.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"prepack": "npm run build && node ../../scripts/stage-web-api-docs.mjs"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@onda-lang/processor-abi": "0.8.
|
|
63
|
+
"@onda-lang/processor-abi": "0.8.21",
|
|
64
64
|
"binaryen": "130.0.0"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
package/src/config.js
CHANGED
package/src/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import { SUPPORTED_MIR_SCHEMA_VERSION } from "../dist/backend/constants.js";
|
|
|
24
24
|
import { OndaBinaryenError } from "../dist/backend/errors.js";
|
|
25
25
|
import { defaultFrontendInput } from "#onda-frontend-loader";
|
|
26
26
|
import { ONDA_VERSION } from "../dist/version.js";
|
|
27
|
-
import { MAX_BLOCK_SIZE } from "./config.js";
|
|
27
|
+
import { DEFAULT_BLOCK_SIZE, MAX_BLOCK_SIZE } from "./config.js";
|
|
28
28
|
|
|
29
29
|
export const MIR_SCHEMA_VERSION = SUPPORTED_MIR_SCHEMA_VERSION;
|
|
30
30
|
export { ONDA_VERSION };
|
|
@@ -656,7 +656,7 @@ function normalizeContextOptions(options) {
|
|
|
656
656
|
throw configurationError("compiler options must be an object");
|
|
657
657
|
}
|
|
658
658
|
const sampleRate = options.sampleRate ?? 48_000;
|
|
659
|
-
const blockSize = options.blockSize ??
|
|
659
|
+
const blockSize = options.blockSize ?? DEFAULT_BLOCK_SIZE;
|
|
660
660
|
if (typeof sampleRate !== "number" || !Number.isFinite(sampleRate) || sampleRate <= 0) {
|
|
661
661
|
throw configurationError("sampleRate must be finite and greater than zero");
|
|
662
662
|
}
|