@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,210 @@
1
+ # Modulation Reference
2
+
3
+ ## Modulation Architecture
4
+
5
+ Each Group can contain:
6
+ - Up to **16 mod sources** (ADSR envelopes, Custom envelopes, LFOs, Step Sequencers)
7
+ - Up to **64 mod routings** connecting sources to destinations
8
+ - Up to **16 voice effects/filters** that can be modulation destinations
9
+
10
+ Mod routings in the instrument are set up in Gorilla Editor but can be fully controlled from script.
11
+
12
+ ## Mod Source Types
13
+
14
+ ### ADSR Envelope (ModSourceADSR)
15
+
16
+ Standard synthesizer envelope. Parameters:
17
+ 1. Name
18
+ 2. Attack (0–1,000,000 → exponential time)
19
+ 3. Attack Curve (-100% to +100%)
20
+ 4. Hold
21
+ 5. Decay (exponential time)
22
+ 6. Decay Curve (-100% to +100%)
23
+ 7. Sustain (0–1,000,000 = 0–100%)
24
+ 8. Release (exponential time)
25
+ 9. Release Curve (-100% to +100%)
26
+ 10. Hold End Level
27
+ 11. Times x10
28
+ 12. Tempo Sync
29
+
30
+ ```
31
+ ' Set ADSR Attack for first mod source in Group 0
32
+ set_module_param(M_GROUP+0, M_MOD_SRC+1, 0, 2, attackValue)
33
+
34
+ ' Set Sustain (param 7 — Decay Curve occupies param 6)
35
+ set_module_param(M_GROUP+0, M_MOD_SRC+1, 0, 7, sustainValue)
36
+ ```
37
+
38
+ ### LFO (ModSourceLFO)
39
+
40
+ Low Frequency Oscillator. Parameters:
41
+ 1. Name
42
+ 2. Wave (Sine, Triangle, Square, Saw, Random, Drift, Saw Up, Saw Exp)
43
+ 3. Rate (exponential: Hz)
44
+ 4. Sync (tempo sync on/off)
45
+ 5. Retrigger
46
+ 6. Start Phase
47
+ 7. Unipolar (0 = bipolar ±1, 1 = unipolar 0–1)
48
+
49
+ ```
50
+ set_module_param(M_GROUP+0, M_MOD_SRC+2, 0, 3, rateValue) ' LFO Rate
51
+ set_module_param(M_GROUP+0, M_MOD_SRC+2, 0, 4, syncOn) ' LFO Sync
52
+ set_module_param(M_GROUP+0, M_MOD_SRC+2, 0, 5, 1) ' Retrigger on
53
+ ```
54
+
55
+ ### Step Sequencer (ModSourceStepSeq)
56
+
57
+ Step sequence generator. Parameters include steps array, rate, sync, smooth, retrigger.
58
+
59
+ ### Custom Envelope (ModSourceCustom)
60
+
61
+ Multi-point customizable curve with editable points.
62
+
63
+ ## Mod Routing Parameters
64
+
65
+ Each mod routing (M_MOD+n) has these parameters:
66
+
67
+ | Index | Parameter | Description |
68
+ |-------|-----------|-------------|
69
+ | 1 | Active | Enable/disable routing |
70
+ | 2 | Source | Mod source index (see table below) |
71
+ | 3 | CC | MIDI CC number for CC-based sources |
72
+ | 4 | Invert | Invert the modulation signal |
73
+ | 5 | Depth | Modulation amount (0–1,000,000) |
74
+ | 6 | Smooth | Smoothing/glide time (0–1,000,000, exponential) |
75
+ | 7 | Dest | Destination parameter (in display order) |
76
+ | 8 | Curve Active | Enable curve shaping of the source signal. |
77
+ | 9 | Curve | Custom curve points applied to source when Curve Active is on. |
78
+ | 10 | Use MIDI Channel | Per-channel modulation (for MPE) |
79
+
80
+ ### Mod Source Index Values
81
+
82
+ | Index | Source |
83
+ |-------|--------|
84
+ | 0 | Constant |
85
+ | 1 | Random |
86
+ | 2 | Random (positive only) |
87
+ | 3 | Pitch Bend |
88
+ | 4 | Aftertouch |
89
+ | 5 | MIDI CC (specify CC number in param 3) |
90
+ | 6 | Key Position |
91
+ | 7 | Velocity |
92
+ | 8 | Release Velocity |
93
+ | 9 | Glide |
94
+ | 10 | Release Timer |
95
+ | FIRST_GROUP_MOD_SOURCE+0 | First group mod source (e.g., Amp Env) |
96
+ | FIRST_GROUP_MOD_SOURCE+1 | Second group mod source (e.g., LFO) |
97
+ | FIRST_GROUP_MOD_SOURCE+n | nth group mod source |
98
+
99
+ ## set_mod_dest — Scriptable Mod Matrix
100
+
101
+ ```
102
+ set_mod_dest(group, modRouting, subModule, dest, ampMod)
103
+ ```
104
+
105
+ Dynamically route a mod routing to any destination in the group.
106
+
107
+ - `group`: `M_GROUP+n`
108
+ - `modRouting`: `M_MOD+n`
109
+ - `subModule`: `M_GROUP` (group itself), `M_MOD_SRC+n`, or `M_FILTER+n`
110
+ - `dest`: Destination parameter index (from 1)
111
+ - `ampMod`: 0 = offset, 1 = scale
112
+
113
+ ```
114
+ ' Route Mod Routing 4 to Filter 2 Cutoff (param 2 — Bypass=1, Cutoff=2 for all voice effects)
115
+ set_mod_dest(M_GROUP+0, M_MOD+4, M_FILTER+2, 2, 0)
116
+
117
+ ' Route to Group Volume (param 3)
118
+ set_mod_dest(M_GROUP+0, M_MOD+5, M_GROUP, 3, 1)
119
+
120
+ ' Disable routing (dest 0)
121
+ set_mod_dest(M_GROUP+0, M_MOD+4, 0, 0, 0)
122
+ ```
123
+
124
+ > ⚠ The `dest` indices in `set_mod_dest` follow the same display-order numbering as `set_module_param`. Verify with Shift+Copy if unsure.
125
+
126
+ ## set_mod_sources — Analog-Style Triggering
127
+
128
+ ```
129
+ set_mod_sources(destEventID, sourceEventID, mask, retrig)
130
+ ```
131
+
132
+ Copy or retrigger envelope/LFO states between events.
133
+
134
+ - `mask`: Bitmask of mod sources (1=first, 2=second, 4=third, 8=fourth...)
135
+ - `retrig`: 0 = continue from current position, 1 = retrigger from start
136
+
137
+ ```
138
+ ' Retrigger all mod sources for mono legato
139
+ set_mod_sources(currentEvent, 0, 0xF, 0)
140
+
141
+ ' Copy mod source state from old event to new (for crossfade transitions)
142
+ set_mod_sources(newEvent, oldEvent, 1023, 0)
143
+
144
+ ' Retrigger just the amp envelope (first mod source)
145
+ set_mod_sources(currentEvent, 0, 1, 1)
146
+ ```
147
+
148
+ ## Mod Matrix Pattern
149
+
150
+ Complete example of a scriptable mod matrix:
151
+
152
+ ```
153
+ on init
154
+ const MOD_MATRIX = M_MOD + 4 ' first routing reserved for mod matrix
155
+
156
+ ' Define sources
157
+ const NUM_SOURCES = 5
158
+ const SourceNames[NUM_SOURCES] = ("Velocity", "Mod Wheel", "Aftertouch", "LFO", "Envelope")
159
+ const SourceIndex[NUM_SOURCES] = (7, 5, 4, FIRST_GROUP_MOD_SOURCE+1, FIRST_GROUP_MOD_SOURCE+2)
160
+ const SourceCC[NUM_SOURCES] = (1, 1, 1, 0, 0)
161
+
162
+ ' Define destinations
163
+ const NUM_DESTS = 4
164
+ const DestNames[NUM_DESTS] = ("-", "Cutoff", "Resonance", "Volume")
165
+ const DestModule[NUM_DESTS] = (0, M_FILTER+1, M_FILTER+1, 0)
166
+ const DestParam[NUM_DESTS] = (0, 2, 3, 3) ' Bypass=1, Cutoff=2, Resonance=3; Group Volume=3
167
+ const DestAmpMod[NUM_DESTS] = (0, 0, 0, 1)
168
+
169
+ ' Properties
170
+ prop_stepped Mod_Source
171
+ prop_squared Mod_Depth(-1000000, 1000000, -100, 100)
172
+ prop_stepped Mod_Dest
173
+
174
+ var i = 0
175
+ while i < NUM_SOURCES
176
+ add_step(Mod_Source, SourceNames[i])
177
+ inc(i)
178
+ end while
179
+ i = 0
180
+ while i < NUM_DESTS
181
+ add_step(Mod_Dest, DestNames[i])
182
+ inc(i)
183
+ end while
184
+ end on
185
+
186
+ on Mod_Source
187
+ set_module_param(M_GROUP+0, 0, MOD_MATRIX, 2, SourceIndex[Mod_Source])
188
+ set_module_param(M_GROUP+0, 0, MOD_MATRIX, 3, SourceCC[Mod_Source])
189
+ end on
190
+
191
+ on Mod_Depth
192
+ set_module_param(M_GROUP+0, 0, MOD_MATRIX, 4, Mod_Depth < 0)
193
+ set_module_param(M_GROUP+0, 0, MOD_MATRIX, 5, abs(Mod_Depth))
194
+ end on
195
+
196
+ on Mod_Dest
197
+ set_mod_dest(M_GROUP+0, MOD_MATRIX, DestModule[Mod_Dest], DestParam[Mod_Dest], DestAmpMod[Mod_Dest])
198
+ set_module_param(M_GROUP+0, 0, MOD_MATRIX, 1, Mod_Dest > 0) ' Active
199
+ end on
200
+ ```
201
+
202
+ ## Effect Modulation (EffectMod)
203
+
204
+ Bus effects can be modulated using EffectMod modules. These have:
205
+ - Source selection (CC, LFO, envelope follower, step LFO)
206
+ - Destination parameter selection
207
+ - Depth and smoothing
208
+ - Built-in step LFO with custom pattern
209
+
210
+ Controlled via `set_module_param(M_BUS+n, M_EFFECT+n, ...)` where the effect is an EffectMod.
@@ -0,0 +1,217 @@
1
+ # Module Control Reference
2
+
3
+ ## Module Path Constants
4
+
5
+ > ⚠ **0 vs 1 base rule** — `M_GROUP` and `M_VGROUP` are the **only** 0-based constants. Every other constant starts at **1**. For the complete derivation table and a worked example, see [indexing.md](./indexing.md).
6
+
7
+ Every module in the instrument is addressed by a path of constants:
8
+
9
+ | Constant | Description | Example |
10
+ |----------|-------------|---------|
11
+ | `M_INST` | Instrument module | `M_INST` |
12
+ | `M_GROUP` | Group (add index from 0) | `M_GROUP+0`, `M_GROUP+1` |
13
+ | `M_VGROUP` | Voice Group (add index from 0) | `M_VGROUP+0` = Instrument Voices |
14
+ | `M_BUS` | Effect Bus (add number from 1) | `M_BUS+1` |
15
+ | `M_MAPPING` | Mapping (add number from 1) | `M_MAPPING+1` |
16
+ | `M_MIDI` | MIDI File module (from 1) | `M_MIDI+1` |
17
+ | `M_DATA` | Data File module (from 1) | `M_DATA+1` |
18
+ | `M_SCRIPT` | Script module (from 1) | `M_SCRIPT+1` |
19
+
20
+ ### Sub-Module Constants
21
+
22
+ | Constant | Description | Example |
23
+ |----------|-------------|---------|
24
+ | `M_COND` | Trigger condition in group (from 1) | `M_COND+1` |
25
+ | `M_MOD_SRC` | Mod source in group (from 1) | `M_MOD_SRC+1` = first envelope/LFO |
26
+ | `M_FILTER` | Voice effect in group — filter, oscillator, or utility (from 1) | `M_FILTER+1` = first voice effect |
27
+ | `M_ZONE` | Zone in group/mapping (from 1) | `M_ZONE+1` |
28
+ | `M_EFFECT` | Bus effect (from 1) | `M_EFFECT+1` |
29
+ | `M_MOD` | Mod routing (from 1) | `M_MOD+1` |
30
+
31
+ `M_FILTER` is the historical address for every module in a Group's `Filters` array, including oscillators and voice-level utilities. When an editor name exists in both forms, use the JSON `"Module"` type to distinguish them: `Filter*` modules use `M_GROUP+n, M_FILTER+m`; `Effect*` modules use `M_BUS+n, M_EFFECT+m`.
32
+
33
+ ## set_module_param(module, subModule, modRouting, param, value)
34
+
35
+ Set a parameter in any instrument module.
36
+
37
+ - `module`: Module path (e.g., `M_GROUP+0`)
38
+ - `subModule`: Sub-module or 0 for the module itself
39
+ - `modRouting`: Mod routing or 0
40
+ - `param`: Parameter index (from 1, in Editor display order)
41
+ - `value`: Continuous sliders = 0 to 1,000,000; stepped = exact value; draggable floats = value × 1000
42
+
43
+ > ⚠ **String-type parameters (Name, paths, text fields) count toward param indices but are invisible in Shift+Copy output.** They still occupy a slot. The most common trap: `Instrument` has `Blob Path` (string) at param 3 between `Blob Number` (param 2) and `Volume` (param 4). Never count param indices from doc tables alone — always verify with Shift+Copy.
44
+
45
+ **Shift+Copy is the primary way to get param indices.** In Gorilla Editor, Shift+click Copy on any parameter to copy the exact `set_module_param()` call to clipboard. Do this before writing any `set_module_param()` call for a module you haven't verified before.
46
+
47
+ ### Examples
48
+
49
+ ```
50
+ ' Instrument Volume (param 4) — Name=1(str), Blob Number=2, Blob Path=3(str), Volume=4
51
+ set_module_param(M_INST, 0, 0, 4, 500000)
52
+
53
+ ' Group 0 Volume (param 3) — Name=1(str), Active=2, Volume=3
54
+ set_module_param(M_GROUP+0, 0, 0, 3, Volume)
55
+
56
+ ' Group 0, FilterLadder, Cutoff (param 2) — Bypass=1, Cutoff=2
57
+ ' NOTE: ALL voice effects have Bypass as param 1. Cutoff/first control is always param 2.
58
+ set_module_param(M_GROUP+0, M_FILTER+2, 0, 2, Cutoff)
59
+
60
+ ' Group 0, FilterLadder, Resonance (param 3)
61
+ set_module_param(M_GROUP+0, M_FILTER+2, 0, 3, Resonance)
62
+
63
+ ' Group 0, Mod Source 1 (ADSR), Attack (param 2) — Name=1(str), Attack=2
64
+ set_module_param(M_GROUP+0, M_MOD_SRC+1, 0, 2, Attack)
65
+
66
+ ' Group 0, Mod Source 1, Sustain (param 7)
67
+ ' ADSR order: Attack=2, AttackCurve=3, Hold=4, Decay=5, DecayCurve=6, Sustain=7, Release=8, ReleaseCurve=9
68
+ set_module_param(M_GROUP+0, M_MOD_SRC+1, 0, 7, Sustain)
69
+
70
+ ' Bus 1, Effect 1, parameter 2 (e.g. Delay Time)
71
+ set_module_param(M_BUS+1, M_EFFECT+1, 0, 2, DelayTime)
72
+
73
+ ' Bus 1, Effect 1, Bypass (param 1)
74
+ set_module_param(M_BUS+1, M_EFFECT+1, 0, 1, 1) ' bypass on
75
+ set_module_param(M_BUS+1, M_EFFECT+1, 0, 1, 0) ' bypass off
76
+
77
+ ' Mod Routing in Group: Source (param 2), CC (param 3), Depth (param 5), Smooth (param 6)
78
+ set_module_param(M_GROUP+0, 0, M_MOD+1, 2, 7) ' Source = Velocity
79
+ set_module_param(M_GROUP+0, 0, M_MOD+1, 5, 500000) ' Depth = 50%
80
+ set_module_param(M_GROUP+0, 0, M_MOD+1, 6, 250000) ' Smooth = 25%
81
+
82
+ ' Mod Routing inside a sub-module (e.g., mod routing inside a filter)
83
+ set_module_param(M_GROUP+0, M_FILTER+1, M_MOD+1, 5, Depth)
84
+
85
+ ' Group Alternate Mapping (param 16)
86
+ set_module_param(M_GROUP+0, 0, 0, 16, mappingValue)
87
+ ```
88
+
89
+ ## Tune Parameter Taxonomy
90
+
91
+ Different tune-related parameters use different encodings. Using the wrong one is a common source of silent frequency bugs.
92
+
93
+ | Goal | What to set | Encoding |
94
+ |---|---|---|
95
+ | Pitch-offset a key-tracked group (oscillator or sample) | Group Tune, param 5 | Signed int, 100,000/semitone (+1 octave = 1,200,000) |
96
+ | Fine-tune instrument globally | Instrument Tune, param 5 | Signed int, 100,000/semitone |
97
+ | Fixed-frequency oscillator (Keytrack Off) | Oscillator Tune, param 2 (Sine/Analog), param 3 (Super) — verify via Shift+Copy | Absolute Hz — not semitones |
98
+ | Pitch modulation via mod matrix | ModRouting Dest = "Tune", group-level | 0–1,000,000 depth; full depth = Pitch Bend Range in semitones |
99
+
100
+ > ⚠ **Oscillator Tune (FilterSineOsc, FilterAnalogOsc, FilterSuperOsc) is an absolute frequency parameter, not a semitone offset.** Setting it to 0 via `set_module_param` will collapse the oscillator to ~2 Hz regardless of Keytrack state. For key-tracked oscillators, use **Group Tune (param 5)** to offset pitch instead — it compounds correctly with key-tracking.
101
+
102
+ ### Bell partial example — per-group pitch offsets with Group Tune
103
+
104
+ ```
105
+ ' Tune 5 additive groups to inharmonic bell partials using Group Tune (param 5).
106
+ ' Group Tune is a semitone offset from the played key (100,000 per semitone, signed).
107
+ ' Oscillators in each group stay key-tracked — only the relative pitch offset changes.
108
+ const GRP_HUM = 0 ' -12 st (octave below fundamental)
109
+ const GRP_PRIME = 1 ' 0 st (fundamental)
110
+ const GRP_TIERCE = 2 ' +3 st (minor third above fundamental)
111
+ const GRP_QUINT = 3 ' +7 st (fifth above fundamental)
112
+ const GRP_NOMINAL = 4 ' +12 st (octave above fundamental)
113
+
114
+ set_module_param(M_GROUP+GRP_HUM, 0, 0, 5, -1200000)
115
+ set_module_param(M_GROUP+GRP_PRIME, 0, 0, 5, 0)
116
+ set_module_param(M_GROUP+GRP_TIERCE, 0, 0, 5, 300000)
117
+ set_module_param(M_GROUP+GRP_QUINT, 0, 0, 5, 700000)
118
+ set_module_param(M_GROUP+GRP_NOMINAL, 0, 0, 5, 1200000)
119
+ ```
120
+
121
+ ## get_module_param(module, subModule, modRouting, param, outVar)
122
+
123
+ Read a parameter value.
124
+
125
+ - If `outVar` is a variable: gets numeric value
126
+ - If `outVar` is a string variable: gets display text
127
+ - If `outVar` is an array and param is array-type: reads values into array
128
+ - Returns: number of values read (0 if failed)
129
+
130
+ ```
131
+ var value
132
+ get_module_param(M_BUS+1, M_EFFECT+1, 0, paramIndex, value)
133
+
134
+ var text$
135
+ get_module_param(M_GROUP+0, 0, 0, 1, text$) ' get display text
136
+ ```
137
+
138
+ ## set_module_params / get_module_params
139
+
140
+ Set or read ALL parameters of a module at once.
141
+
142
+ ```
143
+ var params[20]
144
+ get_module_params(M_GROUP+0, M_MOD_SRC+1, 0, params) ' first value = count
145
+
146
+ params[3] = 500000 ' change attack
147
+ set_module_params(M_GROUP+0, M_MOD_SRC+1, 0, params)
148
+ ```
149
+
150
+ ## find_module_param(module, subModule, modRouting, "name")
151
+
152
+ Find parameter index by name (case sensitive). Returns index or -1. **Cache the result in `on init`.**
153
+
154
+ ```
155
+ on init
156
+ const CutoffParam = find_module_param(M_GROUP+0, M_FILTER+1, 0, "Cutoff")
157
+ const LatencyParam = find_module_param(M_BUS+1, M_EFFECT+1, 0, "Latency")
158
+ end on
159
+ ```
160
+
161
+ ## get_module_param_name(module, subModule, modRouting, param)
162
+
163
+ Returns parameter name as string, or empty string if not found.
164
+
165
+ ## set_effect_order(bus, effectIndexes[startPos])
166
+
167
+ Reorder effects in a bus without changing their indexes.
168
+
169
+ ## Zone and Sample Functions
170
+
171
+ | Function | Description |
172
+ |----------|-------------|
173
+ | `get_num_zones(group)` | Zone count in group (negative for mapping) |
174
+ | `get_sample_length(zone)` | Sample length in μs |
175
+ | `num_slices_zone(zone)` | Number of slices |
176
+ | `zone_slice_start(zone, index)` | Slice position in μs |
177
+ | `zone_slice_length(zone, index)` | Slice length in μs at current tempo |
178
+ | `get_slice_length(group, zoneIndex)` | Slice Length param in μs |
179
+ | `find_zone(name)` | Find zone by sample path |
180
+
181
+ Zone ID for `get_sample_length()` etc.: use `prop_waveform` value or `1000000*groupIndex + zoneIndex`.
182
+
183
+ For mappings, use negative: `-1000000*mappingNumber + zoneIndex`.
184
+
185
+ ```
186
+ var zoneID = -1000000 + 1 ' mapping 1, zone 1
187
+ var length = get_sample_length(zoneID)
188
+ var start = zone_slice_start(zoneID, 0)
189
+ ```
190
+
191
+ ## Group Functions
192
+
193
+ | Function | Description |
194
+ |----------|-------------|
195
+ | `find_group("name")` | Returns group index or -1. Cache in `on init`. |
196
+ | `find_mapping("name")` | Returns mapping index or 0. Cache in `on init`. |
197
+ | `purge_group(group, loaded)` | Unload (0) or load (1) samples. `ALL_GROUPS` supported. |
198
+ | `declare_latency(frames)` | Report audio latency to host for PDC |
199
+
200
+ ## Inter-Script Communication
201
+
202
+ ```
203
+ ' Set parameter in another script
204
+ set_module_param(M_SCRIPT+2, 0, 0, paramIndex, value)
205
+
206
+ ' Read parameter from another script
207
+ get_module_param(M_SCRIPT+2, 0, 0, paramIndex, outVar)
208
+
209
+ ' Shared Data File
210
+ var Globals["My Data File"] ' declare in each script
211
+
212
+ ' Trigger event across scripts
213
+ trigger_new_event() ' fires on new_event in all scripts
214
+
215
+ ' Set EVENT_PARAMs for later scripts to read
216
+ set_event_param(EVENT_ID, EVENT_PARAM_0, myValue)
217
+ ```