mimium-web 2.4.1-alpha → 3.0.0-alpha

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
@@ -28,8 +28,12 @@ fn dsp(){
28
28
  }
29
29
  ```
30
30
 
31
+ ## Unique Features
32
+
33
+ ### Functional Approach
34
+
31
35
  A special keyword `self` can be used in function, which is a last return value of the function.
32
- This enables an easy and clean expression of feedback connection of signal chain.
36
+ This enables an easy and clean expression of feedback connection of signal chain as a function pipe.
33
37
 
34
38
  ```rust
35
39
  fn lpf(input,fb){
@@ -37,29 +41,45 @@ fn lpf(input,fb){
37
41
  }
38
42
  ```
39
43
 
40
- Also, the language design is based on the call by value lambda calculus, so the higher-order functions are supported to express generative signal graph like replicatiing multiple oscillators.
44
+ Also, the language design is based on the call by value lambda calculus with multi-stage computation and the higher-order functions are supported to express generative signal graph like replicatiing multiple oscillators.
41
45
 
42
46
  ```rust
43
- fn replicate(n,gen){
47
+ //Sequentially connected oscillators
48
+ #stage(macro)
49
+ fn cascade(n,gen){
44
50
  if (n>0.0){
45
- let c = replicate(n - 1.0,gen)
46
- let g = gen()
47
- |x,rate| g(x,rate) + c(x+100.0,rate+0.1)
51
+ let multiplier = 1.0-(1.0/(n*3)) |> lift_f
52
+ `|rate| rate + ($gen)(rate/3)* 0.5 * rate* $multiplier
53
+ |> cascade!(n - 1.0 ,gen)
48
54
  }else{
49
- |x,rate| 0
55
+ `|rate| ($gen)(rate)
50
56
  }
51
57
  }
58
+ #stage(main)
59
+ let osc = ...
60
+ fn dsp(){
61
+ let out = 50 |> cascade!(1000.0,`osc)
62
+ (out,out)
63
+ }
52
64
  ```
53
65
 
54
66
  mimium is a statically typed language but the most of type annotations can be omitted by the type inference system. If you are interested in the theoritical background of mimium, see [the paper about mimium](https://matsuuratomoya.com/en/research/lambdammm-ifc-2024/).
55
67
 
56
- This repository is for a mimium *version 2*, all the code base is rewritten in Rust while the original was in C++, and semantics of the language was re-designed. The codes are still very under development.
68
+ ### Live Coding
69
+
70
+ mimium can describe digital signal processing algorithm from very low-level, like Faust. Moreover, mimium can update source code without audio interruption, which enables **full-scratch dsp livecoding** performance.
71
+
72
+ ### Extensibility
73
+
74
+ mimium's VM design is inspired by Lua, that can be easily embedded on Rust application through the plugin system. External functions(closures) defined in Rust can be easily called from mimium.
57
75
 
58
76
  ## Installation
59
77
 
60
- An easy way to start mimium is using [Visual Studio Code Extension](https://github.com/mimium-org/mimium-language). You can run opening `.mmm` file from the command palette.
78
+ The easiest way to start mimium is using [Visual Studio Code Extension](https://github.com/mimium-org/mimium-language). The extention will automatically download CLI tool `mimium-cli` and language server (support for syntactic highlight and error reporting) when installed.
79
+
80
+ You can run `.mmm` file from the command palette.
61
81
 
62
- Also you can download the latest CLI tool [mimium-cli](https://github.com/tomoyanonymous/mimium-rs/releases) from GitHub Release.
82
+ Also you can download the latest CLI tool [mimium-cli](https://github.com/tomoyanonymous/mimium-rs/releases) from GitHub Release through shell script.
63
83
 
64
84
  ## Development
65
85
 
package/mimium_web.d.ts CHANGED
@@ -24,3 +24,57 @@ export class Context {
24
24
  */
25
25
  process(input: Float32Array, output: Float32Array): bigint;
26
26
  }
27
+
28
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
29
+
30
+ export interface InitOutput {
31
+ readonly memory: WebAssembly.Memory;
32
+ readonly __wbg_config_free: (a: number, b: number) => void;
33
+ readonly __wbg_get_config_sample_rate: (a: number) => number;
34
+ readonly __wbg_set_config_sample_rate: (a: number, b: number) => void;
35
+ readonly __wbg_get_config_input_channels: (a: number) => number;
36
+ readonly __wbg_set_config_input_channels: (a: number, b: number) => void;
37
+ readonly __wbg_get_config_output_channels: (a: number) => number;
38
+ readonly __wbg_set_config_output_channels: (a: number, b: number) => void;
39
+ readonly __wbg_get_config_buffer_size: (a: number) => number;
40
+ readonly __wbg_set_config_buffer_size: (a: number, b: number) => void;
41
+ readonly config_new: () => number;
42
+ readonly __wbg_context_free: (a: number, b: number) => void;
43
+ readonly context_new: (a: number) => number;
44
+ readonly context_compile: (a: number, b: number, c: number) => void;
45
+ readonly context_get_input_channels: (a: number) => number;
46
+ readonly context_get_output_channels: (a: number) => number;
47
+ readonly context_process: (a: number, b: number, c: number, d: number, e: number, f: any) => bigint;
48
+ readonly __wbindgen_exn_store: (a: number) => void;
49
+ readonly __externref_table_alloc: () => number;
50
+ readonly __wbindgen_export_2: WebAssembly.Table;
51
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
52
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
53
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
54
+ readonly __wbindgen_export_6: WebAssembly.Table;
55
+ readonly closure62_externref_shim: (a: number, b: number, c: any) => void;
56
+ readonly closure71_externref_shim: (a: number, b: number, c: any) => void;
57
+ readonly closure88_externref_shim: (a: number, b: number, c: any, d: any) => void;
58
+ readonly __wbindgen_start: () => void;
59
+ }
60
+
61
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
62
+ /**
63
+ * Instantiates the given `module`, which can either be bytes or
64
+ * a precompiled `WebAssembly.Module`.
65
+ *
66
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
67
+ *
68
+ * @returns {InitOutput}
69
+ */
70
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
71
+
72
+ /**
73
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
74
+ * for everything else, calls `WebAssembly.instantiate` directly.
75
+ *
76
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
77
+ *
78
+ * @returns {Promise<InitOutput>}
79
+ */
80
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;