@audiofab-io/fv1-core 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blocks/ATL_DEVELOPER_REFERENCE.md +156 -156
- package/blocks/control/constant.atl +36 -36
- package/blocks/control/entropy_lfo.atl +74 -74
- package/blocks/control/envelope.atl +120 -120
- package/blocks/control/invert.atl +33 -33
- package/blocks/control/pot.atl +149 -149
- package/blocks/control/power.atl +76 -76
- package/blocks/control/ramp_lfo.atl +122 -122
- package/blocks/control/scale_offset.atl +84 -84
- package/blocks/control/sincos_lfo.atl +126 -126
- package/blocks/control/smoother.atl +48 -48
- package/blocks/control/tremolizer.atl +54 -54
- package/blocks/effects/delay/micro_stutter.atl +77 -77
- package/blocks/effects/delay/mn3011.atl +280 -280
- package/blocks/effects/delay/simple_delay.atl +96 -96
- package/blocks/effects/delay/triple_tap_delay.atl +176 -176
- package/blocks/effects/lo-fi/bit_mangler.atl +74 -74
- package/blocks/effects/lo-fi/chiptune.atl +311 -311
- package/blocks/effects/lo-fi/tape_degrade.atl +181 -181
- package/blocks/effects/modulation/chorus.atl +141 -141
- package/blocks/effects/modulation/chorus_4voice.atl +188 -188
- package/blocks/effects/modulation/flanger.atl +184 -184
- package/blocks/effects/modulation/harmonic_trem.atl +129 -129
- package/blocks/effects/modulation/phaser.atl +299 -299
- package/blocks/effects/pitch/octave_up_down.atl +80 -80
- package/blocks/effects/pitch/pitch_offset.atl +149 -149
- package/blocks/effects/pitch/pitch_offset_dual.atl +197 -197
- package/blocks/effects/pitch/pitch_shift.atl +115 -115
- package/blocks/effects/pitch/sub_octave.atl +100 -100
- package/blocks/effects/reverb/ducking_reverb.atl +145 -145
- package/blocks/effects/reverb/min_reverb.atl +132 -132
- package/blocks/effects/reverb/plate_reverb.atl +344 -344
- package/blocks/effects/reverb/room_reverb.atl +293 -293
- package/blocks/effects/reverb/smear.atl +90 -90
- package/blocks/effects/reverb/spring_reverb.atl +353 -353
- package/blocks/filter/1p_high_pass.atl +62 -62
- package/blocks/filter/1p_low_pass.atl +58 -58
- package/blocks/filter/auto_wah.atl +207 -207
- package/blocks/filter/bbd_loss.atl +79 -79
- package/blocks/filter/shelving_high_pass.atl +76 -76
- package/blocks/filter/shelving_low_pass.atl +76 -76
- package/blocks/filter/svf_2p.atl +116 -116
- package/blocks/gain_mix/crossfade.atl +93 -93
- package/blocks/gain_mix/crossfade2.atl +86 -86
- package/blocks/gain_mix/crossfade3.atl +71 -71
- package/blocks/gain_mix/gainboost.atl +54 -54
- package/blocks/gain_mix/mixer2.atl +76 -76
- package/blocks/gain_mix/mixer3.atl +109 -109
- package/blocks/gain_mix/mixer4.atl +151 -151
- package/blocks/gain_mix/volume.atl +50 -50
- package/blocks/io/adc.atl +53 -53
- package/blocks/io/dac.atl +61 -61
- package/blocks/other/stickynote.atl +24 -24
- package/blocks/other/tone_gen_adjustable.atl +137 -137
- package/blocks/other/tone_gen_fixed.atl +109 -109
- package/dist/blockDiagram/builtinBlocks.js +107 -107
- package/dist/blockDiagram/builtinBlocks.js.map +1 -1
- package/dist/simulator/FV1Simulator.d.ts +12 -0
- package/dist/simulator/FV1Simulator.d.ts.map +1 -1
- package/dist/simulator/FV1Simulator.js +47 -1
- package/dist/simulator/FV1Simulator.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
---
|
|
2
|
-
{
|
|
3
|
-
"type": "control.envelope",
|
|
4
|
-
"category": "Control",
|
|
5
|
-
"name": "Envelope Follower",
|
|
6
|
-
"description": "Multi-mode envelope follower based on the SpinCAD 'Envelope' block algorithm. Outputs both a Single Slope (average) and a Dual Slope (peak with decay) follower.",
|
|
7
|
-
"labelTemplate": "",
|
|
8
|
-
"color": "#f2b824",
|
|
9
|
-
"inputs": [
|
|
10
|
-
{
|
|
11
|
-
"id": "audio",
|
|
12
|
-
"name": "Audio Input",
|
|
13
|
-
"type": "audio",
|
|
14
|
-
"required": true
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"id": "sens",
|
|
18
|
-
"name": "Sensitivity",
|
|
19
|
-
"type": "control",
|
|
20
|
-
"required": false,
|
|
21
|
-
"parameter": "gain"
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
"outputs": [
|
|
25
|
-
{
|
|
26
|
-
"id": "single",
|
|
27
|
-
"name": "Single Slope",
|
|
28
|
-
"type": "control"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"id": "dual",
|
|
32
|
-
"name": "Dual Slope",
|
|
33
|
-
"type": "control"
|
|
34
|
-
}
|
|
35
|
-
],
|
|
36
|
-
"parameters": [
|
|
37
|
-
{
|
|
38
|
-
"id": "gain",
|
|
39
|
-
"name": "Sensitivity",
|
|
40
|
-
"type": "number",
|
|
41
|
-
"default": 1.5,
|
|
42
|
-
"min": 0.5,
|
|
43
|
-
"max": 1.99,
|
|
44
|
-
"step": 0.01,
|
|
45
|
-
"description": "Pre-detection boost (up to ~4x with internal SOF stage). Higher values make the envelope respond to quieter signals."
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"id": "attack",
|
|
49
|
-
"name": "Attack Rate",
|
|
50
|
-
"type": "number",
|
|
51
|
-
"default": 0.78,
|
|
52
|
-
"min": 0.1,
|
|
53
|
-
"max": 20.0,
|
|
54
|
-
"step": 0.01,
|
|
55
|
-
"conversion": "LOGFREQ",
|
|
56
|
-
"description": "Corner frequency for the Single Slope (average) follower. 0.78 Hz ≈ 0.00015 coefficient."
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"id": "decay",
|
|
60
|
-
"name": "Decay Rate",
|
|
61
|
-
"type": "number",
|
|
62
|
-
"default": 0.52,
|
|
63
|
-
"min": 0.1,
|
|
64
|
-
"max": 10.0,
|
|
65
|
-
"step": 0.01,
|
|
66
|
-
"conversion": "LOGFREQ",
|
|
67
|
-
"description": "Release frequency for the Dual Slope (peak) follower. 0.52 Hz ≈ 0.0001 coefficient."
|
|
68
|
-
}
|
|
69
|
-
],
|
|
70
|
-
"registers": [
|
|
71
|
-
"AVG",
|
|
72
|
-
"LAVG",
|
|
73
|
-
"TEMP"
|
|
74
|
-
]
|
|
75
|
-
}
|
|
76
|
-
---
|
|
77
|
-
; Envelope Follower
|
|
78
|
-
; Based on EnvelopeControlCADBlock.java
|
|
79
|
-
|
|
80
|
-
@section main
|
|
81
|
-
@if pinConnected(audio)
|
|
82
|
-
|
|
83
|
-
; --- Pre-Detection Boost ---
|
|
84
|
-
; RDAX coefficient (up to 1.99x) + fixed SOF 2x stage = up to ~4x total headroom boost.
|
|
85
|
-
rdax ${input.audio}, ${param.gain} ; Boost via RDAX coefficient (0.5–1.99x)
|
|
86
|
-
sof 1.99, 0.0 ; Additional 2x → env covers the full 0–1 range for normal playing levels
|
|
87
|
-
absa ; Full-wave rectify
|
|
88
|
-
@if pinConnected(sens)
|
|
89
|
-
mulx ${input.sens} ; Pot scales overall sensitivity (0 = off, 1.0 = full)
|
|
90
|
-
@endif
|
|
91
|
-
|
|
92
|
-
; --- Single Slope (Average Follower) ---
|
|
93
|
-
; Computes a running average of the magnitude using a first-order low-pass filter.
|
|
94
|
-
rdfx ${reg.AVG}, ${param.attack}
|
|
95
|
-
wrax ${reg.AVG}, 0.0 ; Clear ACC to process Dual Slope next
|
|
96
|
-
|
|
97
|
-
; --- Dual Slope (Peak Follower) ---
|
|
98
|
-
; Follows the peak of the average signal with an exponential decay.
|
|
99
|
-
; 1. Compute decayed peak: TEMP = LAVG * (1 - decay)
|
|
100
|
-
rdax ${reg.LAVG}, 1.0
|
|
101
|
-
sof -${param.decay}, 0.0 ; Apply coefficient as multiplier (-decay)
|
|
102
|
-
rdax ${reg.LAVG}, 1.0 ; ACC = LAVG - decay*LAVG
|
|
103
|
-
wrax ${reg.TEMP}, 0.0 ; Store decayed peak, clear ACC
|
|
104
|
-
|
|
105
|
-
; 2. Update LAVG: LAVG = max(AVG, decayed_peak)
|
|
106
|
-
rdax ${reg.AVG}, 1.0
|
|
107
|
-
maxx ${reg.TEMP}, 1.0
|
|
108
|
-
wrax ${reg.LAVG}, 0.0 ; Update LAVG with the maximum of current and decayed
|
|
109
|
-
|
|
110
|
-
; --- Output Routing ---
|
|
111
|
-
@if pinConnected(single)
|
|
112
|
-
rdax ${reg.AVG}, 1.0
|
|
113
|
-
wrax ${output.single}, 0.0
|
|
114
|
-
@endif
|
|
115
|
-
|
|
116
|
-
@if pinConnected(dual)
|
|
117
|
-
rdax ${reg.LAVG}, 1.0
|
|
118
|
-
wrax ${output.dual}, 0.0
|
|
119
|
-
@endif
|
|
120
|
-
|
|
1
|
+
---
|
|
2
|
+
{
|
|
3
|
+
"type": "control.envelope",
|
|
4
|
+
"category": "Control",
|
|
5
|
+
"name": "Envelope Follower",
|
|
6
|
+
"description": "Multi-mode envelope follower based on the SpinCAD 'Envelope' block algorithm. Outputs both a Single Slope (average) and a Dual Slope (peak with decay) follower.",
|
|
7
|
+
"labelTemplate": "",
|
|
8
|
+
"color": "#f2b824",
|
|
9
|
+
"inputs": [
|
|
10
|
+
{
|
|
11
|
+
"id": "audio",
|
|
12
|
+
"name": "Audio Input",
|
|
13
|
+
"type": "audio",
|
|
14
|
+
"required": true
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "sens",
|
|
18
|
+
"name": "Sensitivity",
|
|
19
|
+
"type": "control",
|
|
20
|
+
"required": false,
|
|
21
|
+
"parameter": "gain"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"outputs": [
|
|
25
|
+
{
|
|
26
|
+
"id": "single",
|
|
27
|
+
"name": "Single Slope",
|
|
28
|
+
"type": "control"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"id": "dual",
|
|
32
|
+
"name": "Dual Slope",
|
|
33
|
+
"type": "control"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"parameters": [
|
|
37
|
+
{
|
|
38
|
+
"id": "gain",
|
|
39
|
+
"name": "Sensitivity",
|
|
40
|
+
"type": "number",
|
|
41
|
+
"default": 1.5,
|
|
42
|
+
"min": 0.5,
|
|
43
|
+
"max": 1.99,
|
|
44
|
+
"step": 0.01,
|
|
45
|
+
"description": "Pre-detection boost (up to ~4x with internal SOF stage). Higher values make the envelope respond to quieter signals."
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"id": "attack",
|
|
49
|
+
"name": "Attack Rate",
|
|
50
|
+
"type": "number",
|
|
51
|
+
"default": 0.78,
|
|
52
|
+
"min": 0.1,
|
|
53
|
+
"max": 20.0,
|
|
54
|
+
"step": 0.01,
|
|
55
|
+
"conversion": "LOGFREQ",
|
|
56
|
+
"description": "Corner frequency for the Single Slope (average) follower. 0.78 Hz ≈ 0.00015 coefficient."
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": "decay",
|
|
60
|
+
"name": "Decay Rate",
|
|
61
|
+
"type": "number",
|
|
62
|
+
"default": 0.52,
|
|
63
|
+
"min": 0.1,
|
|
64
|
+
"max": 10.0,
|
|
65
|
+
"step": 0.01,
|
|
66
|
+
"conversion": "LOGFREQ",
|
|
67
|
+
"description": "Release frequency for the Dual Slope (peak) follower. 0.52 Hz ≈ 0.0001 coefficient."
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"registers": [
|
|
71
|
+
"AVG",
|
|
72
|
+
"LAVG",
|
|
73
|
+
"TEMP"
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
---
|
|
77
|
+
; Envelope Follower
|
|
78
|
+
; Based on EnvelopeControlCADBlock.java
|
|
79
|
+
|
|
80
|
+
@section main
|
|
81
|
+
@if pinConnected(audio)
|
|
82
|
+
|
|
83
|
+
; --- Pre-Detection Boost ---
|
|
84
|
+
; RDAX coefficient (up to 1.99x) + fixed SOF 2x stage = up to ~4x total headroom boost.
|
|
85
|
+
rdax ${input.audio}, ${param.gain} ; Boost via RDAX coefficient (0.5–1.99x)
|
|
86
|
+
sof 1.99, 0.0 ; Additional 2x → env covers the full 0–1 range for normal playing levels
|
|
87
|
+
absa ; Full-wave rectify
|
|
88
|
+
@if pinConnected(sens)
|
|
89
|
+
mulx ${input.sens} ; Pot scales overall sensitivity (0 = off, 1.0 = full)
|
|
90
|
+
@endif
|
|
91
|
+
|
|
92
|
+
; --- Single Slope (Average Follower) ---
|
|
93
|
+
; Computes a running average of the magnitude using a first-order low-pass filter.
|
|
94
|
+
rdfx ${reg.AVG}, ${param.attack}
|
|
95
|
+
wrax ${reg.AVG}, 0.0 ; Clear ACC to process Dual Slope next
|
|
96
|
+
|
|
97
|
+
; --- Dual Slope (Peak Follower) ---
|
|
98
|
+
; Follows the peak of the average signal with an exponential decay.
|
|
99
|
+
; 1. Compute decayed peak: TEMP = LAVG * (1 - decay)
|
|
100
|
+
rdax ${reg.LAVG}, 1.0
|
|
101
|
+
sof -${param.decay}, 0.0 ; Apply coefficient as multiplier (-decay)
|
|
102
|
+
rdax ${reg.LAVG}, 1.0 ; ACC = LAVG - decay*LAVG
|
|
103
|
+
wrax ${reg.TEMP}, 0.0 ; Store decayed peak, clear ACC
|
|
104
|
+
|
|
105
|
+
; 2. Update LAVG: LAVG = max(AVG, decayed_peak)
|
|
106
|
+
rdax ${reg.AVG}, 1.0
|
|
107
|
+
maxx ${reg.TEMP}, 1.0
|
|
108
|
+
wrax ${reg.LAVG}, 0.0 ; Update LAVG with the maximum of current and decayed
|
|
109
|
+
|
|
110
|
+
; --- Output Routing ---
|
|
111
|
+
@if pinConnected(single)
|
|
112
|
+
rdax ${reg.AVG}, 1.0
|
|
113
|
+
wrax ${output.single}, 0.0
|
|
114
|
+
@endif
|
|
115
|
+
|
|
116
|
+
@if pinConnected(dual)
|
|
117
|
+
rdax ${reg.LAVG}, 1.0
|
|
118
|
+
wrax ${output.dual}, 0.0
|
|
119
|
+
@endif
|
|
120
|
+
|
|
121
121
|
@endif
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
---
|
|
2
|
-
{
|
|
3
|
-
"type": "control.invert",
|
|
4
|
-
"name": "Invert",
|
|
5
|
-
"category": "Control",
|
|
6
|
-
"description": "Inverts a control signal: 0.0→1.0, 1.0→0.0.",
|
|
7
|
-
"color": "#f2b824",
|
|
8
|
-
"width": 140,
|
|
9
|
-
"inputs": [
|
|
10
|
-
{
|
|
11
|
-
"id": "input",
|
|
12
|
-
"name": "Input",
|
|
13
|
-
"type": "control"
|
|
14
|
-
}
|
|
15
|
-
],
|
|
16
|
-
"outputs": [
|
|
17
|
-
{
|
|
18
|
-
"id": "output",
|
|
19
|
-
"name": "Output",
|
|
20
|
-
"type": "control"
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
"parameters": []
|
|
24
|
-
}
|
|
25
|
-
---
|
|
26
|
-
; Control Invert
|
|
27
|
-
@section main
|
|
28
|
-
|
|
29
|
-
@if pinConnected(input)
|
|
30
|
-
rdax ${input.input}, 1.0
|
|
31
|
-
sof -0.999, 0.999
|
|
32
|
-
wrax ${output.output}, 0.0
|
|
33
|
-
@endif
|
|
1
|
+
---
|
|
2
|
+
{
|
|
3
|
+
"type": "control.invert",
|
|
4
|
+
"name": "Invert",
|
|
5
|
+
"category": "Control",
|
|
6
|
+
"description": "Inverts a control signal: 0.0→1.0, 1.0→0.0.",
|
|
7
|
+
"color": "#f2b824",
|
|
8
|
+
"width": 140,
|
|
9
|
+
"inputs": [
|
|
10
|
+
{
|
|
11
|
+
"id": "input",
|
|
12
|
+
"name": "Input",
|
|
13
|
+
"type": "control"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"outputs": [
|
|
17
|
+
{
|
|
18
|
+
"id": "output",
|
|
19
|
+
"name": "Output",
|
|
20
|
+
"type": "control"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"parameters": []
|
|
24
|
+
}
|
|
25
|
+
---
|
|
26
|
+
; Control Invert
|
|
27
|
+
@section main
|
|
28
|
+
|
|
29
|
+
@if pinConnected(input)
|
|
30
|
+
rdax ${input.input}, 1.0
|
|
31
|
+
sof -0.999, 0.999
|
|
32
|
+
wrax ${output.output}, 0.0
|
|
33
|
+
@endif
|
package/blocks/control/pot.atl
CHANGED
|
@@ -1,150 +1,150 @@
|
|
|
1
|
-
---
|
|
2
|
-
{
|
|
3
|
-
"type": "input.pot",
|
|
4
|
-
"name": "Potentiometer",
|
|
5
|
-
"category": "Control",
|
|
6
|
-
"description": "Reads a hardware potentiometer value with optional filtering (Smoothing or Speedup) and inversion.",
|
|
7
|
-
"color": "#4CAF50",
|
|
8
|
-
"width": 150,
|
|
9
|
-
"labelTemplate": "POT ${param.potNumber}",
|
|
10
|
-
"inputs": [],
|
|
11
|
-
"outputs": [
|
|
12
|
-
{
|
|
13
|
-
"id": "out",
|
|
14
|
-
"name": "Control",
|
|
15
|
-
"type": "control"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
"parameters": [
|
|
19
|
-
{
|
|
20
|
-
"id": "potNumber",
|
|
21
|
-
"name": "Pot Number",
|
|
22
|
-
"type": "select",
|
|
23
|
-
"default": 0,
|
|
24
|
-
"options": [
|
|
25
|
-
{
|
|
26
|
-
"label": "POT0",
|
|
27
|
-
"value": 0
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"label": "POT1",
|
|
31
|
-
"value": 1
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"label": "POT2",
|
|
35
|
-
"value": 2
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"id": "lpCoeff",
|
|
41
|
-
"name": "LP Coefficient",
|
|
42
|
-
"type": "number",
|
|
43
|
-
"default": 0.001,
|
|
44
|
-
"min": 0.001,
|
|
45
|
-
"max": 0.1,
|
|
46
|
-
"step": 0.001,
|
|
47
|
-
"displayDecimals": 3,
|
|
48
|
-
"visibleIf": "speedup == true"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"id": "hpCoeff",
|
|
52
|
-
"name": "Speedup Amount",
|
|
53
|
-
"type": "number",
|
|
54
|
-
"default": -0.75,
|
|
55
|
-
"min": -0.99,
|
|
56
|
-
"max": 0,
|
|
57
|
-
"step": 0.01,
|
|
58
|
-
"visibleIf": "speedup == true",
|
|
59
|
-
"description": "Negative values provide lead (faster response)"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"id": "invert",
|
|
63
|
-
"name": "Invert",
|
|
64
|
-
"type": "boolean",
|
|
65
|
-
"default": false,
|
|
66
|
-
"description": "Inverts the output value"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"id": "speedup",
|
|
70
|
-
"name": "Speedup",
|
|
71
|
-
"type": "boolean",
|
|
72
|
-
"default": false,
|
|
73
|
-
"description": "Speeds up the response of the pot"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"id": "ignoreIfZero",
|
|
77
|
-
"name": "Ignore if Zero (Fallback to Default)",
|
|
78
|
-
"type": "boolean",
|
|
79
|
-
"default": false,
|
|
80
|
-
"description": "If true, blocks connected to this pot will use their default value when the pot is turned down."
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"id": "zeroValue",
|
|
84
|
-
"name": "Zero Bypass Value",
|
|
85
|
-
"type": "number",
|
|
86
|
-
"default": 0.0,
|
|
87
|
-
"min": 0.0,
|
|
88
|
-
"max": 1.0,
|
|
89
|
-
"step": 0.01,
|
|
90
|
-
"description": "The value sent to connected @cv inputs when the pot is turned all the way down (zero-bypass active).",
|
|
91
|
-
"visibleIf": "ignoreIfZero == true"
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
"id": "custom_range",
|
|
95
|
-
"name": "Custom Scaling",
|
|
96
|
-
"type": "boolean",
|
|
97
|
-
"default": false,
|
|
98
|
-
"description": "Custom scaling for the pot"
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"id": "pot_min",
|
|
102
|
-
"name": "Min",
|
|
103
|
-
"type": "number",
|
|
104
|
-
"default": 0.0,
|
|
105
|
-
"min": 0.0,
|
|
106
|
-
"max": 1.0,
|
|
107
|
-
"step": 0.01,
|
|
108
|
-
"visibleIf": "custom_range == true"
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
"id": "pot_max",
|
|
112
|
-
"name": "Max",
|
|
113
|
-
"type": "number",
|
|
114
|
-
"default": 1.0,
|
|
115
|
-
"min": 0.0,
|
|
116
|
-
"max": 1.0,
|
|
117
|
-
"step": 0.01,
|
|
118
|
-
"visibleIf": "custom_range == true"
|
|
119
|
-
}
|
|
120
|
-
],
|
|
121
|
-
"registers": [
|
|
122
|
-
"f1",
|
|
123
|
-
"f2"
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
---
|
|
127
|
-
@section input
|
|
128
|
-
|
|
129
|
-
@acc = POT${param.potNumber}
|
|
130
|
-
@if ${param.speedup} == true
|
|
131
|
-
; Speedup filter (lead-lag) for fast response with some smoothing
|
|
132
|
-
RDFX ${reg.f1}, ${param.lpCoeff}
|
|
133
|
-
WRHX ${reg.f1}, ${param.hpCoeff}
|
|
134
|
-
@multiplyDouble negHpCoeff -1.0 ${param.hpCoeff}
|
|
135
|
-
RDAX ${reg.f2}, ${negHpCoeff}
|
|
136
|
-
WRAX ${reg.f2}, 1.0
|
|
137
|
-
@endif
|
|
138
|
-
|
|
139
|
-
@if ${param.invert} == true
|
|
140
|
-
@acc = @acc * -1.0 + 1.0 ; Invert
|
|
141
|
-
@endif
|
|
142
|
-
|
|
143
|
-
@if ${param.custom_range} == true
|
|
144
|
-
@if ${param.pot_min} != 0.0 || ${param.pot_max} != 1.0
|
|
145
|
-
@assert ${param.pot_max} > ${param.pot_min}, "Custom POT scaling: max must be greater than min"
|
|
146
|
-
@acc = @acc * (${param.pot_max} - ${param.pot_min}) + ${param.pot_min} ; Custom scaling
|
|
147
|
-
@endif
|
|
148
|
-
@endif
|
|
149
|
-
|
|
1
|
+
---
|
|
2
|
+
{
|
|
3
|
+
"type": "input.pot",
|
|
4
|
+
"name": "Potentiometer",
|
|
5
|
+
"category": "Control",
|
|
6
|
+
"description": "Reads a hardware potentiometer value with optional filtering (Smoothing or Speedup) and inversion.",
|
|
7
|
+
"color": "#4CAF50",
|
|
8
|
+
"width": 150,
|
|
9
|
+
"labelTemplate": "POT ${param.potNumber}",
|
|
10
|
+
"inputs": [],
|
|
11
|
+
"outputs": [
|
|
12
|
+
{
|
|
13
|
+
"id": "out",
|
|
14
|
+
"name": "Control",
|
|
15
|
+
"type": "control"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"parameters": [
|
|
19
|
+
{
|
|
20
|
+
"id": "potNumber",
|
|
21
|
+
"name": "Pot Number",
|
|
22
|
+
"type": "select",
|
|
23
|
+
"default": 0,
|
|
24
|
+
"options": [
|
|
25
|
+
{
|
|
26
|
+
"label": "POT0",
|
|
27
|
+
"value": 0
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"label": "POT1",
|
|
31
|
+
"value": 1
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"label": "POT2",
|
|
35
|
+
"value": 2
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "lpCoeff",
|
|
41
|
+
"name": "LP Coefficient",
|
|
42
|
+
"type": "number",
|
|
43
|
+
"default": 0.001,
|
|
44
|
+
"min": 0.001,
|
|
45
|
+
"max": 0.1,
|
|
46
|
+
"step": 0.001,
|
|
47
|
+
"displayDecimals": 3,
|
|
48
|
+
"visibleIf": "speedup == true"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"id": "hpCoeff",
|
|
52
|
+
"name": "Speedup Amount",
|
|
53
|
+
"type": "number",
|
|
54
|
+
"default": -0.75,
|
|
55
|
+
"min": -0.99,
|
|
56
|
+
"max": 0,
|
|
57
|
+
"step": 0.01,
|
|
58
|
+
"visibleIf": "speedup == true",
|
|
59
|
+
"description": "Negative values provide lead (faster response)"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"id": "invert",
|
|
63
|
+
"name": "Invert",
|
|
64
|
+
"type": "boolean",
|
|
65
|
+
"default": false,
|
|
66
|
+
"description": "Inverts the output value"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"id": "speedup",
|
|
70
|
+
"name": "Speedup",
|
|
71
|
+
"type": "boolean",
|
|
72
|
+
"default": false,
|
|
73
|
+
"description": "Speeds up the response of the pot"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"id": "ignoreIfZero",
|
|
77
|
+
"name": "Ignore if Zero (Fallback to Default)",
|
|
78
|
+
"type": "boolean",
|
|
79
|
+
"default": false,
|
|
80
|
+
"description": "If true, blocks connected to this pot will use their default value when the pot is turned down."
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"id": "zeroValue",
|
|
84
|
+
"name": "Zero Bypass Value",
|
|
85
|
+
"type": "number",
|
|
86
|
+
"default": 0.0,
|
|
87
|
+
"min": 0.0,
|
|
88
|
+
"max": 1.0,
|
|
89
|
+
"step": 0.01,
|
|
90
|
+
"description": "The value sent to connected @cv inputs when the pot is turned all the way down (zero-bypass active).",
|
|
91
|
+
"visibleIf": "ignoreIfZero == true"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"id": "custom_range",
|
|
95
|
+
"name": "Custom Scaling",
|
|
96
|
+
"type": "boolean",
|
|
97
|
+
"default": false,
|
|
98
|
+
"description": "Custom scaling for the pot"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"id": "pot_min",
|
|
102
|
+
"name": "Min",
|
|
103
|
+
"type": "number",
|
|
104
|
+
"default": 0.0,
|
|
105
|
+
"min": 0.0,
|
|
106
|
+
"max": 1.0,
|
|
107
|
+
"step": 0.01,
|
|
108
|
+
"visibleIf": "custom_range == true"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"id": "pot_max",
|
|
112
|
+
"name": "Max",
|
|
113
|
+
"type": "number",
|
|
114
|
+
"default": 1.0,
|
|
115
|
+
"min": 0.0,
|
|
116
|
+
"max": 1.0,
|
|
117
|
+
"step": 0.01,
|
|
118
|
+
"visibleIf": "custom_range == true"
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
"registers": [
|
|
122
|
+
"f1",
|
|
123
|
+
"f2"
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
---
|
|
127
|
+
@section input
|
|
128
|
+
|
|
129
|
+
@acc = POT${param.potNumber}
|
|
130
|
+
@if ${param.speedup} == true
|
|
131
|
+
; Speedup filter (lead-lag) for fast response with some smoothing
|
|
132
|
+
RDFX ${reg.f1}, ${param.lpCoeff}
|
|
133
|
+
WRHX ${reg.f1}, ${param.hpCoeff}
|
|
134
|
+
@multiplyDouble negHpCoeff -1.0 ${param.hpCoeff}
|
|
135
|
+
RDAX ${reg.f2}, ${negHpCoeff}
|
|
136
|
+
WRAX ${reg.f2}, 1.0
|
|
137
|
+
@endif
|
|
138
|
+
|
|
139
|
+
@if ${param.invert} == true
|
|
140
|
+
@acc = @acc * -1.0 + 1.0 ; Invert
|
|
141
|
+
@endif
|
|
142
|
+
|
|
143
|
+
@if ${param.custom_range} == true
|
|
144
|
+
@if ${param.pot_min} != 0.0 || ${param.pot_max} != 1.0
|
|
145
|
+
@assert ${param.pot_max} > ${param.pot_min}, "Custom POT scaling: max must be greater than min"
|
|
146
|
+
@acc = @acc * (${param.pot_max} - ${param.pot_min}) + ${param.pot_min} ; Custom scaling
|
|
147
|
+
@endif
|
|
148
|
+
@endif
|
|
149
|
+
|
|
150
150
|
${output.out} = @acc
|