@gorilla-engine-sdk/create-gorilla-engine-plugin 1.0.0

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.
Files changed (101) hide show
  1. package/LICENSE.md +64 -0
  2. package/README.md +103 -0
  3. package/generator-gorilla-engine-plugin/app/index.js +338 -0
  4. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-dsp/SKILL.md +295 -0
  5. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-dsp/references/effects-filters.md +186 -0
  6. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-dsp/references/indexing.md +129 -0
  7. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-dsp/references/instrument-files.md +547 -0
  8. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-dsp/references/key-rules.md +81 -0
  9. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-dsp/references/modulation.md +210 -0
  10. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-dsp/references/module-control.md +217 -0
  11. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-dsp/references/module-reference-bus-effects.md +663 -0
  12. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-dsp/references/module-reference-core.md +145 -0
  13. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-dsp/references/module-reference-misc.md +59 -0
  14. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-dsp/references/module-reference-modulation.md +85 -0
  15. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-dsp/references/module-reference-voice-effects.md +407 -0
  16. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-dsp/references/note-events.md +278 -0
  17. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-dsp/references/properties.md +230 -0
  18. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-dsp/references/script-patterns.md +494 -0
  19. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-dsp/references/time-tempo.md +209 -0
  20. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-ui/SKILL.md +104 -0
  21. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-ui/references/advanced-controls.md +194 -0
  22. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-ui/references/base-props.md +167 -0
  23. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-ui/references/basic-controls.md +230 -0
  24. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-ui/references/bindings.md +183 -0
  25. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-ui/references/composite-components.md +258 -0
  26. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-ui/references/containers.md +149 -0
  27. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-ui/references/editors.md +191 -0
  28. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-ui/references/event-handlers.md +150 -0
  29. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-ui/references/getting-started.md +143 -0
  30. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-ui/references/gorilla-engine-api.md +147 -0
  31. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-ui/references/instrument-api.md +250 -0
  32. package/generator-gorilla-engine-plugin/app/templates/.agents/skills/gorilla-engine-ui/references/visualization.md +209 -0
  33. package/generator-gorilla-engine-plugin/app/templates/.prettierignore +13 -0
  34. package/generator-gorilla-engine-plugin/app/templates/.vscode/settings.json +14 -0
  35. package/generator-gorilla-engine-plugin/app/templates/.vscode_input/launch.json +89 -0
  36. package/generator-gorilla-engine-plugin/app/templates/README.md +36 -0
  37. package/generator-gorilla-engine-plugin/app/templates/assets/fonts/OFL.txt +93 -0
  38. package/generator-gorilla-engine-plugin/app/templates/assets/fonts/Roboto-Bold.otf +0 -0
  39. package/generator-gorilla-engine-plugin/app/templates/assets/fonts/Roboto-Medium.otf +0 -0
  40. package/generator-gorilla-engine-plugin/app/templates/assets/fonts/Roboto-Regular.otf +0 -0
  41. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/Presets/Factory/Category 1/Init.preset +1 -0
  42. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/Presets/Factory/Category 1/Three Quarters.preset +1 -0
  43. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/Horizontal Slider.png +0 -0
  44. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/Horizontal Slider@2x.png +0 -0
  45. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/Rotary Bipolar.png +0 -0
  46. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/Rotary-Bipolar@2x.png +0 -0
  47. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/Rotary.png +0 -0
  48. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/Rotary@2x.png +0 -0
  49. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/arrow-down-default.png +0 -0
  50. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/arrow-down-default@2x.png +0 -0
  51. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/arrow-down-hover.png +0 -0
  52. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/arrow-down-hover@2x.png +0 -0
  53. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/arrow-down-pressed.png +0 -0
  54. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/arrow-down-pressed@2x.png +0 -0
  55. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/arrow-up-default.png +0 -0
  56. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/arrow-up-default@2x.png +0 -0
  57. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/arrow-up-hover.png +0 -0
  58. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/arrow-up-hover@2x.png +0 -0
  59. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/arrow-up-pressed.png +0 -0
  60. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/arrow-up-pressed@2x.png +0 -0
  61. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/toggle-default.png +0 -0
  62. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/toggle-default@2x.png +0 -0
  63. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/toggle-pressed.png +0 -0
  64. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/images/toggle-pressed@2x.png +0 -0
  65. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/instruments/Basic Synth Example_part1.blob +0 -0
  66. package/generator-gorilla-engine-plugin/app/templates/basic-synth/assets/instruments/Basic Synth Example_part2.blob +1 -0
  67. package/generator-gorilla-engine-plugin/app/templates/basic-synth/instrument/Basic Synth Example.inst +157 -0
  68. package/generator-gorilla-engine-plugin/app/templates/basic-synth/instrument/Basic Synth Example.txt +184 -0
  69. package/generator-gorilla-engine-plugin/app/templates/basic-synth/src/app/Root.tsx +35 -0
  70. package/generator-gorilla-engine-plugin/app/templates/basic-synth/src/app/components/ErrorBoundary.tsx +138 -0
  71. package/generator-gorilla-engine-plugin/app/templates/basic-synth/src/app/components/UserInterface.tsx +338 -0
  72. package/generator-gorilla-engine-plugin/app/templates/basic-synth/src/app/pluginConfig.ts +4 -0
  73. package/generator-gorilla-engine-plugin/app/templates/basic-synth/src/dialogsCustomStyle.ts +98 -0
  74. package/generator-gorilla-engine-plugin/app/templates/basic-synth/src/index.tsx +217 -0
  75. package/generator-gorilla-engine-plugin/app/templates/basic-synth/src/presetBrowserCustomStyle.ts +124 -0
  76. package/generator-gorilla-engine-plugin/app/templates/build.ugep +173 -0
  77. package/generator-gorilla-engine-plugin/app/templates/effect/assets/Presets/Factory/Category 1/01 - All The Way Down.preset +1 -0
  78. package/generator-gorilla-engine-plugin/app/templates/effect/assets/Presets/Factory/Category 1/02 - About Half.preset +1 -0
  79. package/generator-gorilla-engine-plugin/app/templates/effect/assets/Presets/Factory/Category 1/03 - Three Quarters.preset +1 -0
  80. package/generator-gorilla-engine-plugin/app/templates/effect/assets/Presets/Factory/Category 1/04 - All The Way Up.preset +1 -0
  81. package/generator-gorilla-engine-plugin/app/templates/effect/assets/images/Rotary.png +0 -0
  82. package/generator-gorilla-engine-plugin/app/templates/effect/assets/images/Rotary@2x.png +0 -0
  83. package/generator-gorilla-engine-plugin/app/templates/effect/assets/instruments/Reverb Example_part1.blob +0 -0
  84. package/generator-gorilla-engine-plugin/app/templates/effect/assets/instruments/Reverb Example_part2.blob +1 -0
  85. package/generator-gorilla-engine-plugin/app/templates/effect/instrument/Reverb Example.inst +73 -0
  86. package/generator-gorilla-engine-plugin/app/templates/effect/instrument/Reverb Example.txt +21 -0
  87. package/generator-gorilla-engine-plugin/app/templates/effect/src/app/Root.tsx +35 -0
  88. package/generator-gorilla-engine-plugin/app/templates/effect/src/app/components/ErrorBoundary.tsx +114 -0
  89. package/generator-gorilla-engine-plugin/app/templates/effect/src/app/components/UserInterface.tsx +85 -0
  90. package/generator-gorilla-engine-plugin/app/templates/effect/src/app/pluginConfig.ts +4 -0
  91. package/generator-gorilla-engine-plugin/app/templates/effect/src/dialogsCustomStyle.ts +101 -0
  92. package/generator-gorilla-engine-plugin/app/templates/effect/src/index.tsx +214 -0
  93. package/generator-gorilla-engine-plugin/app/templates/effect/src/presetBrowserCustomStyle.ts +124 -0
  94. package/generator-gorilla-engine-plugin/app/templates/gitignore +9 -0
  95. package/generator-gorilla-engine-plugin/app/templates/licence.txt +0 -0
  96. package/generator-gorilla-engine-plugin/app/templates/package.json +38 -0
  97. package/generator-gorilla-engine-plugin/app/templates/prettierrc +9 -0
  98. package/generator-gorilla-engine-plugin/app/templates/tsconfig.json +20 -0
  99. package/generator-gorilla-engine-plugin/package.json +17 -0
  100. package/index.js +72 -0
  101. package/package.json +42 -0
@@ -0,0 +1,295 @@
1
+ # Gorilla Engine DSP — Instrument Scripting
2
+
3
+ ---
4
+
5
+ ## Workflow
6
+
7
+ 1. Read the target `.txt` script and the relevant arrays in the current `.inst` file. The instrument file controls module order, so resolve addresses from its current topology; a full-file inventory or user-facing pre-flight report is not required. For large instrument files, search from the end unless locating Groups or Mappings.
8
+ 2. Load [indexing.md](./references/indexing.md) before deriving `M_GROUP`, `M_FILTER`, `M_MOD_SRC`, `M_MOD`, `M_BUS`, `M_EFFECT`, or other module indices. Derive each index from the documented array position and scope.
9
+ 3. Follow the Script Language Reference below, then load [module-control.md](./references/module-control.md) and the reference for each module type used by the change. Use the documented parameter number, range, and encoding; do not infer them from a parameter name.
10
+ 4. Edit the external `.txt` script, not the script copy embedded in `.inst`. Reload the script in Gorilla Editor so the change is applied; saving the instrument then copies the loaded script into the instrument file.
11
+ 5. Run the narrowest available syntax, test, or build check for the changed script.
12
+
13
+ ---
14
+
15
+ ## Scope
16
+
17
+ Write `.txt` scripts that expose controls for a topology the user built in Gorilla Editor. A script can control only modules already present in the instrument definition. Always edit the `.txt` file, not the Script section inside `.inst`. For scripting facts, patterns, and module control, see the reference files below.
18
+
19
+ ---
20
+
21
+ ## Script Language Reference
22
+
23
+ ### General Rules
24
+
25
+ Gorilla Script is not JavaScript. Use the syntax documented here rather than inferring constructs from another language.
26
+
27
+ - Write one statement per line. Use `...` to continue a statement on the next line; `;` may separate multiple statements on one line when that improves readability.
28
+ - Names are case-sensitive. Variable, constant, property, and function names must start with a letter and contain only letters, numbers, and underscores.
29
+ - Declare every `var`, `const`, and property in `on init`.
30
+ - Numeric values and variables are 32-bit integers. Limited floating-point calculations are available through the conversion functions described below, but floating-point variables and arrays do not exist.
31
+ - The documented control-flow forms are `if ... [else if ...] [else ...] end if`, `select ... case ... end select`, and `while ... end while`. The reference does not define `then` or `for` syntax.
32
+ - Both `=` and `==` test equality. Prefer the canonical examples' `=` form.
33
+ - `return` immediately exits the current callback or user-defined function and may be used inside a conditional.
34
+ - User-defined functions use `function <name> ... end function`, are declared outside callbacks before first use, and are invoked by name without parentheses. The documented syntax has no parameters or return values.
35
+ - Properties expose user-editable or display values. Use documented property declarations such as `prop_array`, `prop_boolean`, `prop_decibels`, `prop_exp`, `prop_linear`, `prop_meter`, `prop_squared`, `prop_stepped`, `prop_text`, and `prop_waveform`; declarations such as `prop_int`, `prop_float`, `prop_string`, and `prop_voice` are not documented. See [properties.md](./references/properties.md).
36
+ - Use `'` for a comment through the end of a line and `{ ... }` for a block comment.
37
+
38
+ ### Callbacks
39
+
40
+ Every script is organized into callbacks — blocks of code that run in response to events.
41
+
42
+ ```
43
+ on init
44
+ ' Runs once when script loads. Declare all variables and properties here.
45
+ end on
46
+
47
+ on note
48
+ ' Runs when a MIDI note-on is received. Voices start when callback returns or delay() is called.
49
+ end on
50
+
51
+ on release
52
+ ' Runs when a MIDI note-off is received.
53
+ end on
54
+
55
+ on controller
56
+ ' Runs when a MIDI CC value changes. Check EVENT_CC for which controller.
57
+ end on
58
+
59
+ on poly_at
60
+ ' Runs on polyphonic aftertouch. Check POLY_AT_KEY for the key.
61
+ end on
62
+
63
+ on program_change
64
+ ' Runs on MIDI program change. Read MIDI_PROGRAM.
65
+ end on
66
+
67
+ on transport
68
+ ' Runs when host playback starts/stops.
69
+ end on
70
+
71
+ on <property_name>
72
+ ' Runs when a declared property changes value.
73
+ end on
74
+
75
+ on new_event
76
+ ' Runs when trigger_new_event() fires.
77
+ end on
78
+
79
+ on mapping_changed
80
+ ' Runs when a zone, mapping, or sample changes.
81
+ end on
82
+
83
+ on midi_drag
84
+ ' Runs when user drags MIDI data from instrument. Fill MIDI_DRAG_DATA.
85
+ end on
86
+
87
+ on chord_changed
88
+ ' Runs when host sends chord info.
89
+ end on
90
+
91
+ on section_changed
92
+ ' Runs when host sends song section info.
93
+ end on
94
+
95
+ on io_changed
96
+ ' Runs when a Rack Extension audio output is connected or disconnected.
97
+ end on
98
+ ```
99
+
100
+ ### Variables
101
+
102
+ ```
103
+ on init
104
+ var x ' integer variable, default 0
105
+ var name$ = "hello" ' string variable
106
+ var arr[10] ' array of 10 integers (index 0-9)
107
+ var init_arr[4] = (1,2,3,4) ' array with initial values
108
+ const MAX = 128 ' constant (read-only)
109
+ var shared["My Data File"] ' array backed by a Data File module
110
+ end on
111
+ ```
112
+
113
+ - All `var` and `const` must be in `on init`
114
+ - Values are 32-bit signed integers
115
+ - String variables end with `$` or are initialized with a string
116
+
117
+ ### Functions
118
+
119
+ ```
120
+ function my_function
121
+ ' code here — inlined at call site, zero performance cost
122
+ end function
123
+
124
+ on note
125
+ if EVENT_KEY < 60
126
+ return
127
+ end if
128
+ my_function
129
+ end on
130
+ ```
131
+
132
+ - Define outside callbacks, before first use
133
+ - The documented declaration has no parameters or return value
134
+ - `return` exits the current function or callback immediately
135
+ - Always inlined — no call overhead
136
+
137
+ ### Control Flow
138
+
139
+ ```
140
+ ' If/Else
141
+ if x > 10
142
+ ' ...
143
+ else if x > 5
144
+ ' ...
145
+ else
146
+ ' ...
147
+ end if
148
+
149
+ ' Select/Case
150
+ select x
151
+ case 0
152
+ ' ...
153
+ case 1 to 5
154
+ ' ...
155
+ case 10
156
+ ' ...
157
+ end select
158
+
159
+ ' While loop
160
+ while x < 100
161
+ inc(x)
162
+ end while
163
+ ```
164
+
165
+ ### Operators
166
+
167
+ | Operator | Description |
168
+ | ------------------------ | ---------------------------------------------------------- |
169
+ | `+`, `-`, `*`, `/` | Arithmetic (integer division rounds down, div by 0 = 0) |
170
+ | `mod` | Modulus (remainder) |
171
+ | `<<`, `>>` | Bit shift left/right |
172
+ | `.and.`, `.or.`, `.not.` | Bitwise AND, OR, NOT |
173
+ | `and`, `or`, `not` | Logical operators (in conditions) |
174
+ | `=`, `==` | Equal (both forms are documented) |
175
+ | `!=`, `<>` | Not equal |
176
+ | `<`, `>`, `<=`, `>=` | Comparison |
177
+ | `&` | String concatenation |
178
+
179
+ ### Math Functions
180
+
181
+ | Function | Description |
182
+ | ----------------------- | ---------------------------------------- |
183
+ | `abs(x)` | Absolute value |
184
+ | `inc(x)` | Increment by 1 (faster than `x = x + 1`) |
185
+ | `dec(x)` | Decrement by 1 |
186
+ | `in_range(x, min, max)` | Returns 1 if min ≤ x ≤ max |
187
+ | `random(min, max)` | Random integer in [min, max] |
188
+
189
+ ### Floating-Point (Single-Line Only)
190
+
191
+ ```
192
+ x = real_to_int(int_to_real(a) * sin(int_to_real(b) / int_to_real(1000)))
193
+ ```
194
+
195
+ Available in float expressions: `sin`, `cos`, `tan`, `asin`, `acos`, `atan`, `exp`, `log`, `pow`, `sqrt`, `ceil`, `floor`, `round`.
196
+
197
+ Use `real_to_int(realValue)` to convert a result back to an integer or `real_to_string(realValue, decimalPlaces)` to convert it to text. No float variables or arrays exist; floats are limited to a single expression.
198
+
199
+ ### String Functions
200
+
201
+ | Function | Description |
202
+ | ------------------------------- | -------------------------------------- |
203
+ | `string_find(str, sub, start)` | Find substring, returns position or -1 |
204
+ | `string_length(str)` | Character count |
205
+ | `string_range(str, start, len)` | Extract substring |
206
+ | `character_code(str, pos)` | ASCII code at position |
207
+ | `&` | Concatenate strings and numbers |
208
+
209
+ ### Array Utilities
210
+
211
+ | Function | Description |
212
+ | -------------------------------------------- | ------------------------------------ |
213
+ | `array_copy(src, dest)` | Copy array contents |
214
+ | `array_equal(a, b)` | Returns 1 if same length and content |
215
+ | `array_fill(src[start], dest[start], count)` | Copy/fill range (same array OK) |
216
+ | `array_find(arr, value)` | First index of value, or -1 |
217
+ | `array_find_range(arr[start], value, count)` | Find in range |
218
+ | `array_find_max(arr[start], count)` | Maximum in range |
219
+ | `array_find_min(arr[start], count)` | Minimum in range |
220
+ | `array_find_difference(a[start], b[start])` | First differing index, or -1 |
221
+ | `array_length(arr)` | Declared size |
222
+ | `array_sort(arr, dir)` | 0=ascending, 1=descending; -N sorts the first N ascending |
223
+ | `array_sum(arr, start, count)` | Sum a range |
224
+ | `load_array(arr, nameOrIndex)` | Load from Data File module |
225
+ | `save_array(arr, nameOrIndex)` | Save to Data File module |
226
+ | `load_midi_file(nameOrIndex)` | Select MIDI File module; returns its index or -1 |
227
+
228
+ ### Comments
229
+
230
+ ```
231
+ ' Single-line comment (everything after single quote)
232
+ { Block comment
233
+ spanning multiple lines }
234
+ ```
235
+
236
+ ### Line Continuation
237
+
238
+ ```
239
+ var long_array[8] = ( 1, 2, 3, 4, ...
240
+ 5, 6, 7, 8 )
241
+ ```
242
+
243
+ Use `...` at end of line to continue on next line.
244
+
245
+ ### Conditional Compilation
246
+
247
+ ```
248
+ USE_CODE_IF(FEATURE_X)
249
+ ' Only compiled if "FEATURE_X" is in Script Defines
250
+ END_USE_CODE
251
+
252
+ USE_CODE_IF_NOT(DEBUG)
253
+ ' Only compiled if "DEBUG" is NOT in Script Defines
254
+ END_USE_CODE
255
+ ```
256
+
257
+ ### Printing / Debugging
258
+
259
+ ```
260
+ print("value is " & x) ' Print to status line and debug window
261
+ print_active_events() ' Debug only; do not use in a released product
262
+ ```
263
+
264
+ ### Optimization Tips
265
+
266
+ - `inc(x)` / `dec(x)` faster than `x = x + 1`
267
+ - `if x` is shorthand for `if x != 0` (faster)
268
+ - Combine expressions: `a = 3 * x + 1` instead of two statements
269
+ - Constant expressions like `10 * MAX_VEL` are precomputed at compile time
270
+ - Functions are always inlined — no overhead
271
+ - Check most likely `case` values first
272
+
273
+ ---
274
+
275
+ ## Reference Files
276
+
277
+ **Load before writing code — not after something breaks.** If you have not verified a parameter's encoding in this session, look it up **first**.
278
+
279
+ | Topic | File | When to load |
280
+ | ------------------ | ----------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
281
+ | Core modules | [module-reference-core.md](./references/module-reference-core.md) | Instrument, Script, Group, Zone, trigger Conditions |
282
+ | Modulation modules | [module-reference-modulation.md](./references/module-reference-modulation.md) | ADSR Env, Custom Env, LFO, Step Seq, Mod Routing parameters |
283
+ | Voice effects | [module-reference-voice-effects.md](./references/module-reference-voice-effects.md) | **Load before scripting any oscillator or filter** — per-voice filters, oscillators, and voice-level FX parameters; contains known footguns (e.g. oscillator Tune is absolute frequency, not a semitone offset) |
284
+ | Bus effects | [module-reference-bus-effects.md](./references/module-reference-bus-effects.md) | Effect Bus, Effect Mod, and all bus-level effect parameters |
285
+ | Misc modules | [module-reference-misc.md](./references/module-reference-misc.md) | Voice Group, Alternate Mapping, Wavetable, MIDI File, Data File parameters |
286
+ | Properties | [properties.md](./references/properties.md) | Declaring UI-bound parameters (prop_linear, prop_exp, prop_boolean, etc.) |
287
+ | Note Events | [note-events.md](./references/note-events.md) | MIDI note handling, new_note, set_tune, set_vol, fade_in/out, groups, set_controller CC bridge |
288
+ | Module Control | [module-control.md](./references/module-control.md) | `set_module_param`, parameter addressing, ranges, and module-specific encoding |
289
+ | Modulation | [modulation.md](./references/modulation.md) | Mod sources, mod routing, mod matrix, set_mod_dest, ADSR/LFO/StepSeq |
290
+ | Effects & Filters | [effects-filters.md](./references/effects-filters.md) | Voice effects, bus effects, filter types, oscillators, effect bus routing |
291
+ | Time & Tempo | [time-tempo.md](./references/time-tempo.md) | delay, delay_ppq, tempo sync, song position, transport |
292
+ | Script Patterns | [script-patterns.md](./references/script-patterns.md) | Arpeggiators, mono/legato/glide, round robins, crossfades, step sequencers, velocity curves, sliced loops |
293
+ | Instrument Files | [instrument-files.md](./references/instrument-files.md) | Format, handling, basic audio routing |
294
+ | Index Derivation | [indexing.md](./references/indexing.md) | Deriving any M_XXX index from the .inst file; 0 vs 1 base rules; per-group scope of M_FILTER/M_MOD_SRC/M_MOD |
295
+ | Quick Start | [key-rules.md](./references/key-rules.md) | Minimal script and instrument examples |
@@ -0,0 +1,186 @@
1
+ # Effects & Filters Reference
2
+
3
+ ## Voice Effects (per-voice, in Groups)
4
+
5
+ Voice effects are inserted in Groups and process audio individually for each voice. Addressed as `M_FILTER+n` (from 1).
6
+
7
+ ### Filter Types
8
+
9
+ | Module | Description | Key Params |
10
+ |--------|-------------|------------|
11
+ | LP6 Filter | 1-pole (6 dB/oct) lowpass. Lowest CPU. | Cutoff, Key Tracking |
12
+ | LP12 Filter | 2-pole (12 dB/oct) lowpass | Cutoff, Resonance, Key Tracking |
13
+ | LP24 Filter | 4-pole (24 dB/oct) lowpass | Cutoff, Resonance, Key Tracking |
14
+ | HP6 Filter | 1-pole (6 dB/oct) highpass | Cutoff, Key Tracking |
15
+ | HP12 Filter | 2-pole (12 dB/oct) highpass | Cutoff, Resonance, Key Tracking |
16
+ | BP6 Filter | 2-pole (6 dB/oct) bandpass | Cutoff, Bandwidth, Key Tracking |
17
+ | Ladder Filter | 4-pole vintage analog simulation | Cutoff, Resonance, Key Tracking, Type |
18
+ | State-Variable Filter | 2-pole multi-mode vintage analog | Cutoff, Resonance, Key Tracking, Type (LP/HP/BP/Notch) |
19
+ | Multi-Mode Filter | General purpose up to 4-pole | Cutoff, Resonance, Key Tracking, Type, Slope |
20
+ | MS12 Filter | 2-pole vintage analog | Cutoff, Resonance, Key Tracking, Type |
21
+ | Damping Filter | Acoustic damping simulation | Cutoff, Key Tracking. More natural than filter sweep. |
22
+ | Comb Filter | Delay line with feedback | Cutoff, Feedback, Damping, Key Tracking, Mix |
23
+
24
+ ### Oscillators (Voice Effects)
25
+
26
+ | Module | Description |
27
+ |--------|-------------|
28
+ | Analog Oscillator | Multi-waveform (Saw, Square, Tri, Sine) + sub oscillator |
29
+ | FM Oscillator | 4-operator FM synth with customizable algorithm |
30
+ | Sample Oscillator | Sample playback with optional granular mode |
31
+ | Sine Oscillator | Pure sine wave |
32
+ | Super Oscillator | Multi-saw (unison) + sub |
33
+ | Wavetable Oscillator | Arbitrary waveform from Wavetable modules |
34
+
35
+ ### Other Voice Effects
36
+
37
+ | Module | Description |
38
+ |--------|-------------|
39
+ | Gain | Volume control between inserts |
40
+ | Send | Route to output or effect bus |
41
+ | Shaper | Waveshaping with custom curve |
42
+ | Waveshaper | Waveshaping with preset curves |
43
+ | Lo-Fi | Sample rate reduction |
44
+ | Limiter | Safety limiter per voice |
45
+ | EQ Band | Single parametric EQ |
46
+ | Shelf EQ | High/low shelving EQ |
47
+ | Frequency Shifter | Bode frequency shift |
48
+ | Stereo Matrix | Channel routing matrix |
49
+ | Downmix | Multi-channel to stereo |
50
+ | Crossfade | Fade between sample channels |
51
+ | Envelope Follower | Follow audio level as mod source |
52
+ | Timestretch | Timestretching per voice |
53
+ | Compressor | Dynamic range control |
54
+ | Granulate | Granular processing |
55
+ | Phase Modulator | Modulated delay (chorus/flanger/comb) |
56
+ | Tail Loop | Create loop from playback |
57
+ | Teleport | Transfer audio between voices |
58
+ | Mod Shaper | Warp modulation signals |
59
+ | Mod Waveform | Use sample waveform as mod source |
60
+
61
+ ### Controlling Voice Effects from Script
62
+
63
+ ```
64
+ ' Bypass = param 1 for ALL voice effects (filters, oscillators, utilities alike).
65
+ ' First meaningful control = param 2: Cutoff for filters, Tune for oscillators,
66
+ ' first DSP param for utilities (e.g. Level for Gain). Verify with Shift+Copy.
67
+ ' Set filter cutoff (param 2) and resonance (param 3) on Group 0, Filter 1
68
+ set_module_param(M_GROUP+0, M_FILTER+1, 0, 2, cutoffValue)
69
+ set_module_param(M_GROUP+0, M_FILTER+1, 0, 3, resoValue)
70
+
71
+ ' Set oscillator parameters
72
+ set_module_param(M_GROUP+0, M_FILTER+1, 0, 3, 2) ' Waveform = Saw (stepped param)
73
+
74
+ ' Enable/disable a voice effect via its mod routing
75
+ set_module_param(M_GROUP+0, M_FILTER+1, M_MOD+1, 1, 0) ' disable mod routing
76
+ ```
77
+
78
+ ## Bus Effects (post-voice, in Effect Busses)
79
+
80
+ Bus effects process the mixed output of all voices routed to that bus. Addressed as `M_EFFECT+n` (from 1) within a bus `M_BUS+n`.
81
+
82
+ ### Common Bus Effects
83
+
84
+ | Module | Description |
85
+ |--------|-------------|
86
+ | Reverb | Algorithmic reverb |
87
+ | Reverb2 | Alternative reverb algorithm |
88
+ | Non-Linear Reverb | Gated/reverse reverb |
89
+ | Convolution | Convolution reverb (IR-based) |
90
+ | Delay | Stereo delay with sync |
91
+ | Multi-Tap Delay | Multi-tap delay |
92
+ | Chorus | Chorus effect |
93
+ | Flanger | Flanger effect |
94
+ | Phaser | Phaser effect |
95
+ | Distortion | Distortion |
96
+ | Overdrive | Overdrive |
97
+ | Saturation | Saturation |
98
+ | Lo-Fi | Bit/sample rate reduction |
99
+ | Compressor | Dynamics compressor |
100
+ | Bus Compressor | Bus/glue compressor |
101
+ | Multi-Band Compressor | Multi-band dynamics |
102
+ | Limiter | Brick-wall limiter |
103
+ | Gate | Noise gate |
104
+ | EQ | Parametric EQ |
105
+ | Isolator EQ | DJ-style isolator |
106
+ | Filter | Master filter |
107
+ | Master Filter | Resonant master filter |
108
+ | Frequency Shifter | Bode shift |
109
+ | Grain Pitch | Granular pitch shift |
110
+ | Guitar Amp | Amp simulation |
111
+ | Rotary | Leslie cabinet simulation |
112
+ | Tremolo/Pan | Tremolo and auto-pan |
113
+ | Vocoder | Vocoder |
114
+ | Pan | Stereo panning |
115
+ | Send | Route to another bus |
116
+ | Sub Bass | Sub bass enhancer |
117
+ | Transient | Transient shaper |
118
+ | Resonators | Resonator bank |
119
+ | Beat Cutter | Beat slicing effects |
120
+ | Crossover | Frequency crossover |
121
+ | Multi-Band Distortion | Per-band distortion |
122
+ | Pitch Shifter | Pitch shifting |
123
+ | Sample Player | Bus-level sample playback |
124
+ | Audio Meter | Level metering |
125
+ | Envelope Follower | Bus-level envelope following |
126
+
127
+ ### Controlling Bus Effects from Script
128
+
129
+ ```
130
+ ' Set delay time on Bus 1, Effect 1
131
+ set_module_param(M_BUS+1, M_EFFECT+1, 0, 2, delayTime)
132
+
133
+ ' Set delay sync
134
+ set_module_param(M_BUS+1, M_EFFECT+1, 0, 3, syncOn)
135
+
136
+ ' Bypass an effect (param 1)
137
+ set_module_param(M_BUS+1, M_EFFECT+1, 0, 1, 1) ' bypass on
138
+ set_module_param(M_BUS+1, M_EFFECT+1, 0, 1, 0) ' bypass off
139
+
140
+ ' Reverb mix on Bus 1, Effect 2
141
+ set_module_param(M_BUS+1, M_EFFECT+2, 0, 2, mixValue)
142
+
143
+ ' Reorder effects in a bus
144
+ var order[3] = (3, 2, 1) ' reverse the order of 3 effects
145
+ set_effect_order(M_BUS+1, order)
146
+ ```
147
+
148
+ ## Effect Bus Routing
149
+
150
+ - Groups route audio to buses via the Group **Output** parameter
151
+ - Buses can route to other buses via Bus **Output** parameter
152
+ - Voice-level sends: use Voice Effect: Send
153
+ - Bus-level sends: use Bus Effect: Send
154
+
155
+ ```
156
+ ' Route Group 0 output to Bus 2 (param 7 = Output)
157
+ set_module_param(M_GROUP+0, 0, 0, 7, 2) ' stepped: bus number
158
+ ```
159
+
160
+ ## Effect Bus Parameters
161
+
162
+ | Index | Parameter | Description |
163
+ |-------|-----------|-------------|
164
+ | 1 | Name | Bus name |
165
+ | 2 | Volume | Bus output volume |
166
+ | 3 | Output | Output destination (audio out or another bus) |
167
+ | 4 | Mute | Mute the bus |
168
+ | 5 | Solo | Solo the bus |
169
+
170
+ ## Latency Reporting
171
+
172
+ Some effects (like Pitch Shift) introduce latency. Report total to host:
173
+
174
+ ```
175
+ on init
176
+ const LatencyParam = find_module_param(M_BUS+1, M_EFFECT+1, 0, "Latency")
177
+ var latency
178
+ end on
179
+
180
+ on controller
181
+ if EVENT_CC = 123 ' audio restart
182
+ get_module_param(M_BUS+1, M_EFFECT+1, 0, LatencyParam, latency)
183
+ declare_latency(latency)
184
+ end if
185
+ end on
186
+ ```
@@ -0,0 +1,129 @@
1
+ # Index Derivation Cheat Sheet
2
+
3
+ Every script constant (`M_GROUP`, `M_FILTER`, `M_BUS`, etc.) maps directly to an **array position** in the `.inst` JSON file. Read the file, count positions, apply the formula.
4
+
5
+ > ⚠ **Critical gotcha — the only 0-based constants:**
6
+ > `M_GROUP` and `M_VGROUP` are the **only** 0-based constants.
7
+ > Every other constant (`M_BUS`, `M_FILTER`, `M_MOD_SRC`, `M_MOD`, `M_EFFECT`, `M_COND`, `M_MAPPING`, `M_SCRIPT`, `M_MIDI`, `M_DATA`, `M_ZONE`) starts at **1**.
8
+
9
+ ---
10
+
11
+ ## Complete Derivation Table
12
+
13
+ `n` = 0-based position of the item in its JSON array (first item = 0, second = 1, …)
14
+
15
+ | `.inst` JSON array | Script constant | Base | Formula | Example (first item) |
16
+ |---|---|---|---|---|
17
+ | `"Groups"[n]` | `M_GROUP` | **0** | `M_GROUP+n` | `M_GROUP+0` |
18
+ | `"Voice Groups"[n]` | `M_VGROUP` | **0** | `M_VGROUP+n` | `M_VGROUP+0` (= Instrument Voices) |
19
+ | `"FX Busses"[n]` | `M_BUS` | 1 | `M_BUS+(n+1)` | `M_BUS+1` |
20
+ | `"Mappings"[n]` | `M_MAPPING` | 1 | `M_MAPPING+(n+1)` | `M_MAPPING+1` |
21
+ | `"Scripts"[n]` | `M_SCRIPT` | 1 | `M_SCRIPT+(n+1)` | `M_SCRIPT+1` |
22
+ | `"MIDI Files"[n]` | `M_MIDI` | 1 | `M_MIDI+(n+1)` | `M_MIDI+1` |
23
+ | `"Data Files"[n]` | `M_DATA` | 1 | `M_DATA+(n+1)` | `M_DATA+1` |
24
+ | group `"Conditions"[n]` | `M_COND` | 1 | `M_COND+(n+1)` | `M_COND+1` |
25
+ | group `"ModSources"[n]` | `M_MOD_SRC` | 1 | `M_MOD_SRC+(n+1)` | `M_MOD_SRC+1` |
26
+ | group `"Filters"[n]` | `M_FILTER` | 1 | `M_FILTER+(n+1)` | `M_FILTER+1` |
27
+ | group `"Zones"[n]` | `M_ZONE` | 1 | `M_ZONE+(n+1)` | `M_ZONE+1` |
28
+ | group `"ModRoutings"[n]` | `M_MOD` | 1 | `M_MOD+(n+1)` | `M_MOD+1` |
29
+ | bus `"Effects"[n]` | `M_EFFECT` | 1 | `M_EFFECT+(n+1)` | `M_EFFECT+1` |
30
+
31
+ ---
32
+
33
+ ## Per-Group Scope
34
+
35
+ `M_FILTER`, `M_MOD_SRC`, `M_MOD`, `M_COND`, and `M_ZONE` are **relative to their group**. The same index in two different groups refers to two completely different modules:
36
+
37
+ ```
38
+ ' M_FILTER+1 in Group 0 → first item in Groups[0].Filters[]
39
+ set_module_param(M_GROUP+0, M_FILTER+1, 0, 2, Cutoff) ' Bypass = param 1, Cutoff = param 2
40
+
41
+ ' M_FILTER+1 in Group 1 → first item in Groups[1].Filters[] — different module type entirely
42
+ set_module_param(M_GROUP+1, M_FILTER+1, 0, 2, Cutoff) ' Bypass = param 1, Cutoff = param 2
43
+ ```
44
+
45
+ Always derive indices **per group** when reading the `.inst` file.
46
+
47
+ ---
48
+
49
+ ## Worked Example
50
+
51
+ Given this `.inst` structure:
52
+
53
+ ```json
54
+ {
55
+ "Groups": [
56
+ {
57
+ "Module": "Group", "Name": "Synth",
58
+ "ModSources": [ { "Module": "ModSourceADSR" }, { "Module": "ModSourceLFO" } ],
59
+ "ModRoutings": [ { "Module": "ModRouting" }, { "Module": "ModRouting" } ],
60
+ "Filters": [ { "Module": "FilterAnalogOsc" }, { "Module": "FilterLP12" } ]
61
+ },
62
+ {
63
+ "Module": "Group", "Name": "Sub",
64
+ "ModSources": [ { "Module": "ModSourceADSR" } ],
65
+ "ModRoutings": [ { "Module": "ModRouting" } ],
66
+ "Filters": [ { "Module": "FilterSineOsc" } ]
67
+ }
68
+ ],
69
+ "Voice Groups": [
70
+ { "Module": "VoiceGroup" }
71
+ ],
72
+ "FX Busses": [
73
+ { "Module": "EffectBus", "Name": "Reverb Bus", "Effects": [ { "Module": "EffectReverb" }, { "Module": "EffectDelay" } ] },
74
+ { "Module": "EffectBus", "Name": "Master", "Effects": [ { "Module": "EffectLimiter" } ] }
75
+ ],
76
+ "Mappings": [
77
+ { "Module": "Mapping", "Name": "RR2" }
78
+ ],
79
+ "Scripts": [
80
+ { "Module": "Script", "Script Path": "script.txt" }
81
+ ]
82
+ }
83
+ ```
84
+
85
+ Derived indices:
86
+
87
+ | Item | Derived index |
88
+ |---|---|
89
+ | Group "Synth" | `M_GROUP+0` |
90
+ | Group "Sub" | `M_GROUP+1` |
91
+ | Instrument Voices | `M_VGROUP+0` |
92
+ | FX Bus "Reverb Bus" | `M_BUS+1` |
93
+ | FX Bus "Master" | `M_BUS+2` |
94
+ | Mapping "RR2" | `M_MAPPING+1` |
95
+ | Script | `M_SCRIPT+1` |
96
+ | Group 0 — ADSR (ModSourceADSR) | `M_GROUP+0, M_MOD_SRC+1` |
97
+ | Group 0 — LFO (ModSourceLFO) | `M_GROUP+0, M_MOD_SRC+2` |
98
+ | Group 0 — first ModRouting | `M_GROUP+0, … M_MOD+1` |
99
+ | Group 0 — second ModRouting | `M_GROUP+0, … M_MOD+2` |
100
+ | Group 0 — Analog Oscillator | `M_GROUP+0, M_FILTER+1` |
101
+ | Group 0 — LP12 Filter | `M_GROUP+0, M_FILTER+2` |
102
+ | Group 1 — ADSR | `M_GROUP+1, M_MOD_SRC+1` |
103
+ | Group 1 — Sine Oscillator | `M_GROUP+1, M_FILTER+1` |
104
+ | Bus 1 — Reverb | `M_BUS+1, M_EFFECT+1` |
105
+ | Bus 1 — Delay | `M_BUS+1, M_EFFECT+2` |
106
+ | Bus 2 — Limiter | `M_BUS+2, M_EFFECT+1` |
107
+
108
+ ---
109
+
110
+ ## Quick Formula Summary
111
+
112
+ ```
113
+ ' 0-based (only these two):
114
+ M_GROUP+0 → Groups[0]
115
+ M_VGROUP+0 → Voice Groups[0]
116
+
117
+ ' 1-based (everything else):
118
+ M_BUS+1 → FX Busses[0] (position 0 → index 1)
119
+ M_FILTER+1 → group.Filters[0]
120
+ M_MOD_SRC+1 → group.ModSources[0]
121
+ M_MOD+1 → group.ModRoutings[0]
122
+ M_EFFECT+1 → bus.Effects[0]
123
+ M_MAPPING+1 → Mappings[0]
124
+ M_COND+1 → group.Conditions[0]
125
+ M_ZONE+1 → group.Zones[0]
126
+ M_SCRIPT+1 → Scripts[0]
127
+ M_MIDI+1 → MIDI Files[0]
128
+ M_DATA+1 → Data Files[0]
129
+ ```