133 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			133 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
| // posted this earlier this year at
 | |
| // http://sccode.org/1-5cM
 | |
| // and this is now a combination of above and variations at
 | |
| // http://sccode.org/1-5cR and http://sccode.org/1-5cQ
 | |
| 
 | |
| 
 | |
| // SynthDefs, buses, tempoclock:
 | |
| (
 | |
| SynthDef("plucking", {arg out = 0, amp = 0.1, freq = 440, decay = 5, coef = 0.1;
 | |
| 	var env, snd;
 | |
| 	env = EnvGen.kr(Env.linen(0, decay, 0), doneAction: 2);
 | |
| 	snd = Pluck.ar(
 | |
| 		in: PinkNoise.ar(amp),
 | |
| 		trig: Impulse.kr(0),
 | |
| 		maxdelaytime: 0.1,
 | |
| 		delaytime: freq.reciprocal,
 | |
| 		decaytime: decay,
 | |
| 		coef: coef);
 | |
| 	snd = LeakDC.ar(snd).clip2;
 | |
| 	Out.ar(out, snd * env);
 | |
| }).add;
 | |
| 
 | |
| 
 | |
| SynthDef("reverbBus", { arg outBus = 0, inBus, wet = 0.5;
 | |
| 	var input, rev;
 | |
| 	input = In.ar(inBus,1);
 | |
| 	rev = JPverb.ar(input * wet, t60:3);
 | |
|     Out.ar(outBus, input + rev);
 | |
| }).add;
 | |
| 
 | |
| // create separate bus for send->reverb
 | |
| b = Bus.audio(s,1);
 | |
| 
 | |
| // tempoclock.
 | |
| t = TempoClock.default;
 | |
| 
 | |
| )
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| /////////////////////////////////////////////////////////////////////////////////////
 | |
| // variation 2
 | |
| (
 | |
| r = Synth("reverbBus", [\inBus, b, \wet, 0.5]);
 | |
| 
 | |
| t.tempo_(80/60); // beats per minute
 | |
| 
 | |
| Pbind(
 | |
| 	\instrument, "plucking",
 | |
| 	\scale, Scale.major.tuning_(\just),
 | |
| 	\octave, 4,
 | |
| 	\degree, Pseq([1,3,7,8], inf), // four main notes
 | |
| 	\mtranspose, Pseq([Pseq([0],3),Pseq([-5],3)],inf), // switched mode every 3 notes (*2)
 | |
| 	
 | |
| 	\gtranspose, Pseq([Pseq([0],36),Pseq([4],36),Pseq([[-3]],36),Pseq([2],36)],inf),
 | |
| 	\ctranspose, Pser([Pseries(-4,1,6) +.x Pseq([0], 144)],1),
 | |
| 
 | |
| 	\coef, Pser([Prand([0.2,0.3,0.4,0.5],1), Prand([0.8,0.7,0.6,0.5],11)], inf),
 | |
| 	\dur, Prand([0.25,0.26,0.24,0.255,0.255,0.25], 240), 
 | |
| 	\decay, Prand([1,2,3,4,5], inf),
 | |
| 	\out, b, \amp, 0.4,
 | |
| ).play;
 | |
| )
 | |
| 
 | |
| 
 | |
| /////////////////////////////////////////////////////////////////////////////////////
 | |
| // variation 1 
 | |
| (
 | |
| ~reverb = Synth("reverbBus", [\inBus, b, \wet, 0.6]);
 | |
| 
 | |
| t.tempo_(60/60); 
 | |
| 
 | |
| Pbind(
 | |
| 	\instrument, "plucking",
 | |
| 	\out, b,
 | |
| 	\scale, Scale.major.tuning_(\just),
 | |
| 	\octave, 4,
 | |
| 	\degree, Pseq([1,3,7,8,Prand([7,10,11,13,14]),8,7,3], inf),
 | |
| 	\dur, Pseq(
 | |
| 		[
 | |
| 			Pwrand([
 | |
| 				Pseq([0.2,0.2]),
 | |
| 				//0.2,
 | |
| 				0.4,
 | |
| 				Pseq([0.1],4),
 | |
| 				Pseq([0.05],4)
 | |
| 			],
 | |
| 				[0.5,0.3,0.1,0.1] // weights
 | |
| 			)
 | |
| 		],
 | |
| 		240),
 | |
| 	\coef, Pwrand([0.8, 0.6, 0.4, 0.2], [0.4,0.3,0.2,0.1], inf),
 | |
| 	\amp, 0.4,
 | |
| 	\addAction, 0, // make sure new synths are added to head of group (optional)
 | |
| ).play;
 | |
| )
 | |
| 
 | |
| 
 | |
| /////////////////////////////////////////////////////////////////////////////////////
 | |
| // variation 3
 | |
| (
 | |
| r = Synth("reverbBus", [\inBus, b, \wet, 0.5]);
 | |
| 
 | |
| t.tempo_(1); // 
 | |
| 
 | |
| Pbind(
 | |
| 	\instrument, "plucking",
 | |
| 	\scale, Scale.major.tuning_(\just),
 | |
| 	\octave, 4,
 | |
| 
 | |
| 	\degree, Pseq([1, 3, 7, 3,-4,-2, 7, 8, 1,-2, 2, 3], inf),
 | |
| 	\mtranspose, Pseq([Pseq([0],144),Pseq([0],48),Pseq([3],48),Pseq([4],48)], inf),
 | |
| 	\gtranspose, Pseq([Pseq([0],36),Pseq([4],36),Pseq([[-3]],36),Pseq([2],36)],inf),
 | |
| 	\ctranspose, Pser([Pseries(-4,1,4) +.x Pseq([0], 144)],2),
 | |
| 
 | |
| 	\coef, Pseq([ Pseq([
 | |
| 			Prand([0.2,0.3,0.4,0.5],1),
 | |
| 			Prand([0.6,0.5],5),
 | |
| 			Prand([0.2,0.3],1),
 | |
| 			Prand([0.6,0.5],5)
 | |
| 		], 1),
 | |
| 			Prand([0.7,0.6],12)
 | |
| 		],inf),
 | |
| 	
 | |
| 	\dur, Pseq([Prand([0.25,0.25,0.24,0.245,0.255,0.25], 140),0.26,0.3,0.4,0.7], inf)
 | |
| 	      * Pseq([Pseq([0.8],110), Pgeom(0.8,1.002,34)],inf), 
 | |
| 
 | |
| 	\decay, Pseq([8, Prand([1,2,3,4], 4),3,2,1], inf),
 | |
| 
 | |
| 	\out, b, \amp, 0.4,
 | |
| ).play;
 | |
| ) |