«Xiongnu bells» by badnumbersmusic

on 10 Jun'17 09:17 in bell

Makes a sort of melody out of detuned bell sounds.

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
(
w=1;h=0.5;q=0.25;e=0.125;t=0.33;u=0.34;
c = TempoClock.default;
m = (
	chord: 0,
	scale: Scale([0,3,6,8,11,14,16],17),
	scaleChord: {
		|self,voicing|
		var notes = voicing + self.chord;
		Scale(self.scale.degrees.wrapAt(notes).sort, self.scale.pitchesPerOctave, self.scale.tuning);
	}
);
b = if (b.isNil,(),b);
f = if (f.isNil,(),f);
)

c.tempo = 1.5;

b.otey = Bus.audio(s,2);

(
SynthDef(\clang,
	{
		|freq=200,amp=0.1,gate=1,out=0,pan=0,boost=2,tapCarFreq=200,tapModFreq=200, tapPmIndex = 3, tapRatio = 0.5, releaseTime=0.6|
		var audio, chimeEnv, chimeFreqEnv, tap, tapEnv;
		chimeEnv = EnvGen.kr(Env([0,1,0.8,0],[0.001,0.005,releaseTime],[0,-2,-2]), gate, amp, doneAction:2);
		chimeFreqEnv = EnvGen.kr(Env([1,1.3,1],[0.005,0.005],[2,-2]), gate);
		audio = (1..20).collect({
			|num|
			var freqOffset, currentFreq, ampOffset, currentAmp;
			freqOffset = ((num * freq) % (num + 1)).linlin(0,num,0.95,1.05);
			ampOffset = ((num * freq) % (num + 2)).linlin(0,num+1,0.5,1) * TRand.kr(0.4,1.2,gate);
			currentFreq = num * freq * freqOffset * chimeFreqEnv;
			SinOsc.ar(currentFreq, 0, 0.1 * ampOffset);
		});
		audio = Mix(audio) * chimeEnv;
		tapEnv = EnvGen.kr(Env([0,1.1,0],[0.001,0.25],[0,-2]), gate, amp);
		tap = PMOsc.ar(freq.linlin(200,550,131.4,131.2) * tapCarFreq, tapModFreq, tapPmIndex, SinOsc.ar(130), tapEnv);
		audio = XFade2.ar(audio, tap, tapRatio);
		audio = (audio * boost).tanh / boost;
		audio = LPF.ar(audio, (freq * 10).min(10000));
		audio = Pan2.ar(audio,pan);
		Out.ar(out,audio);
	}
).add;
SynthDef(\otey,
	{
		|in,out,gate=1|
		var audio,env;
		env = EnvGen.kr(Env.cutoff(5), gate, doneAction:2);
		audio = In.ar(in,2);
		audio = OteySoundBoard.ar(audio);
		Out.ar(out,audio);
	}
).add;
)

(
f.otey.free;
f.otey = Synth(\otey, [\in, b.otey, \out, 0]);
)

(
Pdef(\clang,
	Pbind(
		\instrument, \clang,
		\octave, 4,
		\scale,Pfunc({m.scaleChord([0,2,4,6])}),
		\offset, Pstutter(Pwhite(5,20,inf),Pbrown(0,6,3,inf)),
		\degree, Pstutter(Pwrand([1,Pwhite(2,20,1)],[100,1].normalizeSum,inf),Pseq([0,1,2],inf) + Pkey(\offset)),
		//\degree, Pseq([0,4],inf),
		[\dur,\ampScale,\type, \tapRatio], Pwrand([
			Pseq([[q,0.1,\note, 0.2],[q,0.07,\note, 0.6]]),
			Pseq([[t/2,0.1,\note, 0.2],[t/2,0.05,\note, 0.8],[u/2,0.07,\note, 0.6]],Pwhite(1,3,1)),
			Pseq([[q/4,0.1,\note, 0.2],[q/4,0.1,\rest, 0.4],[q/4,0.03,\note, 0.7],[q/4,0.04,\note, 0.6]])
		],[10,1,3].normalizeSum,inf),
		\amp, Pkey(\ampScale) * 6 * Pgauss(1, 0.2,inf),
		\out,b.otey,
		\timingOffset, Pkey(\dur) * Pbrown(-0.1,0.1,0.04,inf),
		\tapCarFreq, 114,
		\tapModFreq, Pwhite(754,759,inf),
		\tapPmIndex, 1.9,
		\pan, Pkey(\degree).linlin(0,8,-0.8,0.5) + Pgauss(0,0.1,inf),
		\releaseTime, Pkey(\degree).linlin(0,8,0.8,0.6)
	)
).play;
)
Pdef(\clang).stop;
raw 2834 chars (focus & ctrl+a+c to copy)
reception
comments