Skip to content

Commit 86cd047

Browse files
committed
ugh
1 parent 15532da commit 86cd047

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import type { DspDefinition } from "../types";
2+
3+
const dsp = `
4+
import("stdfaust.lib");
5+
6+
// synth
7+
8+
tune1 = waveform{59,-1,57,-1,59,-1,62,-1,57,-1,59,62,59,-1,57,-1};
9+
tune2 = waveform{66,-1,-1,-1,-1,-1,-1,-1,66,-1,-1,-1,-1,-1,-1,-1};
10+
tunePlayer(tune) = tuneGate,tuneFreq
11+
with {
12+
tuneNow = tune,int(os.phasor(16,0.2)) : rdtable;
13+
tuneGate = tuneNow > 0 : ba.sAndH(tuneNow != 0) : en.adsre(0.01,1.3,0.0,1.0);
14+
tuneFreq = tuneNow : ba.sAndH(tuneNow > 0);
15+
};
16+
synth(gate) = ba.midikey2hz : os.triangle : *(gate) : *(0.2);
17+
gtr_synth = tunePlayer(tune1) : synth;
18+
bass_synth = tunePlayer(tune2) : synth;
19+
20+
// alchemist.dsp
21+
//
22+
// B
23+
// A C
24+
// D
25+
26+
// utils
27+
28+
counter(trig) = upfront(trig) : + ~ _ with { upfront(x) = x > x'; };
29+
30+
lerp(a, b, x) = a + (b - a) * x;
31+
32+
constantPowerPan(p, x) = x*gainLeft, x*gainRight
33+
with {
34+
theta = ma.PI*p/2.;
35+
gainLeft = cos(theta)/sqrt(2.);
36+
gainRight = sin(theta)/sqrt(2.);
37+
};
38+
39+
reject_noise(slack, move_time, x) = return with {
40+
loop(prev_out, prev_timer, x) = loop_return with {
41+
trig = abs(prev_out - x) > slack;
42+
timer = ba.if(trig, 0, prev_timer + 1);
43+
out = ba.if(trig | timer < ma.SR * move_time, x, prev_out);
44+
loop_return = out,timer;
45+
};
46+
return = x : loop ~ (_,_) : (_,!);
47+
};
48+
49+
isFirstTick = ba.time == 0;
50+
sAndHWithDefault(default, trig, x) = ba.sAndH(isFirstTick | trig, select2(isFirstTick, x, default));
51+
52+
changed(x) = x != x';
53+
54+
layerIsAwake(l,x,t) = return with {
55+
layerChange = l : changed;
56+
startPos = x : ba.sAndH(layerChange);
57+
nudged = abs(x - startPos) > t;
58+
return = layerChange,nudged : ba.on_and_off : _ == 0;
59+
};
60+
61+
layerValue(l,i,t,x) = return with {
62+
return = x : sAndHWithDefault(0.5, (l == i) & layerIsAwake(l,x,t));
63+
};
64+
65+
// consts
66+
67+
// ...
68+
69+
// input
70+
71+
lag_param = hslider("lag[OWL:A]", 0.5, 0.0, 1.0, 0.001) : reject_noise(0.05, 1.0) : si.smoo;
72+
shape_param = hslider("shape[OWL:B]", 0, 0, shape_count, 1) : int;
73+
trem_param = hslider("trem[OWL:D]", 0.5, 0.0, 1.0, 0.001) : reject_noise(0.05, 1.0) : si.smoo;
74+
depth_param = hslider("depth[OWL:C]", 0.5, 0.0, 1.0, 0.001) : reject_noise(0.05, 1.0) : si.smoo;
75+
width_button = button("width[OWL:B1]");
76+
alt_button = button("alt[OWL:B2]");
77+
78+
gtr = _ <: _,_;
79+
bass = _ <: _,_;
80+
81+
amp = *(3.0);
82+
process = gtr_synth,bass_synth : gtr,bass :> amp,amp;
83+
`;
84+
85+
const dspDefinition: DspDefinition = {
86+
id: "alchemist-prototype-3",
87+
name: "alchemist prototype 3",
88+
description: "Makes a live tune and puts through alchemist",
89+
dsp,
90+
type: "live",
91+
};
92+
93+
export default dspDefinition;

dev/src/dsp-definitions/all.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import alchemistPrototype from "./45-alchemist-prototype";
4848
import noiseRejection from "./46-noise-rejection";
4949
import autolooper from "./47-autolooper";
5050
import alchemistPrototype2 from "./48-alchemist-prototype-2";
51+
import alchemistPrototype3 from "./49-alchemist-prototype-3";
5152

5253
export const all: DspDefinition[] = [
5354
sineWave,
@@ -98,4 +99,5 @@ export const all: DspDefinition[] = [
9899
noiseRejection,
99100
autolooper,
100101
alchemistPrototype2,
102+
alchemistPrototype3,
101103
];

0 commit comments

Comments
 (0)