@scalable-vector-audio/sva-wasm 0.14.19 → 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.19",
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. */
@@ -185,6 +217,12 @@ export class Composition {
185
217
  * `AbortError` before its next block.
186
218
  */
187
219
  render(target: string, representations: string[] | null | undefined, options: any): Promise<Rendering>;
220
+ /**
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)`.
224
+ */
225
+ solve(cost: SolveCost, vary: SolveVary[], options: any): Promise<any>;
188
226
  /**
189
227
  * `target`'s placed notes as `sva-cli outline @score/song` lists them, under
190
228
  * `options.set` as `render` takes it: `{ song, events }`, each with `at`, `sounds`,
@@ -352,6 +390,7 @@ export interface InitOutput {
352
390
  readonly composition_persist: (a: number) => any;
353
391
  readonly composition_render: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
354
392
  readonly composition_set_cache_max_bytes: (a: number, b: number) => void;
393
+ readonly composition_solve: (a: number, b: any, c: any, d: any) => any;
355
394
  readonly composition_song: (a: number, b: number, c: number, d: any) => [number, number, number];
356
395
  readonly composition_store_bytes: (a: number) => [number, number];
357
396
  readonly composition_store_max_bytes: (a: number) => [number, number];
package/sva_wasm.js CHANGED
@@ -127,6 +127,19 @@ export class Composition {
127
127
  set cache_max_bytes(max_bytes) {
128
128
  wasm.composition_set_cache_max_bytes(this.__wbg_ptr, max_bytes);
129
129
  }
130
+ /**
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
136
+ * @param {any} options
137
+ * @returns {Promise<any>}
138
+ */
139
+ solve(cost, vary, options) {
140
+ const ret = wasm.composition_solve(this.__wbg_ptr, cost, vary, options);
141
+ return ret;
142
+ }
130
143
  /**
131
144
  * `target`'s placed notes as `sva-cli outline @score/song` lists them, under
132
145
  * `options.set` as `render` takes it: `{ song, events }`, each with `at`, `sounds`,
@@ -653,7 +666,7 @@ function __wbg_get_imports(memory) {
653
666
  __wbg__wbg_cb_unref_997e73d32238e655: function(arg0) {
654
667
  arg0._wbg_cb_unref();
655
668
  },
656
- __wbg_arrayBuffer_f365fd580ffa1c92: function(arg0) {
669
+ __wbg_arrayBuffer_57faa1aa4497e5be: function(arg0) {
657
670
  const ret = arg0.arrayBuffer();
658
671
  return ret;
659
672
  },
@@ -673,18 +686,18 @@ function __wbg_get_imports(memory) {
673
686
  const ret = arg0.call(arg1, arg2);
674
687
  return ret;
675
688
  }, arguments); },
676
- __wbg_close_5cd20013e7972c42: function(arg0) {
689
+ __wbg_close_d822cb2adf57bd8b: function(arg0) {
677
690
  const ret = arg0.close();
678
691
  return ret;
679
692
  },
680
- __wbg_close_ca83fbed995e2e01: function(arg0) {
693
+ __wbg_close_e1ad5c96d857b78a: function(arg0) {
681
694
  arg0.close();
682
695
  },
683
696
  __wbg_composition_new: function(arg0) {
684
697
  const ret = Composition.__wrap(arg0);
685
698
  return ret;
686
699
  },
687
- __wbg_createWritable_48566cc7e2a7a3c2: function(arg0) {
700
+ __wbg_createWritable_31b92567b0b19917: function(arg0) {
688
701
  const ret = arg0.createWritable();
689
702
  return ret;
690
703
  },
@@ -700,15 +713,15 @@ function __wbg_get_imports(memory) {
700
713
  const ret = Array.from(arg0);
701
714
  return ret;
702
715
  },
703
- __wbg_getDirectoryHandle_add98c3ed0bcb1e5: function(arg0, arg1, arg2, arg3) {
716
+ __wbg_getDirectoryHandle_cc0fdb83697e3a3c: function(arg0, arg1, arg2, arg3) {
704
717
  const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2), arg3);
705
718
  return ret;
706
719
  },
707
- __wbg_getFileHandle_50a8e51835eb1893: function(arg0, arg1, arg2, arg3) {
720
+ __wbg_getFileHandle_77bf02556407f34e: function(arg0, arg1, arg2, arg3) {
708
721
  const ret = arg0.getFileHandle(getStringFromWasm0(arg1, arg2), arg3);
709
722
  return ret;
710
723
  },
711
- __wbg_getFile_00276f661752b0d7: function(arg0) {
724
+ __wbg_getFile_74df7066bc3bc13f: function(arg0) {
712
725
  const ret = arg0.getFile();
713
726
  return ret;
714
727
  },
@@ -762,7 +775,7 @@ function __wbg_get_imports(memory) {
762
775
  const ret = Array.isArray(arg0);
763
776
  return ret;
764
777
  },
765
- __wbg_keys_143bcb9163ce7059: function(arg0) {
778
+ __wbg_keys_66dbfec2911e3361: function(arg0) {
766
779
  const ret = arg0.keys();
767
780
  return ret;
768
781
  },
@@ -778,11 +791,11 @@ function __wbg_get_imports(memory) {
778
791
  const ret = arg0.length;
779
792
  return ret;
780
793
  },
781
- __wbg_move_e01680a9e2f56ad2: function(arg0, arg1, arg2, arg3) {
794
+ __wbg_move_b60c83b007e8cb17: function(arg0, arg1, arg2, arg3) {
782
795
  const ret = arg0.move(arg1, getStringFromWasm0(arg2, arg3));
783
796
  return ret;
784
797
  },
785
- __wbg_name_334a3c5f2443d864: function(arg0, arg1) {
798
+ __wbg_name_e1799ede3732c0c4: function(arg0, arg1) {
786
799
  const ret = arg1.name;
787
800
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
788
801
  const len1 = WASM_VECTOR_LEN;
@@ -797,6 +810,14 @@ function __wbg_get_imports(memory) {
797
810
  const ret = new Uint8Array(arg0);
798
811
  return ret;
799
812
  },
813
+ __wbg_new_572355cfe7dc8757: function(arg0, arg1) {
814
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
815
+ return ret;
816
+ },
817
+ __wbg_new_66460bc51a0f8b5f: function() {
818
+ const ret = new MessageChannel();
819
+ return ret;
820
+ },
800
821
  __wbg_new_8f72ed7c652bf5a2: function(arg0, arg1) {
801
822
  try {
802
823
  var state0 = {a: arg0, b: arg1};
@@ -815,18 +836,10 @@ function __wbg_get_imports(memory) {
815
836
  state0.a = 0;
816
837
  }
817
838
  },
818
- __wbg_new_90b5023f00fd5dae: function() {
819
- const ret = new MessageChannel();
820
- return ret;
821
- },
822
839
  __wbg_new_bebc3f4757acf305: function() {
823
840
  const ret = new Object();
824
841
  return ret;
825
842
  },
826
- __wbg_new_bf196fe205c10ce4: function(arg0, arg1) {
827
- const ret = new Error(getStringFromWasm0(arg0, arg1));
828
- return ret;
829
- },
830
843
  __wbg_new_ffa92086ea89f79c: function() {
831
844
  const ret = new Array();
832
845
  return ret;
@@ -857,7 +870,7 @@ function __wbg_get_imports(memory) {
857
870
  const ret = new Worker(getStringFromWasm0(arg0, arg1));
858
871
  return ret;
859
872
  },
860
- __wbg_next_38533dcc88e18634: function(arg0) {
873
+ __wbg_next_8aba130a2d428c00: function(arg0) {
861
874
  const ret = arg0.next();
862
875
  return ret;
863
876
  },
@@ -865,24 +878,24 @@ function __wbg_get_imports(memory) {
865
878
  const ret = Array.of(arg0, arg1, arg2);
866
879
  return ret;
867
880
  },
868
- __wbg_parse_d26e3971af323908: function() { return handleError(function (arg0, arg1) {
881
+ __wbg_parse_8556496672fbe22b: function() { return handleError(function (arg0, arg1) {
869
882
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
870
883
  return ret;
871
884
  }, arguments); },
872
- __wbg_port1_d1e66566011cf5d6: function(arg0) {
885
+ __wbg_port1_27b72d688840ba76: function(arg0) {
873
886
  const ret = arg0.port1;
874
887
  return ret;
875
888
  },
876
- __wbg_port2_97c25116adc33c01: function(arg0) {
889
+ __wbg_port2_ba47466a81f9b335: function(arg0) {
877
890
  const ret = arg0.port2;
878
891
  return ret;
879
892
  },
880
- __wbg_postMessage_05d98e1b5fb6a5e6: function(arg0, arg1) {
881
- arg0.postMessage(arg1);
882
- },
883
893
  __wbg_postMessage_8105a302ed002474: function() { return handleError(function (arg0, arg1) {
884
894
  arg0.postMessage(arg1);
885
895
  }, arguments); },
896
+ __wbg_postMessage_ccf2519b0103b23d: function(arg0, arg1) {
897
+ arg0.postMessage(arg1);
898
+ },
886
899
  __wbg_prototypesetcall_804a1eb1b047ccb9: function(arg0, arg1, arg2) {
887
900
  Float32Array.prototype.set.call(getArrayF32FromWasm0(arg0, arg1), arg2);
888
901
  },
@@ -893,7 +906,7 @@ function __wbg_get_imports(memory) {
893
906
  const ret = arg0.push(arg1);
894
907
  return ret;
895
908
  },
896
- __wbg_query_bb29a13e5e5c0b71: function(arg0) {
909
+ __wbg_query_984ad3fc4c216b1e: function(arg0) {
897
910
  const ret = arg0.query();
898
911
  return ret;
899
912
  },
@@ -908,11 +921,11 @@ function __wbg_get_imports(memory) {
908
921
  const ret = Math.random();
909
922
  return ret;
910
923
  },
911
- __wbg_removeEntry_def05bd290316e64: function(arg0, arg1, arg2, arg3) {
924
+ __wbg_removeEntry_37bd3f6ad29c8a20: function(arg0, arg1, arg2, arg3) {
912
925
  const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2), arg3);
913
926
  return ret;
914
927
  },
915
- __wbg_removeEntry_f2b2235439b08db2: function(arg0, arg1, arg2) {
928
+ __wbg_removeEntry_8a56793490abceac: function(arg0, arg1, arg2) {
916
929
  const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2));
917
930
  return ret;
918
931
  },
@@ -920,7 +933,7 @@ function __wbg_get_imports(memory) {
920
933
  const ret = Rendering.__wrap(arg0);
921
934
  return ret;
922
935
  },
923
- __wbg_request_779634d0b0a144df: function(arg0, arg1, arg2, arg3) {
936
+ __wbg_request_ba986ed8b6aae124: function(arg0, arg1, arg2, arg3) {
924
937
  const ret = arg0.request(getStringFromWasm0(arg1, arg2), arg3);
925
938
  return ret;
926
939
  },
@@ -935,23 +948,23 @@ function __wbg_get_imports(memory) {
935
948
  __wbg_set_c41f8dbc07a2190f: function(arg0, arg1, arg2) {
936
949
  arg0.set(getArrayF32FromWasm0(arg1, arg2));
937
950
  },
938
- __wbg_set_name_8240acd4f45229dd: function(arg0, arg1, arg2) {
951
+ __wbg_set_name_5c0bbed8cd04ffe6: function(arg0, arg1, arg2) {
939
952
  arg0.name = getStringFromWasm0(arg1, arg2);
940
953
  },
941
954
  __wbg_set_onmessage_2244c2525c4e0c38: function(arg0, arg1) {
942
955
  arg0.onmessage = arg1;
943
956
  },
944
- __wbg_set_onmessage_4bf364c93dfb7e69: function(arg0, arg1) {
957
+ __wbg_set_onmessage_a52c4f65c4590715: function(arg0, arg1) {
945
958
  arg0.onmessage = arg1;
946
959
  },
947
- __wbg_set_refusal_980a0e509d192702: function(arg0, arg1) {
960
+ __wbg_set_refusal_9ad087fe72c76298: function(arg0, arg1) {
948
961
  arg0.refusal = arg1;
949
962
  },
950
- __wbg_size_8266988606a2465b: function(arg0) {
963
+ __wbg_size_77f1439fe6ca4892: function(arg0) {
951
964
  const ret = arg0.size;
952
965
  return ret;
953
966
  },
954
- __wbg_slice_89649fead5d0a65f: function(arg0, arg1, arg2) {
967
+ __wbg_slice_d739f8ab84376943: function(arg0, arg1, arg2) {
955
968
  const ret = arg0.slice(arg1, arg2);
956
969
  return ret;
957
970
  },
@@ -983,6 +996,10 @@ function __wbg_get_imports(memory) {
983
996
  const ret = Stream.__wrap(arg0);
984
997
  return ret;
985
998
  },
999
+ __wbg_stringify_54b3d9b61602aee6: function() { return handleError(function (arg0) {
1000
+ const ret = JSON.stringify(arg0);
1001
+ return ret;
1002
+ }, arguments); },
986
1003
  __wbg_subarray_03833f2a8828b0c8: function(arg0, arg1, arg2) {
987
1004
  const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
988
1005
  return ret;
@@ -1011,36 +1028,36 @@ function __wbg_get_imports(memory) {
1011
1028
  const ret = Atomics.waitAsync;
1012
1029
  return ret;
1013
1030
  },
1014
- __wbg_warn_2569b4620c2a7628: function(arg0, arg1) {
1031
+ __wbg_warn_1f95fc05f70e6617: function(arg0, arg1) {
1015
1032
  console.warn(getStringFromWasm0(arg0, arg1));
1016
1033
  },
1017
- __wbg_write_b3d60f38c3824b10: function(arg0, arg1) {
1034
+ __wbg_write_2b2d72258fbda9b7: function(arg0, arg1) {
1018
1035
  const ret = arg0.write(arg1);
1019
1036
  return ret;
1020
1037
  },
1021
1038
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
1022
- // 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`.
1023
1040
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d3a5247b0aa3f0ac___convert__closures_____invoke___wasm_bindgen_d3a5247b0aa3f0ac___JsValue______true_);
1024
1041
  return ret;
1025
1042
  },
1026
1043
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
1027
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 558, 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`.
1028
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_);
1029
1046
  return ret;
1030
1047
  },
1031
1048
  __wbindgen_generic_0000000000000003: function(arg0, arg1) {
1032
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 560, 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`.
1033
1050
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_d3a5247b0aa3f0ac___convert__closures_____invoke___js_sys_2b088e2931f41c5___futures__task__wait_async_polyfill__MessageEvent______true_);
1034
1051
  return ret;
1035
1052
  },
1036
1053
  __wbindgen_generic_0000000000000004: function(arg0, arg1) {
1037
- // 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`.
1038
- 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_);
1039
1056
  return ret;
1040
1057
  },
1041
1058
  __wbindgen_generic_0000000000000005: function(arg0, arg1) {
1042
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 6, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1043
- 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_);
1044
1061
  return ret;
1045
1062
  },
1046
1063
  __wbindgen_generic_0000000000000006: function(arg0) {
package/sva_wasm_bg.wasm CHANGED
Binary file