@scalable-vector-audio/sva-wasm 0.14.20 → 0.14.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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@scalable-vector-audio/sva-wasm",
3
3
  "type": "module",
4
4
  "description": "JS bindings: a composition a page fills node by node, rendered in the browser",
5
- "version": "0.14.20",
5
+ "version": "0.14.21",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
package/sva_wasm.d.ts CHANGED
@@ -1,6 +1,38 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
+ /** A recording passed whole: one Float32Array per channel, at `rate` Hz. */
5
+ export interface Samples {
6
+ samples: { rate: number; channels: Float32Array[] };
7
+ }
8
+ /**
9
+ * One node of a solve's cost; each node holds one key. A number, or a weight vector `[1, 0.5]`;
10
+ * a leaf `{ repr: "bands(prune=1)", target: "@lead([0, 5s])" }`, the reading as `render`'s
11
+ * representations spell it and its target a render expression or a recording passed whole;
12
+ * `{ value }`, a number, a list of numbers or a reading's `data` as `analyze` answers it,
13
+ * checked against the leaf it subtracts from; `add`, `sub`, `mul` and `div` over two or more,
14
+ * left to right; `neg`; the reducers `norm`, `sum`, `max`, `abs`, and `dot: [weights, v]`.
15
+ */
16
+ export type SolveCost =
17
+ | number
18
+ | number[]
19
+ | { repr: string; target: string | Samples }
20
+ | { value: unknown }
21
+ | { add: SolveCost[] } | { sub: SolveCost[] } | { mul: SolveCost[] } | { div: SolveCost[] }
22
+ | { neg: SolveCost }
23
+ | { norm: SolveCost } | { sum: SolveCost } | { max: SolveCost } | { abs: SolveCost }
24
+ | { dot: [number[], SolveCost] };
25
+ /** One variable a solve moves, as `--vary <name>=<lo>..<hi>[/<step>][,log]`. */
26
+ export interface SolveVary {
27
+ name: string;
28
+ lo: string | number;
29
+ hi: string | number;
30
+ step?: string | number;
31
+ log?: boolean;
32
+ }
33
+
34
+
35
+
4
36
  /** What one call did so far, or every call of one composition since its subscriber took it. */
5
37
  export interface EngineWork {
6
38
  /** Samples of the target delivered. */
@@ -166,10 +198,6 @@ export class Composition {
166
198
  * Memory's disk traffic since it opened.
167
199
  */
168
200
  counters(): any;
169
- /**
170
- * What `sample("<path>")` reads: one decoded Float32Array per channel, at `rate`.
171
- */
172
- insertRecording(path: string, rate: number, channels: Array<any>): void;
173
201
  insert(path: string, text: string): void;
174
202
  constructor(name?: string | null);
175
203
  /**
@@ -190,9 +218,11 @@ export class Composition {
190
218
  */
191
219
  render(target: string, representations: string[] | null | undefined, options: any): Promise<Rendering>;
192
220
  /**
193
- * `sva-cli solve`'s envelope; `options` as its flags, `signal` and `progress(line)`.
221
+ * `sva-cli solve`'s envelope. `cost` is a `SolveCost` tree, every reference a value:
222
+ * `{ norm: { sub: [{ repr: "bands", target: "@lead([0, 5s])" }, { value: data }] } }`.
223
+ * `vary`: `SolveVary`s. `options` as the CLI's flags, `signal` and `progress(line)`.
194
224
  */
195
- solve(cost: string, vary: string[], options: any): Promise<any>;
225
+ solve(cost: SolveCost, vary: SolveVary[], options: any): Promise<any>;
196
226
  /**
197
227
  * `target`'s placed notes as `sva-cli outline @score/song` lists them, under
198
228
  * `options.set` as `render` takes it: `{ song, events }`, each with `at`, `sounds`,
@@ -355,13 +385,12 @@ export interface InitOutput {
355
385
  readonly composition_cache_max_bytes: (a: number) => number;
356
386
  readonly composition_counters: (a: number) => [number, number, number];
357
387
  readonly composition_insert: (a: number, b: number, c: number, d: number, e: number) => void;
358
- readonly composition_insertRecording: (a: number, b: number, c: number, d: number, e: any) => [number, number];
359
388
  readonly composition_new: (a: number, b: number) => number;
360
389
  readonly composition_open: (a: number, b: number, c: number, d: any) => any;
361
390
  readonly composition_persist: (a: number) => any;
362
391
  readonly composition_render: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
363
392
  readonly composition_set_cache_max_bytes: (a: number, b: number) => void;
364
- readonly composition_solve: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
393
+ readonly composition_solve: (a: number, b: any, c: any, d: any) => any;
365
394
  readonly composition_song: (a: number, b: number, c: number, d: any) => [number, number, number];
366
395
  readonly composition_store_bytes: (a: number) => [number, number];
367
396
  readonly composition_store_max_bytes: (a: number) => [number, number];
package/sva_wasm.js CHANGED
@@ -58,20 +58,6 @@ export class Composition {
58
58
  }
59
59
  return takeFromExternrefTable0(ret[0]);
60
60
  }
61
- /**
62
- * What `sample("<path>")` reads: one decoded Float32Array per channel, at `rate`.
63
- * @param {string} path
64
- * @param {number} rate
65
- * @param {Array<any>} channels
66
- */
67
- insertRecording(path, rate, channels) {
68
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
69
- const len0 = WASM_VECTOR_LEN;
70
- const ret = wasm.composition_insertRecording(this.__wbg_ptr, ptr0, len0, rate, channels);
71
- if (ret[1]) {
72
- throw takeFromExternrefTable0(ret[0]);
73
- }
74
- }
75
61
  /**
76
62
  * @param {string} path
77
63
  * @param {string} text
@@ -142,18 +128,16 @@ export class Composition {
142
128
  wasm.composition_set_cache_max_bytes(this.__wbg_ptr, max_bytes);
143
129
  }
144
130
  /**
145
- * `sva-cli solve`'s envelope; `options` as its flags, `signal` and `progress(line)`.
146
- * @param {string} cost
147
- * @param {string[]} vary
131
+ * `sva-cli solve`'s envelope. `cost` is a `SolveCost` tree, every reference a value:
132
+ * `{ norm: { sub: [{ repr: "bands", target: "@lead([0, 5s])" }, { value: data }] } }`.
133
+ * `vary`: `SolveVary`s. `options` as the CLI's flags, `signal` and `progress(line)`.
134
+ * @param {SolveCost} cost
135
+ * @param {SolveVary[]} vary
148
136
  * @param {any} options
149
137
  * @returns {Promise<any>}
150
138
  */
151
139
  solve(cost, vary, options) {
152
- const ptr0 = passStringToWasm0(cost, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
153
- const len0 = WASM_VECTOR_LEN;
154
- const ptr1 = passArrayJsValueToWasm0(vary, wasm.__wbindgen_malloc);
155
- const len1 = WASM_VECTOR_LEN;
156
- const ret = wasm.composition_solve(this.__wbg_ptr, ptr0, len0, ptr1, len1, options);
140
+ const ret = wasm.composition_solve(this.__wbg_ptr, cost, vary, options);
157
141
  return ret;
158
142
  }
159
143
  /**
@@ -682,7 +666,7 @@ function __wbg_get_imports(memory) {
682
666
  __wbg__wbg_cb_unref_997e73d32238e655: function(arg0) {
683
667
  arg0._wbg_cb_unref();
684
668
  },
685
- __wbg_arrayBuffer_e29603fbb7413792: function(arg0) {
669
+ __wbg_arrayBuffer_57faa1aa4497e5be: function(arg0) {
686
670
  const ret = arg0.arrayBuffer();
687
671
  return ret;
688
672
  },
@@ -702,18 +686,18 @@ function __wbg_get_imports(memory) {
702
686
  const ret = arg0.call(arg1, arg2);
703
687
  return ret;
704
688
  }, arguments); },
705
- __wbg_close_0058ba3abbb2e948: function(arg0) {
706
- arg0.close();
707
- },
708
- __wbg_close_4d96984e1092a65a: function(arg0) {
689
+ __wbg_close_d822cb2adf57bd8b: function(arg0) {
709
690
  const ret = arg0.close();
710
691
  return ret;
711
692
  },
693
+ __wbg_close_e1ad5c96d857b78a: function(arg0) {
694
+ arg0.close();
695
+ },
712
696
  __wbg_composition_new: function(arg0) {
713
697
  const ret = Composition.__wrap(arg0);
714
698
  return ret;
715
699
  },
716
- __wbg_createWritable_db9efbff89d31a22: function(arg0) {
700
+ __wbg_createWritable_31b92567b0b19917: function(arg0) {
717
701
  const ret = arg0.createWritable();
718
702
  return ret;
719
703
  },
@@ -729,15 +713,15 @@ function __wbg_get_imports(memory) {
729
713
  const ret = Array.from(arg0);
730
714
  return ret;
731
715
  },
732
- __wbg_getDirectoryHandle_65154acb323edb5a: function(arg0, arg1, arg2, arg3) {
716
+ __wbg_getDirectoryHandle_cc0fdb83697e3a3c: function(arg0, arg1, arg2, arg3) {
733
717
  const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2), arg3);
734
718
  return ret;
735
719
  },
736
- __wbg_getFileHandle_ac6d479cbce76278: function(arg0, arg1, arg2, arg3) {
720
+ __wbg_getFileHandle_77bf02556407f34e: function(arg0, arg1, arg2, arg3) {
737
721
  const ret = arg0.getFileHandle(getStringFromWasm0(arg1, arg2), arg3);
738
722
  return ret;
739
723
  },
740
- __wbg_getFile_fc773e65f7a96603: function(arg0) {
724
+ __wbg_getFile_74df7066bc3bc13f: function(arg0) {
741
725
  const ret = arg0.getFile();
742
726
  return ret;
743
727
  },
@@ -791,7 +775,7 @@ function __wbg_get_imports(memory) {
791
775
  const ret = Array.isArray(arg0);
792
776
  return ret;
793
777
  },
794
- __wbg_keys_b3b8cf7df8baa503: function(arg0) {
778
+ __wbg_keys_66dbfec2911e3361: function(arg0) {
795
779
  const ret = arg0.keys();
796
780
  return ret;
797
781
  },
@@ -807,11 +791,11 @@ function __wbg_get_imports(memory) {
807
791
  const ret = arg0.length;
808
792
  return ret;
809
793
  },
810
- __wbg_move_9f7a9e1981813461: function(arg0, arg1, arg2, arg3) {
794
+ __wbg_move_b60c83b007e8cb17: function(arg0, arg1, arg2, arg3) {
811
795
  const ret = arg0.move(arg1, getStringFromWasm0(arg2, arg3));
812
796
  return ret;
813
797
  },
814
- __wbg_name_629e048da2876a10: function(arg0, arg1) {
798
+ __wbg_name_e1799ede3732c0c4: function(arg0, arg1) {
815
799
  const ret = arg1.name;
816
800
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
817
801
  const len1 = WASM_VECTOR_LEN;
@@ -822,18 +806,18 @@ function __wbg_get_imports(memory) {
822
806
  const ret = new Int32Array(arg0);
823
807
  return ret;
824
808
  },
825
- __wbg_new_0d715b19bdf9498c: function() {
826
- const ret = new MessageChannel();
827
- return ret;
828
- },
829
809
  __wbg_new_1da3429bc3c4541c: function(arg0) {
830
810
  const ret = new Uint8Array(arg0);
831
811
  return ret;
832
812
  },
833
- __wbg_new_7c7f106d53cf296c: function(arg0, arg1) {
813
+ __wbg_new_572355cfe7dc8757: function(arg0, arg1) {
834
814
  const ret = new Error(getStringFromWasm0(arg0, arg1));
835
815
  return ret;
836
816
  },
817
+ __wbg_new_66460bc51a0f8b5f: function() {
818
+ const ret = new MessageChannel();
819
+ return ret;
820
+ },
837
821
  __wbg_new_8f72ed7c652bf5a2: function(arg0, arg1) {
838
822
  try {
839
823
  var state0 = {a: arg0, b: arg1};
@@ -886,7 +870,7 @@ function __wbg_get_imports(memory) {
886
870
  const ret = new Worker(getStringFromWasm0(arg0, arg1));
887
871
  return ret;
888
872
  },
889
- __wbg_next_9176f5a2a54ca305: function(arg0) {
873
+ __wbg_next_8aba130a2d428c00: function(arg0) {
890
874
  const ret = arg0.next();
891
875
  return ret;
892
876
  },
@@ -894,24 +878,24 @@ function __wbg_get_imports(memory) {
894
878
  const ret = Array.of(arg0, arg1, arg2);
895
879
  return ret;
896
880
  },
897
- __wbg_parse_e3be4b13e18b6b18: function() { return handleError(function (arg0, arg1) {
881
+ __wbg_parse_8556496672fbe22b: function() { return handleError(function (arg0, arg1) {
898
882
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
899
883
  return ret;
900
884
  }, arguments); },
901
- __wbg_port1_a98064467b620bec: function(arg0) {
885
+ __wbg_port1_27b72d688840ba76: function(arg0) {
902
886
  const ret = arg0.port1;
903
887
  return ret;
904
888
  },
905
- __wbg_port2_33b8daafa45e2100: function(arg0) {
889
+ __wbg_port2_ba47466a81f9b335: function(arg0) {
906
890
  const ret = arg0.port2;
907
891
  return ret;
908
892
  },
909
- __wbg_postMessage_4e60d208733dd268: function(arg0, arg1) {
910
- arg0.postMessage(arg1);
911
- },
912
893
  __wbg_postMessage_8105a302ed002474: function() { return handleError(function (arg0, arg1) {
913
894
  arg0.postMessage(arg1);
914
895
  }, arguments); },
896
+ __wbg_postMessage_ccf2519b0103b23d: function(arg0, arg1) {
897
+ arg0.postMessage(arg1);
898
+ },
915
899
  __wbg_prototypesetcall_804a1eb1b047ccb9: function(arg0, arg1, arg2) {
916
900
  Float32Array.prototype.set.call(getArrayF32FromWasm0(arg0, arg1), arg2);
917
901
  },
@@ -922,7 +906,7 @@ function __wbg_get_imports(memory) {
922
906
  const ret = arg0.push(arg1);
923
907
  return ret;
924
908
  },
925
- __wbg_query_51024f18d035960d: function(arg0) {
909
+ __wbg_query_984ad3fc4c216b1e: function(arg0) {
926
910
  const ret = arg0.query();
927
911
  return ret;
928
912
  },
@@ -937,11 +921,11 @@ function __wbg_get_imports(memory) {
937
921
  const ret = Math.random();
938
922
  return ret;
939
923
  },
940
- __wbg_removeEntry_e4d944c91e6cf2f6: function(arg0, arg1, arg2, arg3) {
924
+ __wbg_removeEntry_37bd3f6ad29c8a20: function(arg0, arg1, arg2, arg3) {
941
925
  const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2), arg3);
942
926
  return ret;
943
927
  },
944
- __wbg_removeEntry_e5b8506039a55bdb: function(arg0, arg1, arg2) {
928
+ __wbg_removeEntry_8a56793490abceac: function(arg0, arg1, arg2) {
945
929
  const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2));
946
930
  return ret;
947
931
  },
@@ -949,7 +933,7 @@ function __wbg_get_imports(memory) {
949
933
  const ret = Rendering.__wrap(arg0);
950
934
  return ret;
951
935
  },
952
- __wbg_request_1ac049ca0cd0b19a: function(arg0, arg1, arg2, arg3) {
936
+ __wbg_request_ba986ed8b6aae124: function(arg0, arg1, arg2, arg3) {
953
937
  const ret = arg0.request(getStringFromWasm0(arg1, arg2), arg3);
954
938
  return ret;
955
939
  },
@@ -964,23 +948,23 @@ function __wbg_get_imports(memory) {
964
948
  __wbg_set_c41f8dbc07a2190f: function(arg0, arg1, arg2) {
965
949
  arg0.set(getArrayF32FromWasm0(arg1, arg2));
966
950
  },
967
- __wbg_set_name_bc9162a3ae0bc5eb: function(arg0, arg1, arg2) {
951
+ __wbg_set_name_5c0bbed8cd04ffe6: function(arg0, arg1, arg2) {
968
952
  arg0.name = getStringFromWasm0(arg1, arg2);
969
953
  },
970
954
  __wbg_set_onmessage_2244c2525c4e0c38: function(arg0, arg1) {
971
955
  arg0.onmessage = arg1;
972
956
  },
973
- __wbg_set_onmessage_d5536090d1c54a1f: function(arg0, arg1) {
957
+ __wbg_set_onmessage_a52c4f65c4590715: function(arg0, arg1) {
974
958
  arg0.onmessage = arg1;
975
959
  },
976
- __wbg_set_refusal_02cb46b24b0c05ca: function(arg0, arg1) {
960
+ __wbg_set_refusal_9ad087fe72c76298: function(arg0, arg1) {
977
961
  arg0.refusal = arg1;
978
962
  },
979
- __wbg_size_12001a980cb86c23: function(arg0) {
963
+ __wbg_size_77f1439fe6ca4892: function(arg0) {
980
964
  const ret = arg0.size;
981
965
  return ret;
982
966
  },
983
- __wbg_slice_92746a756d29cf21: function(arg0, arg1, arg2) {
967
+ __wbg_slice_d739f8ab84376943: function(arg0, arg1, arg2) {
984
968
  const ret = arg0.slice(arg1, arg2);
985
969
  return ret;
986
970
  },
@@ -1012,6 +996,10 @@ function __wbg_get_imports(memory) {
1012
996
  const ret = Stream.__wrap(arg0);
1013
997
  return ret;
1014
998
  },
999
+ __wbg_stringify_54b3d9b61602aee6: function() { return handleError(function (arg0) {
1000
+ const ret = JSON.stringify(arg0);
1001
+ return ret;
1002
+ }, arguments); },
1015
1003
  __wbg_subarray_03833f2a8828b0c8: function(arg0, arg1, arg2) {
1016
1004
  const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1017
1005
  return ret;
@@ -1040,36 +1028,36 @@ function __wbg_get_imports(memory) {
1040
1028
  const ret = Atomics.waitAsync;
1041
1029
  return ret;
1042
1030
  },
1043
- __wbg_warn_fe0e62581cc260ab: function(arg0, arg1) {
1031
+ __wbg_warn_1f95fc05f70e6617: function(arg0, arg1) {
1044
1032
  console.warn(getStringFromWasm0(arg0, arg1));
1045
1033
  },
1046
- __wbg_write_6325ef1ba9abab0d: function(arg0, arg1) {
1034
+ __wbg_write_2b2d72258fbda9b7: function(arg0, arg1) {
1047
1035
  const ret = arg0.write(arg1);
1048
1036
  return ret;
1049
1037
  },
1050
1038
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
1051
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1039
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 6, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1052
1040
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d3a5247b0aa3f0ac___convert__closures_____invoke___wasm_bindgen_d3a5247b0aa3f0ac___JsValue______true_);
1053
1041
  return ret;
1054
1042
  },
1055
1043
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
1056
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 582, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1044
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 609, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1057
1045
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d3a5247b0aa3f0ac___convert__closures_____invoke___wasm_bindgen_d3a5247b0aa3f0ac___JsValue__core_ea519e494776717c___result__Result_____wasm_bindgen_d3a5247b0aa3f0ac___JsError___true_);
1058
1046
  return ret;
1059
1047
  },
1060
1048
  __wbindgen_generic_0000000000000003: function(arg0, arg1) {
1061
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 584, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1049
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 611, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1062
1050
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d3a5247b0aa3f0ac___convert__closures_____invoke___js_sys_2b088e2931f41c5___futures__task__wait_async_polyfill__MessageEvent______true_);
1063
1051
  return ret;
1064
1052
  },
1065
1053
  __wbindgen_generic_0000000000000004: function(arg0, arg1) {
1066
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 4, ret: NamedExternref("Promise<any>"), inner_ret: Some(NamedExternref("Promise<any>")) }, mutable: true }) -> Externref`.
1067
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d3a5247b0aa3f0ac___convert__closures_____invoke___js_sys_2b088e2931f41c5___Promise__true_);
1054
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 10, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1055
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d3a5247b0aa3f0ac___convert__closures_____invoke_______true_);
1068
1056
  return ret;
1069
1057
  },
1070
1058
  __wbindgen_generic_0000000000000005: function(arg0, arg1) {
1071
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 6, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1072
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d3a5247b0aa3f0ac___convert__closures_____invoke_______true_);
1059
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 8, ret: NamedExternref("Promise<any>"), inner_ret: Some(NamedExternref("Promise<any>")) }, mutable: true }) -> Externref`.
1060
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d3a5247b0aa3f0ac___convert__closures_____invoke___js_sys_2b088e2931f41c5___Promise__true_);
1073
1061
  return ret;
1074
1062
  },
1075
1063
  __wbindgen_generic_0000000000000006: function(arg0) {
package/sva_wasm_bg.wasm CHANGED
Binary file