Repository navigation
Expand file tree
/
Copy pathsynthEngine.lib
More file actions
54 lines (44 loc) · 1.78 KB
/
Copy pathsynthEngine.lib
File metadata and controls
54 lines (44 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//# Oscillator engine
// Oscillators are shared within all *synth.dsp files. Currently sawtooth, sine, triangle and square with noise is awailable. Also basic ASR envelope is handled here.
oscN = 4;
internalGain = 0.5;
getOscType(freq) = par(i,oscN,ba.if(oscType == i, osc(i, freq), 0))
with {
osc(0, f) = os.osc(f);
osc(1, f) = os.sawtooth(f);
osc(2, f) = os.triangle(f);
osc(3, f) = os.square(f);
};
synth(freq) = getOscType(freq) :> _ * mapFromMIDIscale(synthLevel) * internalGain;
getSubOscType(freq) = par(i,oscN,ba.if(subOscType == i, osc(i, freq), 0))
with {
osc(0, f) = os.osc(f);
osc(1, f) = os.sawtooth(f);
osc(2, f) = os.triangle(f);
osc(3, f) = os.square(f);
};
tunedNoise(freq) = out(freq) : _ * mapFromMIDIscale(noiseLevel)
with {
baseFilterFreq = 100;
bandWidth = 10;
noiseGain = 1.5;
calcLower(freq) = ba.if(freq==0, baseFilterFreq, freq) : int;
calcUpper(freq) = ba.if(freq==0, baseFilterFreq, freq) + bandWidth : int;
out(x) = no.noise * noiseGain : fi.bandpass(1, calcLower(x), calcUpper(x));
};
smoothOutput = co.compressor_mono(30,ba.linear2db(0.4),0.1,0.1) : co.limiter_1176_R4_mono :> _;
envelope = en.adsr(envAttack,envDecay,envSustain,envRelease);
pulseSeq(freq, pulse) = out(freq, pulse) : _ * mapFromMIDIscale(seqLevel)
with {
out(f, p) = os.osc(f) * en.ar(seqPulseLen, seqPulseLen, p);
};
drumSeq(step, trackN, track) = step <: getTrackStep(track, step) * tr(trackN, (step : ba.impulsify))
with {
getTrackStep(t, s) = (t, s) : rdtable;
kick(p) = ((os.square(30) : fi.lowpass(2,20)) * en.ar(0.01, 0.1, p)) + pm.strike(0.0, 1, 1, p);
hh(p) = no.noise : fi.bandpass(1, 4700, 6000) * en.ar(0.01, 0.03, p);
snare(p) = pm.strike(0.25, 0.5, 1, p);
tr(0, p) = kick;
tr(1, p) = hh;
tr(2, p) = snare;
};