@audiofab-io/fv1-core 0.2.2 → 0.4.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 (133) hide show
  1. package/blocks/ATL_DEVELOPER_REFERENCE.md +156 -0
  2. package/blocks/control/constant.atl +36 -0
  3. package/blocks/control/entropy_lfo.atl +74 -0
  4. package/blocks/control/envelope.atl +121 -0
  5. package/blocks/control/invert.atl +33 -0
  6. package/blocks/control/pot.atl +150 -0
  7. package/blocks/control/power.atl +77 -0
  8. package/blocks/control/ramp_lfo.atl +122 -0
  9. package/blocks/control/scale_offset.atl +84 -0
  10. package/blocks/control/sincos_lfo.atl +126 -0
  11. package/blocks/control/smoother.atl +48 -0
  12. package/blocks/control/tremolizer.atl +55 -0
  13. package/blocks/effects/delay/micro_stutter.atl +77 -0
  14. package/blocks/effects/delay/mn3011.atl +281 -0
  15. package/blocks/effects/delay/simple_delay.atl +96 -0
  16. package/blocks/effects/delay/triple_tap_delay.atl +176 -0
  17. package/blocks/effects/lo-fi/bit_mangler.atl +74 -0
  18. package/blocks/effects/lo-fi/chiptune.atl +311 -0
  19. package/blocks/effects/lo-fi/tape_degrade.atl +181 -0
  20. package/blocks/effects/modulation/chorus.atl +141 -0
  21. package/blocks/effects/modulation/chorus_4voice.atl +188 -0
  22. package/blocks/effects/modulation/flanger.atl +184 -0
  23. package/blocks/effects/modulation/guitar_synth.atl +350 -0
  24. package/blocks/effects/modulation/harmonic_trem.atl +129 -0
  25. package/blocks/effects/modulation/organ_synth.atl +326 -0
  26. package/blocks/effects/modulation/phaser.atl +300 -0
  27. package/blocks/effects/pitch/octave_up_down.atl +80 -0
  28. package/blocks/effects/pitch/pitch_offset.atl +149 -0
  29. package/blocks/effects/pitch/pitch_offset_dual.atl +197 -0
  30. package/blocks/effects/pitch/pitch_shift.atl +115 -0
  31. package/blocks/effects/pitch/sub_octave.atl +100 -0
  32. package/blocks/effects/reverb/ducking_reverb.atl +145 -0
  33. package/blocks/effects/reverb/min_reverb.atl +132 -0
  34. package/blocks/effects/reverb/plate_reverb.atl +344 -0
  35. package/blocks/effects/reverb/room_reverb.atl +293 -0
  36. package/blocks/effects/reverb/smear.atl +90 -0
  37. package/blocks/effects/reverb/spring_reverb.atl +353 -0
  38. package/blocks/filter/1p_high_pass.atl +63 -0
  39. package/blocks/filter/1p_low_pass.atl +59 -0
  40. package/blocks/filter/auto_wah.atl +207 -0
  41. package/blocks/filter/bbd_loss.atl +79 -0
  42. package/blocks/filter/shelving_high_pass.atl +76 -0
  43. package/blocks/filter/shelving_low_pass.atl +76 -0
  44. package/blocks/filter/svf_2p.atl +116 -0
  45. package/blocks/gain_mix/crossfade.atl +93 -0
  46. package/blocks/gain_mix/crossfade2.atl +86 -0
  47. package/blocks/gain_mix/crossfade3.atl +71 -0
  48. package/blocks/gain_mix/gainboost.atl +54 -0
  49. package/blocks/gain_mix/mixer2.atl +76 -0
  50. package/blocks/gain_mix/mixer3.atl +109 -0
  51. package/blocks/gain_mix/mixer4.atl +152 -0
  52. package/blocks/gain_mix/volume.atl +51 -0
  53. package/blocks/io/adc.atl +53 -0
  54. package/blocks/io/dac.atl +61 -0
  55. package/blocks/other/stickynote.atl +24 -0
  56. package/blocks/other/tone_gen_adjustable.atl +137 -0
  57. package/blocks/other/tone_gen_fixed.atl +109 -0
  58. package/dist/blockDiagram/blocks/BlockDirectoryLoader.d.ts +13 -0
  59. package/dist/blockDiagram/blocks/BlockDirectoryLoader.d.ts.map +1 -0
  60. package/dist/blockDiagram/blocks/BlockDirectoryLoader.js +44 -0
  61. package/dist/blockDiagram/blocks/BlockDirectoryLoader.js.map +1 -0
  62. package/dist/blockDiagram/blocks/BlockRegistry.d.ts +48 -0
  63. package/dist/blockDiagram/blocks/BlockRegistry.d.ts.map +1 -0
  64. package/dist/blockDiagram/blocks/BlockRegistry.js +109 -0
  65. package/dist/blockDiagram/blocks/BlockRegistry.js.map +1 -0
  66. package/dist/blockDiagram/blocks/TemplateBlock.d.ts +20 -0
  67. package/dist/blockDiagram/blocks/TemplateBlock.d.ts.map +1 -0
  68. package/dist/blockDiagram/blocks/TemplateBlock.js +82 -0
  69. package/dist/blockDiagram/blocks/TemplateBlock.js.map +1 -0
  70. package/dist/blockDiagram/blocks/base/BaseBlock.d.ts +248 -0
  71. package/dist/blockDiagram/blocks/base/BaseBlock.d.ts.map +1 -0
  72. package/dist/blockDiagram/blocks/base/BaseBlock.js +402 -0
  73. package/dist/blockDiagram/blocks/base/BaseBlock.js.map +1 -0
  74. package/dist/blockDiagram/builtinBlocks.d.ts +9 -0
  75. package/dist/blockDiagram/builtinBlocks.d.ts.map +1 -0
  76. package/dist/blockDiagram/builtinBlocks.js +4912 -0
  77. package/dist/blockDiagram/builtinBlocks.js.map +1 -0
  78. package/dist/blockDiagram/compiler/BlockTemplate.d.ts +37 -0
  79. package/dist/blockDiagram/compiler/BlockTemplate.d.ts.map +1 -0
  80. package/dist/blockDiagram/compiler/BlockTemplate.js +860 -0
  81. package/dist/blockDiagram/compiler/BlockTemplate.js.map +1 -0
  82. package/dist/blockDiagram/compiler/CodeOptimizer.d.ts +75 -0
  83. package/dist/blockDiagram/compiler/CodeOptimizer.d.ts.map +1 -0
  84. package/dist/blockDiagram/compiler/CodeOptimizer.js +443 -0
  85. package/dist/blockDiagram/compiler/CodeOptimizer.js.map +1 -0
  86. package/dist/blockDiagram/compiler/GraphCompiler.d.ts +63 -0
  87. package/dist/blockDiagram/compiler/GraphCompiler.d.ts.map +1 -0
  88. package/dist/blockDiagram/compiler/GraphCompiler.js +656 -0
  89. package/dist/blockDiagram/compiler/GraphCompiler.js.map +1 -0
  90. package/dist/blockDiagram/compiler/TopologicalSort.d.ts +63 -0
  91. package/dist/blockDiagram/compiler/TopologicalSort.d.ts.map +1 -0
  92. package/dist/blockDiagram/compiler/TopologicalSort.js +268 -0
  93. package/dist/blockDiagram/compiler/TopologicalSort.js.map +1 -0
  94. package/dist/blockDiagram/index.d.ts +30 -0
  95. package/dist/blockDiagram/index.d.ts.map +1 -0
  96. package/dist/blockDiagram/index.js +29 -0
  97. package/dist/blockDiagram/index.js.map +1 -0
  98. package/dist/blockDiagram/types/Block.d.ts +178 -0
  99. package/dist/blockDiagram/types/Block.d.ts.map +1 -0
  100. package/dist/blockDiagram/types/Block.js +5 -0
  101. package/dist/blockDiagram/types/Block.js.map +1 -0
  102. package/dist/blockDiagram/types/CodeGenContext.d.ts +235 -0
  103. package/dist/blockDiagram/types/CodeGenContext.d.ts.map +1 -0
  104. package/dist/blockDiagram/types/CodeGenContext.js +554 -0
  105. package/dist/blockDiagram/types/CodeGenContext.js.map +1 -0
  106. package/dist/blockDiagram/types/Connection.d.ts +17 -0
  107. package/dist/blockDiagram/types/Connection.d.ts.map +1 -0
  108. package/dist/blockDiagram/types/Connection.js +5 -0
  109. package/dist/blockDiagram/types/Connection.js.map +1 -0
  110. package/dist/blockDiagram/types/Graph.d.ts +28 -0
  111. package/dist/blockDiagram/types/Graph.d.ts.map +1 -0
  112. package/dist/blockDiagram/types/Graph.js +24 -0
  113. package/dist/blockDiagram/types/Graph.js.map +1 -0
  114. package/dist/blockDiagram/types/IR.d.ts +79 -0
  115. package/dist/blockDiagram/types/IR.d.ts.map +1 -0
  116. package/dist/blockDiagram/types/IR.js +6 -0
  117. package/dist/blockDiagram/types/IR.js.map +1 -0
  118. package/dist/blockDiagram/utils/SpinCADConverter.d.ts +17 -0
  119. package/dist/blockDiagram/utils/SpinCADConverter.d.ts.map +1 -0
  120. package/dist/blockDiagram/utils/SpinCADConverter.js +307 -0
  121. package/dist/blockDiagram/utils/SpinCADConverter.js.map +1 -0
  122. package/dist/effect/compileEffect.d.ts +51 -0
  123. package/dist/effect/compileEffect.d.ts.map +1 -0
  124. package/dist/effect/compileEffect.js +133 -0
  125. package/dist/effect/compileEffect.js.map +1 -0
  126. package/dist/index.d.ts +2 -0
  127. package/dist/index.d.ts.map +1 -1
  128. package/dist/index.js +2 -0
  129. package/dist/index.js.map +1 -1
  130. package/dist/simulator/FV1Simulator.d.ts.map +1 -1
  131. package/dist/simulator/FV1Simulator.js +7 -4
  132. package/dist/simulator/FV1Simulator.js.map +1 -1
  133. package/package.json +17 -5
@@ -0,0 +1,311 @@
1
+ ---
2
+ {
3
+ "type": "effects.novelty.chiptune",
4
+ "name": "Chip Tune",
5
+ "category": "Effects",
6
+ "subcategory": "Lo-Fi",
7
+ "description": "Commodore 64 SID chip emulator: Transforms your guitar into 8-bit chiptune glory with bit crushing, square-wave shaping, ring modulation, white noise, and the legendary SID resonant filter.",
8
+ "color": "#4466BB",
9
+ "width": 180,
10
+ "inputs": [
11
+ {
12
+ "id": "in",
13
+ "name": "Input",
14
+ "type": "audio",
15
+ "required": true
16
+ },
17
+ {
18
+ "id": "crushCV",
19
+ "name": "Crush",
20
+ "type": "control",
21
+ "required": false,
22
+ "parameter": "crush"
23
+ },
24
+ {
25
+ "id": "squareCV",
26
+ "name": "Square",
27
+ "type": "control",
28
+ "required": false,
29
+ "parameter": "square"
30
+ },
31
+ {
32
+ "id": "cutoffCV",
33
+ "name": "Cutoff",
34
+ "type": "control",
35
+ "required": false,
36
+ "parameter": "cutoff"
37
+ },
38
+ {
39
+ "id": "resoCV",
40
+ "name": "Resonance",
41
+ "type": "control",
42
+ "required": false,
43
+ "parameter": "resonance"
44
+ }
45
+ ],
46
+ "outputs": [
47
+ {
48
+ "id": "out",
49
+ "name": "Output",
50
+ "type": "audio"
51
+ }
52
+ ],
53
+ "parameters": [
54
+ {
55
+ "id": "crush",
56
+ "name": "Crush Depth",
57
+ "type": "number",
58
+ "default": 0.2,
59
+ "min": 0.005,
60
+ "max": 0.25,
61
+ "step": 0.005,
62
+ "description": "Sample-rate reduction intensity. Higher = more lo-fi 8-bit crunch."
63
+ },
64
+ {
65
+ "id": "square",
66
+ "name": "Square Drive",
67
+ "type": "number",
68
+ "default": 0.5,
69
+ "min": 0.0,
70
+ "max": 1.99,
71
+ "step": 0.01,
72
+ "description": "Blend from clean (0) to hard-clipped square pulse waveform (max)."
73
+ },
74
+ {
75
+ "id": "ring_freq",
76
+ "name": "Ring Mod",
77
+ "type": "number",
78
+ "default": 0.0,
79
+ "min": 0.0,
80
+ "max": 1.0,
81
+ "step": 0.01,
82
+ "description": "Ring modulator frequency. 0 = off. Adds metallic SID harmonics."
83
+ },
84
+ {
85
+ "id": "noise",
86
+ "name": "Noise Level",
87
+ "type": "number",
88
+ "default": 0.5,
89
+ "min": 0.0,
90
+ "max": 1.0,
91
+ "step": 0.01,
92
+ "description": "White noise generator level. Classic SID noise channel for hi-hats, snares, and static textures."
93
+ },
94
+ {
95
+ "id": "cutoff",
96
+ "name": "Filter Cutoff",
97
+ "type": "number",
98
+ "default": 3000,
99
+ "min": 60,
100
+ "max": 6000,
101
+ "step": 10,
102
+ "conversion": "SVFFREQ",
103
+ "description": "SID-style resonant low-pass filter cutoff frequency."
104
+ },
105
+ {
106
+ "id": "resonance",
107
+ "name": "Filter Resonance",
108
+ "type": "number",
109
+ "default": 4.0,
110
+ "min": 0.5,
111
+ "max": 20.0,
112
+ "step": 0.1,
113
+ "conversion": "SVF_DAMP",
114
+ "description": "Filter Q. Crank it for that classic SID filter sweep character."
115
+ },
116
+ {
117
+ "id": "mix",
118
+ "name": "Dry/Wet Mix",
119
+ "type": "number",
120
+ "default": 1.0,
121
+ "min": 0.0,
122
+ "max": 1.0,
123
+ "step": 0.01,
124
+ "description": "Blend between dry and SID-processed signal."
125
+ }
126
+ ],
127
+ "registers": [
128
+ "counter",
129
+ "held",
130
+ "squared",
131
+ "ring_sin",
132
+ "ring_cos",
133
+ "f_ring",
134
+ "ringmod",
135
+ "noise_reg",
136
+ "noise_dc",
137
+ "lp_state",
138
+ "bp_state",
139
+ "damp_reg",
140
+ "dry",
141
+ "wet",
142
+ "mix_val"
143
+ ]
144
+ }
145
+ ---
146
+ @section header
147
+ equ damp_target (${param.resonance})
148
+
149
+ @section init
150
+ ; Seed the ring mod oscillator (cos=0.5, sin=0)
151
+ ; Without this, the magic circle stays at zero forever!
152
+ sof 0.0, 0.5
153
+ wrax ${reg.ring_cos}, 0.0
154
+
155
+ ; Seed the noise LFSR with a non-zero, non-one starting value
156
+ sof 0.0, 0.3
157
+ wrax ${reg.noise_reg}, 0.0
158
+
159
+ @section main
160
+ @if pinConnected(in)
161
+
162
+ ; ======================================================
163
+ ; Stage 0: Save dry signal for mix
164
+ ; ======================================================
165
+ rdax ${input.in}, 1.0
166
+ wrax ${reg.dry}, 0.0
167
+
168
+ ; ======================================================
169
+ ; Stage 1: Sample-Rate Reduction (SID S&H Bit Crush)
170
+ ; ======================================================
171
+ skp run, ${local.SKIP_INIT}
172
+ rdax ${input.in}, 1.0
173
+ wrax ${reg.held}, 0.0
174
+ ${local.SKIP_INIT}:
175
+
176
+ ; Counter increment: inverted crush so higher = more crushed
177
+ ; step = 0.255 - crush_value (smaller step = slower S&H = more lo-fi)
178
+ rdax ${reg.counter}, 1.0
179
+ wrax ${reg.counter}, 0.0
180
+ @cv crushCV ; ACC = crush depth (0.005..0.25)
181
+ sof -1.0, 0.255 ; ACC = 0.255 - crush = step size
182
+ rdax ${reg.counter}, 1.0 ; ACC = counter + step
183
+ wrax ${reg.counter}, 1.0
184
+
185
+ sof 1.0, -0.99
186
+ skp neg, ${local.SKIP_SAMPLE}
187
+
188
+ clr
189
+ rdax ${input.in}, 1.0
190
+ wrax ${reg.held}, 0.0
191
+ sof 0.0, 0.0
192
+ wrax ${reg.counter}, 0.0
193
+
194
+ ${local.SKIP_SAMPLE}:
195
+
196
+ ; ======================================================
197
+ ; Stage 2: Square Wave Shaping (SID Pulse Oscillator)
198
+ ; ======================================================
199
+ clr
200
+ rdax ${reg.held}, 1.0
201
+ sof 1.99, 0.0
202
+ sof -1.99, 0.0
203
+ sof -1.99, 0.0
204
+ sof 0.5, 0.0
205
+ wrax ${reg.squared}, 0.0
206
+
207
+ ; Crossfade: out = held + (squared - held) * squareDrive
208
+ rdax ${reg.squared}, 1.0
209
+ rdax ${reg.held}, -1.0
210
+ wrax ${reg.mix_val}, 0.0 ; Save (squared - held), clear ACC
211
+ @cv squareCV ; ACC = square drive value
212
+ mulx ${reg.mix_val} ; ACC = (squared - held) * drive
213
+ rdax ${reg.held}, 1.0 ; ACC = held + (squared - held) * drive
214
+ wrax ${reg.squared}, 0.0
215
+
216
+ ; ======================================================
217
+ ; Stage 3: Ring Modulation (SID Ring Mod)
218
+ ; ======================================================
219
+ sof 0.0, ${param.ring_freq}
220
+ sof 0.15, 0.0
221
+ wrax ${reg.f_ring}, 0.0
222
+
223
+ ; Magic circle sine oscillator (seeded in init!)
224
+ rdax ${reg.ring_sin}, -1.0
225
+ mulx ${reg.f_ring}
226
+ rdax ${reg.ring_cos}, 1.0
227
+ wrax ${reg.ring_cos}, 1.0
228
+ mulx ${reg.f_ring}
229
+ rdax ${reg.ring_sin}, 1.0
230
+ wrax ${reg.ring_sin}, 0.0
231
+
232
+ ; Ring mod = squared * carrier
233
+ rdax ${reg.squared}, 1.0
234
+ mulx ${reg.ring_sin}
235
+ sof 1.99, 0.0
236
+ wrax ${reg.ringmod}, 0.0
237
+
238
+ ; Crossfade by ring_freq: 0 = all squared, 1 = all ring
239
+ sof 0.0, ${param.ring_freq}
240
+ wrax ${reg.mix_val}, 0.0
241
+ rdax ${reg.ringmod}, 1.0
242
+ rdax ${reg.squared}, -1.0
243
+ mulx ${reg.mix_val}
244
+ rdax ${reg.squared}, 1.0
245
+ wrax ${reg.wet}, 0.0
246
+
247
+ ; ======================================================
248
+ ; Stage 3.5: SID Noise Channel (Tent Map + DC Blocker)
249
+ ; ======================================================
250
+ ; Tent map: x_next ≈ 1 - 2|x| (chaotic noise source)
251
+ ; FV-1 can't represent exact coefficients 2/1, so the raw
252
+ ; output has a slight positive mean. A DC-blocking LP filter
253
+ ; tracks and removes it for guaranteed zero-mean noise.
254
+ rdax ${reg.noise_reg}, 1.0 ; ACC = x
255
+ absa ; ACC = |x|
256
+ sof -1.99, 0.999 ; ACC ≈ 1 - 2|x| — tent map
257
+ wrax ${reg.noise_reg}, 0.0 ; Save x_next, ACC = 0
258
+
259
+ ; DC blocker: track running average with ultra-slow LP
260
+ rdax ${reg.noise_dc}, 1.0 ; ACC = old DC estimate
261
+ rdfx ${reg.noise_reg}, 0.001 ; ACC = DC_old*0.999 + noise*0.001
262
+ wrax ${reg.noise_dc}, -1.0 ; Save new DC estimate, ACC = -DC
263
+ rdax ${reg.noise_reg}, 1.0 ; ACC = noise - DC = zero-mean noise
264
+
265
+ ; Scale by noise level and add to wet signal
266
+ ; Noise needs ~12dB pre-boost because the SID filter downstream
267
+ ; heavily attenuates high-frequency content where most noise energy lives
268
+ sof 1.99, 0.0
269
+ sof 1.99, 0.0
270
+ sof ${param.noise}, 0.0
271
+ rdax ${reg.wet}, 1.0
272
+ wrax ${reg.wet}, 0.0
273
+
274
+ ; ======================================================
275
+ ; Stage 4: SID Filter (Resonant SVF Low-Pass)
276
+ ; ======================================================
277
+ ; Load damping coefficient (resonance CV or fixed parameter)
278
+ @cv resoCV
279
+ wrax ${reg.damp_reg}, 0.0
280
+
281
+ ; Load cutoff coefficient
282
+ @cv cutoffCV
283
+ wrax ${reg.mix_val}, 0.0
284
+
285
+ ; Chamberlin SVF: HP → BP → LP
286
+ rdax ${reg.wet}, 1.0
287
+ rdax ${reg.lp_state}, -1.0
288
+ wrax ${reg.wet}, 0.0 ; Reuse wet as temp = (input - lp_old)
289
+ rdax ${reg.bp_state}, 1.0
290
+ mulx ${reg.damp_reg} ; ACC = bp_old * damp
291
+ rdax ${reg.wet}, -1.0 ; ACC = -(input - lp_old) + bp_old * damp = -(HP)
292
+ sof -1.0, 0.0 ; ACC = HP
293
+ mulx ${reg.mix_val} ; ACC = F * HP
294
+ rdax ${reg.bp_state}, 1.0 ; ACC = bp_old + F * HP = bp_new
295
+ wrax ${reg.bp_state}, 1.0 ; Save bp, keep in ACC
296
+ mulx ${reg.mix_val} ; ACC = F * bp_new
297
+ rdax ${reg.lp_state}, 1.0 ; ACC = lp_old + F * bp_new = lp_new
298
+ wrax ${reg.lp_state}, 0.0
299
+
300
+ ; ======================================================
301
+ ; Stage 5: Dry/Wet Mix
302
+ ; ======================================================
303
+ rdax ${reg.lp_state}, 1.0
304
+ rdax ${reg.dry}, -1.0
305
+ sof ${param.mix}, 0.0
306
+ rdax ${reg.dry}, 1.0
307
+ wrax ${output.out}, 0.0
308
+
309
+ @else
310
+ ; Bypassed
311
+ @endif
@@ -0,0 +1,181 @@
1
+ ---
2
+ {
3
+ "type": "fx.tape_degrade",
4
+ "name": "Tape Degrader",
5
+ "category": "Effects",
6
+ "subcategory": "Lo-Fi",
7
+ "description": "Simulates tape wow, flutter, and top-end age loss.",
8
+ "color": "#24F2F2",
9
+ "width": 180,
10
+ "inputs": [
11
+ {
12
+ "id": "in",
13
+ "name": "Input",
14
+ "type": "audio",
15
+ "required": true
16
+ },
17
+ {
18
+ "id": "wow_rate_cv",
19
+ "name": "Wow Rate",
20
+ "type": "control",
21
+ "required": false,
22
+ "parameter": "wow_rate"
23
+ },
24
+ {
25
+ "id": "wow_depth_cv",
26
+ "name": "Wow Depth",
27
+ "type": "control",
28
+ "required": false,
29
+ "parameter": "wow_depth"
30
+ },
31
+ {
32
+ "id": "flutter_rate_cv",
33
+ "name": "Flutter Rate",
34
+ "type": "control",
35
+ "required": false,
36
+ "parameter": "flutter_rate"
37
+ },
38
+ {
39
+ "id": "flutter_depth_cv",
40
+ "name": "Flutter Depth",
41
+ "type": "control",
42
+ "required": false,
43
+ "parameter": "flutter_depth"
44
+ }
45
+ ],
46
+ "outputs": [
47
+ {
48
+ "id": "out",
49
+ "name": "Output",
50
+ "type": "audio"
51
+ }
52
+ ],
53
+ "parameters": [
54
+ {
55
+ "id": "wow_rate",
56
+ "name": "Wow Rate (Hz)",
57
+ "type": "number",
58
+ "default": 0.5,
59
+ "min": 0.1,
60
+ "max": 2.0,
61
+ "step": 0.01,
62
+ "conversion": "HZ_TO_LFO_RATE"
63
+ },
64
+ {
65
+ "id": "wow_depth",
66
+ "name": "Wow Depth (ms)",
67
+ "type": "number",
68
+ "default": 1.5,
69
+ "min": 0,
70
+ "max": 5.0,
71
+ "step": 0.1,
72
+ "conversion": "MS_TO_LFO_RANGE"
73
+ },
74
+ {
75
+ "id": "flutter_rate",
76
+ "name": "Flutter Rate (Hz)",
77
+ "type": "number",
78
+ "default": 12.0,
79
+ "min": 5.0,
80
+ "max": 20.0,
81
+ "step": 0.1,
82
+ "conversion": "HZ_TO_LFO_RATE"
83
+ },
84
+ {
85
+ "id": "flutter_depth",
86
+ "name": "Flutter Depth (ms)",
87
+ "type": "number",
88
+ "default": 0.2,
89
+ "min": 0,
90
+ "max": 1.5,
91
+ "step": 0.01,
92
+ "conversion": "MS_TO_LFO_RANGE"
93
+ },
94
+ {
95
+ "id": "age",
96
+ "name": "Tape Age (Tone)",
97
+ "type": "number",
98
+ "default": 0.3,
99
+ "min": 0.01,
100
+ "max": 1.0,
101
+ "step": 0.01,
102
+ "description": "1.0 is bright, lower is darker (aged tape)."
103
+ }
104
+ ],
105
+ "memories": [
106
+ {
107
+ "id": "tape_buffer",
108
+ "size": 4096
109
+ }
110
+ ],
111
+ "registers": [
112
+ "wow_temp",
113
+ "lpf_lp"
114
+ ]
115
+ }
116
+ ---
117
+ @section init
118
+ skp run, init_tape
119
+ wlds SIN0, ${wow_rate}, ${wow_depth}
120
+ wlds SIN1, ${flutter_rate}, ${flutter_depth}
121
+ init_tape:
122
+
123
+ @section main
124
+ ; CV Modulation for Wow/Flutter
125
+ ; Since rates are HZ_TO_LFO_RATE, we must scale them manually
126
+ @if pinConnected(wow_rate_cv)
127
+ rdax ${input.wow_rate_cv}, ${wow_rate} / 511.0
128
+ wrax SIN0_RATE, 0.0
129
+ @endif
130
+
131
+ ; Depths are MS_TO_LFO_RANGE which goes up to 32767. So scale / 32767.0
132
+ @if pinConnected(wow_depth_cv)
133
+ rdax ${input.wow_depth_cv}, ${wow_depth} / 32767.0
134
+ wrax SIN0_RANGE, 0.0
135
+ @endif
136
+
137
+ @if pinConnected(flutter_rate_cv)
138
+ rdax ${input.flutter_rate_cv}, ${flutter_rate} / 511.0
139
+ wrax SIN1_RATE, 0.0
140
+ @endif
141
+
142
+ @if pinConnected(flutter_depth_cv)
143
+ rdax ${input.flutter_depth_cv}, ${flutter_depth} / 32767.0
144
+ wrax SIN1_RANGE, 0.0
145
+ @endif
146
+
147
+ ; Write to Tape
148
+ rdax ${input.in}, 1.0
149
+ wra ${mem.tape_buffer}, 0.0
150
+
151
+ ; Read Wow Tape Head (SIN0)
152
+ @equals center ${mem.tape_buffer} + 2048
153
+ cho rda, SIN0, SIN | REG | COMPC, ${center}
154
+ cho rda, SIN0, SIN, ${center} + 1
155
+
156
+ ; Modulate with Flutter (SIN1) off the same base, summing them creates composite warble
157
+ ; Actually, FV-1 CHO adds to ACC! So we just do another CHO RDA but without REG tracking?
158
+ ; To maintain unity volume, we shouldn't add audio signals, we should add address offsets.
159
+ ; But we can't add address offsets in SpinASM dynamically easily.
160
+ ; Instead, we just read from the buffer with Flutter and average the two reads!
161
+ ; Multiply Wow read by 0.5
162
+ sof 0.5, 0.0
163
+ wrax ${reg.wow_temp}, 0.0 ; Hold Wow audio separately from LPF state
164
+
165
+ ; Read Flutter Tape Head (SIN1)
166
+ cho rda, SIN1, SIN | REG | COMPC, ${center}
167
+ cho rda, SIN1, SIN, ${center} + 1
168
+ sof 0.5, 0.0
169
+
170
+ ; Combine Wow and Flutter audio signals
171
+ rdax ${reg.wow_temp}, 1.0
172
+
173
+ ; Tape Age Degradation (1-Pole Lowpass: L_new = L_old + Age * (I - L_old))
174
+ ; ACC = composite warble (wow*0.5 + flutter*0.5)
175
+ rdax ${reg.lpf_lp}, -1.0 ; ACC = I - L_old
176
+ sof ${param.age}, 0.0 ; ACC = Age * (I - L_old)
177
+ rdax ${reg.lpf_lp}, 1.0 ; ACC = L_old + Age * (I - L_old) = L_new
178
+ wrax ${reg.lpf_lp}, 1.0 ; Save new state and keep L_new in ACC
179
+
180
+ ; Export
181
+ wrax ${output.out}, 0.0
@@ -0,0 +1,141 @@
1
+ ---
2
+ {
3
+ "type": "fx.chorus",
4
+ "name": "Chorus",
5
+ "category": "Effects",
6
+ "subcategory": "Modulation",
7
+ "description": "Classic chorus with LFO-modulated delay",
8
+ "color": "#24f2f2",
9
+ "width": 180,
10
+ "inputs": [
11
+ {
12
+ "id": "in",
13
+ "name": "Input",
14
+ "type": "audio",
15
+ "required": true
16
+ },
17
+ {
18
+ "id": "lfo_rate",
19
+ "name": "LFO Rate",
20
+ "type": "control",
21
+ "required": false
22
+ },
23
+ {
24
+ "id": "lfo_width",
25
+ "name": "LFO Width",
26
+ "type": "control",
27
+ "required": false
28
+ }
29
+ ],
30
+ "outputs": [
31
+ {
32
+ "id": "out",
33
+ "name": "Output",
34
+ "type": "audio"
35
+ }
36
+ ],
37
+ "parameters": [
38
+ {
39
+ "id": "baseDelay",
40
+ "name": "Base Delay (ms)",
41
+ "type": "number",
42
+ "default": 15,
43
+ "min": 1,
44
+ "max": 50,
45
+ "conversion": "MS_TO_SAMPLES",
46
+ "description": "Base delay time (center of modulation) in ms.",
47
+ "step": 0.1
48
+ },
49
+ {
50
+ "id": "rate",
51
+ "name": "LFO Rate (Hz)",
52
+ "type": "number",
53
+ "default": 1.0,
54
+ "min": 0.05,
55
+ "max": 10,
56
+ "conversion": "HZ_TO_LFO_RATE",
57
+ "description": "Frequency of the chorus modulation in Hz.",
58
+ "step": 0.01
59
+ },
60
+ {
61
+ "id": "width",
62
+ "name": "LFO Width (ms)",
63
+ "type": "number",
64
+ "default": 1,
65
+ "min": 0,
66
+ "max": 10,
67
+ "conversion": "MS_TO_LFO_RANGE",
68
+ "description": "The width of modulation in ms.",
69
+ "step": 0.1
70
+ },
71
+ {
72
+ "id": "lfoSel",
73
+ "name": "LFO Select",
74
+ "type": "select",
75
+ "default": 0,
76
+ "options": [
77
+ {
78
+ "value": 0,
79
+ "label": "LFO 0"
80
+ },
81
+ {
82
+ "value": 1,
83
+ "label": "LFO 1"
84
+ }
85
+ ]
86
+ }
87
+ ],
88
+ "memories": [
89
+ {
90
+ "id": "delayl",
91
+ "size": "${baseDelay} * 2"
92
+ }
93
+ ],
94
+ "registers": [
95
+ ]
96
+ }
97
+ ---
98
+ @if isequalto lfoSel 0
99
+ @equals lfoNum SIN0
100
+ @equals lfoRateReg SIN0_RATE
101
+ @equals lfoRange SIN0_RANGE
102
+ @else
103
+ @equals lfoNum SIN1
104
+ @equals lfoRateReg SIN1_RATE
105
+ @equals lfoRange SIN1_RANGE
106
+ @endif
107
+
108
+ @section init
109
+ ; Initialize LFO
110
+ skp run, done_lfo
111
+ wlds ${lfoNum}, ${rate}, ${width}
112
+ done_lfo:
113
+
114
+ @section main
115
+ @multiplyDouble lfo_depth_delay width 0.5
116
+ @multiplyDouble delay_mem_size baseDelay 2.0
117
+ @assert lfo_depth_delay < delay_mem_size, "Maximum LFO depth exceeds delay memory bounds. Increase base delay or decrease LFO depth."
118
+
119
+ ; Chorus
120
+ rdax ${input.in}, 1.0
121
+ wra ${mem.delayl}, 0.0
122
+
123
+ @if pinConnected(lfo_rate)
124
+ rdax ${input.lfo_rate}, ${param.rate.max} / 511.0
125
+ sof 1.0, ${param.rate.min} / 511.0
126
+ wrax ${lfoRateReg}, 0.0
127
+ @endif
128
+
129
+ @if pinConnected(lfo_width)
130
+ rdax ${input.lfo_width}, ${param.width.max} / 32767.0
131
+ sof 1.0, ${param.width.min} / 32767.0
132
+ wrax ${lfoRange}, 0.0
133
+ @endif
134
+
135
+ ; Read modulated tap (wet signal)
136
+ ; center offset from start of delay line
137
+ @equals center ${mem.delayl} + ${baseDelay}
138
+ cho rda, ${lfoNum}, SIN | REG | COMPC, ${center}
139
+ cho rda, ${lfoNum}, SIN, ${center} + 1
140
+
141
+ wrax ${output.out}, 0.0