«SC Jazz» by suhelkeswani

on 28 Aug'20 23:27 in
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
(
s.waitForBoot{


/*
=========== RHODES SYNTHDEF ==========
*/


SynthDef(\FMRhodes1, {
    arg
    // standard meanings
    out = 0, freq = 440, gate = 1, pan = 0, amp = 0.1, att = 0.001, rel = 1, lfoSpeed = 4.8, inputLevel = 0.2,
    // all of these range from 0 to 1
    modIndex = 0.2, mix = 0.2, lfoDepth = 0.1;

    var env1, env2, env3, env4;
    var osc1, osc2, osc3, osc4, snd;

    env1 = Env.perc(att, rel * 1.25, inputLevel, curve: \lin).kr;
    env2 = Env.perc(att, rel, inputLevel, curve: \lin).kr;
    env3 = Env.perc(att, rel * 1.5, inputLevel, curve: \lin).kr;
    env4 = Env.perc(att, rel * 1.5, inputLevel, curve: \lin).kr;

    osc4 = SinOsc.ar(freq) * 6.7341546494171 * modIndex * env4;
    osc3 = SinOsc.ar(freq * 2, osc4) * env3;
    osc2 = SinOsc.ar(freq * 30) * 0.683729941 * env2;
    osc1 = SinOsc.ar(freq * 2, osc2) * env1;
    snd = Mix((osc3 * (1 - mix)) + (osc1 * mix));
  	snd = snd * (SinOsc.ar(lfoSpeed).range((1 - lfoDepth), 1));

    snd = snd * Env.asr(0, 1, 0.1).kr(gate: gate, doneAction: 2);
    snd = Pan2.ar(snd, pan, amp);

    Out.ar(out, snd);
},
metadata: (
	credit: "Nathan Ho",
	category: \keyboards,
	tags: [\pitched, \piano, \fm]
)
).add;
postln("Rhodes Synth intialized.");


/*
=========== HAT SYNTHDEF ==========
*/

SynthDef("hihat", {arg out = 0, amp = 0.5, att = 0.01, rel = 0.2, ffreq = 6000, pan = 0;
	var env, snd;
	env = Env.perc(att, rel, amp).kr(doneAction: 2);
	snd = WhiteNoise.ar;
	snd = HPF.ar(in: snd, freq: ffreq, mul: env);
	Out.ar(out, Pan2.ar(snd, pan));
}).add;
postln("Hat Synth intialized.");


/*
=========== CHORDS & TEMPO ==========
*/

~metronome = TempoClock.new(60/60).permanent_(true);
~gdom7 =  [67, 71, 74, 77];
~fmaj7 = [65, 69, 72, 76];

~chord1 = [60, 64, 67, 71]; // Cmaj7 by default
~chord6 = [ 57, 60, 64, 67 ];// Amin7 by default
~chord2 = [ 62, 65, 69, 72 ];// Dmin7 by defauly
~chord5 = [67, 71, 74, 77]; // Gdom7 by default

postln("Chords and Tempo intialized.");

/*
=========== DEFINING THE PBIND ==========
*/

Pbindef(\jazz,
	\instrument, \FMRhodes1,
	\dur, Prand([
			Pseq([Rest(1/2), 1/2], inf),
			// Pseq([1/2], inf)
	]),
	\midinote, Pseq([
		~chord1, ~chord1, ~chord1, ~chord1,
		~chord6, ~chord6, ~chord6, ~chord6,
		~chord2, ~chord2, ~chord2, ~chord2,
		~chord5, ~chord5, ~chord5, ~chord5

	], inf),
	\rel, 0.4,
	\mix, 0.2,
    \modIndex, 0.2,
    \lfoSpeed, 0.5,
    \lfoDepth, 0.4,
    \inputLevel, Pgauss(0.8, 0.1, inf),
    \amp, 0.2,
	\legato, Pseq([1/2], inf),
	\strum, Pwhite(0, 0.02),
	\ctranspose, -4,
);


	Pbindef(\jazz).quant_(30/60 * 4);

Pbindef(\drums,
	\instrument, "hihat",
	\dur, Pseq([1/12*2, Rest(1/6*2), 1/12*2, Rest(1/12*2), 1/12*2], inf),
	\att, 0.01,
	\rel, -0.005*~metronome.tempo + 1,
	\ffreq, 11500,
	\pan, 0,
	\amp, 0.2
);

	Pbindef(\drums).quant_(30/60 * 4);

}
)

Pbindef(\jazz).stop;
Pbindef(\drums).stop;

~metronome = TempoClock.new(30/60).permanent_(true);
raw 3020 chars (focus & ctrl+a+c to copy)
reception
comments