@mthines/reaper-mcp 0.80.0-beta.100.1 → 0.80.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.
@@ -1,150 +0,0 @@
1
- desc:Multiband Compressor
2
- // accent: orange
3
- import mcp_ui.jsfx-inc
4
-
5
- // Three bands with Linkwitz-Riley 4th-order crossovers (the bands sum flat), one compressor per band.
6
- // Every band has its own threshold, ratio and gain. Core view: a log frequency graph of the output with
7
- // the two crossovers as draggable handles (drag them to pick the bands in Hz) and a threshold line per
8
- // band (hover a band and drag up or down to move its threshold, Shift-drag for its gain, wheel for its ratio), per-band
9
- // gain-reduction bars, and Threshold, Ratio and Gain knobs that edit the selected band (click a band on
10
- // the graph or a bar to select it). Advanced: the selected band's transfer curve with its live level,
11
- // attack, release and output, and Compare input, which draws the input spectrum over the output one.
12
-
13
- slider1:200<40,800,1>Low crossover
14
- slider2:2500<1000,12000,1>High crossover
15
- slider3:-18<-60,0,0.1>Low threshold
16
- slider4:-18<-60,0,0.1>Mid threshold
17
- slider5:-18<-60,0,0.1>High threshold
18
- slider6:3<1,20,0.1>Low ratio
19
- slider7:3<1,20,0.1>Mid ratio
20
- slider8:3<1,20,0.1>High ratio
21
- slider9:0<-12,12,0.1>Low gain
22
- slider10:0<-12,12,0.1>Mid gain
23
- slider11:0<-12,12,0.1>High gain
24
- slider12:10<1,100,1>Attack
25
- slider13:120<20,1000,1>Release
26
- slider14:0<-12,12,0.1>Output
27
- slider15:0<0,1,1{Off,On}>Compare input
28
-
29
- @init
30
- ui_ptr = ui_mem;
31
- function alloc(n) ( ui_ptr += n; ui_ptr - n; );
32
- cf = alloc(20); // biquad coefficients: low-pass and high-pass at both crossovers, 5 each
33
- st = alloc(48); // biquad states: 12 stages per channel, 2 each
34
- ring = alloc(2048); // the last 2048 output samples (mono) for the spectrum
35
- inr = alloc(2048); // the same for the input, only used while Compare input is on
36
- mag2 = alloc(1024);
37
- work = alloc(4096); // the FFT's complex buffer
38
- win = alloc(2048); // Hann window
39
- mag = alloc(1024); // magnitudes handed to the graph
40
- thr = alloc(3); slope = alloc(3); tlo = alloc(3); tg = alloc(3); // per band: threshold, slope, floor, gain
41
- env = alloc(3); // each band's level follower
42
- grpk = alloc(3); // gain reduction peak since the last block, per band
43
- grshow = alloc(3); // what the meter shows: the peak, released slowly
44
- i = 0; loop(2048, win[i] = 0.5 - 0.5 * cos(2 * $pi * i / 2048); i += 1;);
45
-
46
- // one 2nd-order Butterworth section (RBJ), both a low-pass and a high-pass; two in a row make a
47
- // Linkwitz-Riley 4th-order slope
48
- function coefs(c, f) local(w0, k, alpha, a0) (
49
- w0 = 2 * $pi * min(f, srate * 0.45) / srate; k = cos(w0); alpha = sin(w0) / 1.41421356;
50
- a0 = 1 + alpha;
51
- cf[c] = (1 - k) / 2 / a0; cf[c + 1] = (1 - k) / a0; cf[c + 2] = cf[c]; cf[c + 3] = -2 * k / a0; cf[c + 4] = (1 - alpha) / a0; // low-pass
52
- cf[c + 5] = (1 + k) / 2 / a0; cf[c + 6] = -(1 + k) / a0; cf[c + 7] = cf[c + 5]; cf[c + 8] = cf[c + 3]; cf[c + 9] = cf[c + 4]; // high-pass
53
- );
54
- function bq(c, s, x) local(y) (
55
- y = cf[c] * x + st[s];
56
- st[s] = cf[c + 1] * x - cf[c + 3] * y + st[s + 1];
57
- st[s + 1] = cf[c + 2] * x - cf[c + 4] * y;
58
- y;
59
- );
60
- // the gain reduction (dB, 0 or more) of a level (dB) against the threshold, with a 6 dB soft knee
61
- function reduce(k, lvl) local(over) (
62
- over = lvl - thr[k];
63
- over <= -3 ? 0 : over >= 3 ? over * slope[k] : slope[k] * (over + 3) * (over + 3) / 12;
64
- );
65
- // follow one band: returns its linear gain and keeps the gain reduction peak
66
- function band(k, x) local(a, g, gr) (
67
- a = abs(x);
68
- env[k] += (a - env[k]) * (a > env[k] ? ca : cr);
69
- g = 1;
70
- env[k] > tlo[k] ? (
71
- gr = reduce(k, 20 * log10(env[k]));
72
- gr > grpk[k] ? grpk[k] = gr;
73
- g = exp(-gr * 0.11512925);
74
- );
75
- g;
76
- );
77
- function update() (
78
- coefs(0, slider1); coefs(10, slider2);
79
- k = 0;
80
- loop(3,
81
- thr[k] = slider(3 + k); slope[k] = 1 - 1 / slider(6 + k);
82
- tlo[k] = 10 ^ ((thr[k] - 3) / 20); // below this level nothing is reduced: skip the logarithm
83
- tg[k] = 10 ^ (slider(9 + k) / 20);
84
- k += 1;
85
- );
86
- ca = 1 - exp(-1 / (slider12 * 0.001 * srate)); cr = 1 - exp(-1 / (slider13 * 0.001 * srate));
87
- out = 10 ^ (slider14 / 20);
88
- );
89
- update();
90
- ui_boot(2);
91
-
92
- @slider
93
- update();
94
-
95
- @block
96
- ui_changed() ? update();
97
- k = 0;
98
- loop(3,
99
- grshow[k] = max(grpk[k], grshow[k] * 0.85); grpk[k] = 0;
100
- ui_gr(k, grshow[k]);
101
- k += 1;
102
- );
103
- ui_glevel(20 * log10(max(env[min(2, ui_fsel)], 0.000001)));
104
- fresh ? (
105
- i = 0;
106
- loop(2048, work[i * 2] = ring[(rp + i) % 2048] * win[i]; work[i * 2 + 1] = 0; i += 1;);
107
- fft(work, 2048); fft_permute(work, 2048);
108
- i = 0;
109
- loop(1024, mag[i] = sqrt(work[i * 2] * work[i * 2] + work[i * 2 + 1] * work[i * 2 + 1]) / 512; i += 1;);
110
- ui_gfeed(mag, 1024);
111
- slider15 ? (
112
- i = 0;
113
- loop(2048, work[i * 2] = inr[(rp + i) % 2048] * win[i]; work[i * 2 + 1] = 0; i += 1;);
114
- fft(work, 2048); fft_permute(work, 2048);
115
- i = 0;
116
- loop(1024, mag2[i] = sqrt(work[i * 2] * work[i * 2] + work[i * 2 + 1] * work[i * 2 + 1]) / 512; i += 1;);
117
- ui_gfeed2(mag2, 1024);
118
- );
119
- fresh = 0;
120
- );
121
-
122
- @sample
123
- // left (s 0..23) and right (s 24..47): split at the low crossover, split the rest at the high one,
124
- // and run the low band through an all-pass at the high one so the three bands add up flat
125
- inr[rp] = (spl0 + spl1) * 0.5;
126
- lo = bq(0, 0, bq(0, 2, spl0)); hi = bq(5, 4, bq(5, 6, spl0));
127
- md = bq(10, 8, bq(10, 10, hi)); hh = bq(15, 12, bq(15, 14, hi));
128
- lo = bq(10, 16, bq(10, 18, lo)) + bq(15, 20, bq(15, 22, lo));
129
- ro = bq(0, 24, bq(0, 26, spl1)); ri = bq(5, 28, bq(5, 30, spl1));
130
- rm = bq(10, 32, bq(10, 34, ri)); rh = bq(15, 36, bq(15, 38, ri));
131
- ro = bq(10, 40, bq(10, 42, ro)) + bq(15, 44, bq(15, 46, ro));
132
- g0 = band(0, max(abs(lo), abs(ro))); g1 = band(1, max(abs(md), abs(rm))); g2 = band(2, max(abs(hh), abs(rh)));
133
- spl0 = (lo * g0 * tg[0] + md * g1 * tg[1] + hh * g2 * tg[2]) * out;
134
- spl1 = (ro * g0 * tg[0] + rm * g1 * tg[1] + rh * g2 * tg[2]) * out;
135
- ring[rp] = (spl0 + spl1) * 0.5; rp += 1;
136
- rp >= 2048 ? ( rp = 0; fresh = 1; );
137
-
138
- @gfx 440 360
139
- ui_header(0, 14);
140
- ui_begin(3, 3) ? (
141
- ui_tall(2); ui_row(1);
142
- ui_gshow(slider15); ui_freqgraph("Bands"); ui_fhandle(1, "Low crossover"); ui_fhandle(2, "High crossover"); ui_fthresh(3, 6, 9, 3);
143
- ui_row(4);
144
- ui_grmeter(3, "Reduction"); ui_bandknob(3, 3, "Threshold", 1); ui_bandknob(6, 3, "Ratio", 0); ui_bandknob(9, 3, "Gain", 1);
145
- ui_section("Advanced") ? (
146
- ui_tall(2); ui_row(3); ui_transfer(3, 6, 6); ui_knob(12, "Attack", 4); ui_knob(13, "Release", 4);
147
- ui_row(3); ui_toggle(15, "Compare input");
148
- );
149
- ui_end();
150
- );
@@ -1,70 +0,0 @@
1
- [
2
- {
3
- "name": "Gentle glue",
4
- "values": {
5
- "Low threshold": -20,
6
- "Mid threshold": -20,
7
- "High threshold": -20,
8
- "Low ratio": 2,
9
- "Mid ratio": 2,
10
- "High ratio": 2,
11
- "Attack": 20,
12
- "Release": 200
13
- }
14
- },
15
- {
16
- "name": "Tame the lows",
17
- "values": {
18
- "Low crossover": 150,
19
- "Low threshold": -26,
20
- "Low ratio": 4,
21
- "Mid threshold": -14,
22
- "Mid ratio": 1.5,
23
- "High threshold": -12,
24
- "High ratio": 1.5,
25
- "Attack": 15,
26
- "Release": 150,
27
- "Low gain": -1
28
- }
29
- },
30
- {
31
- "name": "De-harsh highs",
32
- "values": {
33
- "High crossover": 4500,
34
- "Low threshold": 0,
35
- "Low ratio": 1,
36
- "Mid threshold": -14,
37
- "Mid ratio": 1.5,
38
- "High threshold": -24,
39
- "High ratio": 3.5,
40
- "Attack": 3,
41
- "Release": 80,
42
- "High gain": -1.5
43
- }
44
- },
45
- {
46
- "name": "Loud and even",
47
- "values": {
48
- "Low threshold": -28,
49
- "Mid threshold": -28,
50
- "High threshold": -28,
51
- "Low ratio": 6,
52
- "Mid ratio": 6,
53
- "High ratio": 6,
54
- "Attack": 5,
55
- "Release": 100,
56
- "Output": 3
57
- }
58
- },
59
- {
60
- "name": "Neutral",
61
- "values": {
62
- "Low threshold": 0,
63
- "Mid threshold": 0,
64
- "High threshold": 0,
65
- "Low ratio": 1,
66
- "Mid ratio": 1,
67
- "High ratio": 1
68
- }
69
- }
70
- ]