«Micro-Rythms and micro-melodies with granular synthesis.» by jerome.lapuyade.lahorgue

on 17 Dec'18 15:25 in idmmicrorhythmsmicromelodies

In order to not saturate the server, no OSC message is sent at each micro-times; I use Demand Ugens and I can get very speed rhythms.

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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
//use samples to granulate
~sample1=Buffer.readChannel(s,"C:/Users/Public/EssaiSupercollider/SamplesPiecesMonnaie/sample1.wav",channels:0);
~sample2=Buffer.readChannel(s,"C:/Users/Public/EssaiSupercollider/SamplesPiecesMonnaie/sample2.wav",channels:0);
~sample3=Buffer.readChannel(s,"C:/Users/Public/EssaiSupercollider/SamplesPiecesMonnaie/sample3.wav",channels:0);
~sample2.play(loop:true)

(
SynthDef(\essai,{
	arg gate=1,amp=0.1,pan=0,freq=440,out;
	var sig,env,trig;
	trig=Impulse.ar(freq);
	sig=PlayBuf.ar(1,~sample2,freq,trig,loop:0);
	env=Env.adsr.ar(doneAction:2,gate:gate);
	Out.ar(out,Pan2.ar(sig*env*amp,pan));
}).add;
)

(
SynthDef(\essai,{
	arg gate=1,amp=1,pan=0,freq=440,out,dur;
	var sig,env,trig;
	trig=Impulse.ar(freq);
	//sig=TGrains.ar(2,trig,~sample1,freq,dur:1/freq,amp:1);
	sig=GrainBuf.ar(2,trig,BufDur.kr(~sample1)/freq,~sample1,freq,pos:0,pan:0);
	env=Env.adsr.ar(doneAction:2,gate:gate);
	Out.ar(out,Pan2.ar(sig*env*amp,pan));
}).add;
)


(
SynthDef(\micromelody,{
	arg rate=1,gate=1,durGrain=1, attackTime=0.01, decayTime=0.3, sustainLevel=0.5,fadeTime=1,rangeChorus=1.02,rangeChorusBis=1.02,out=0,amp=1;
	var env,chorus,chorusbis,filtermod,source,snd,sig,trigGrain,pitchGrain,freq,impulse;
	impulse=Impulse.ar(rate);
	freq=Demand.ar(impulse,0,Dseq(([[0,2,4],[2,4,6],[2,4,7],[4,6,8],[-1,0,2],[2,4,5]].degreeToKey([0,2,4,5,7,9,11])+60).midicps,inf));

	chorus = freq.lag(2)*LFNoise1.kr([0.4, 0.5, 0.7, 1, 2, 5, 10]).range(1,rangeChorus);
	chorusbis = freq.lag(2)*LFNoise1.kr([0.4, 0.5, 0.7, 1, 2, 5, 10]).range(1,rangeChorusBis);
	env=Env.adsr(attackTime:attackTime,decayTime:decayTime,sustainLevel:sustainLevel,releaseTime:fadeTime).ar(doneAction:2,gate:gate);
	source=AY.ar(tonea: AY.freqtotone(chorus),toneb: AY.freqtotone(chorusbis),mul:0.5);
	filtermod = SinOsc.kr(1/16).range(1, 10);
	snd = LPF.ar(in: source, freq: freq*filtermod);
	snd = Resonz.ar(in: snd,freq: freq,bwr: Rand(2.0,10.0));
	trigGrain=impulse;
	sig=GrainIn.ar(2,trigGrain,durGrain,snd);
	Out.ar(out,Pan2.ar(sig,0));

}).add;
)


a=Synth(\essai)
TempoClock.tempo=1
Pdef(\essai,Pbind(\instrument,\essai,\degree,Pseq([[0,2,4],[2,4,6],[2,4,7],[4,6,8],[-1,0,2],[2,4,5]],inf),\dur,1,\amp,10,\octave,3))
Pdef(\essai,Pmono(\essai,\degree,Pseq([[0,2,4],[2,4,6],[2,4,7],[4,6,8],[-1,0,2],[2,4,5]],inf),\dur,0.1,\amp,1,\octave,5))

Pbind(\instrument,\micromelody,\rate,1).play
a=Synth(\micromelody)
a.set(\rate,100)
a.set(\durGrain,0.01)

Pmono(\micromelody,\rate,Pseq(((0..7).degreeToKey([0,2,4,5,7,9,11])+84).midicps,inf),\durGrain,1/Pkey(\rate)).trace(\durGrain).play

Pdef(\essai).play




/********************** MICRO-RYTHMES ******************************/
//use drum samples
(
~kick=Buffer.readChannel(s,"C:/Users/Public/EssaiSupercollider/Drums/SD01.WAV",channels:0);
~claps=Buffer.readChannel(s,"C:/Users/Public/EssaiSupercollider/Drums/CLAPS.WAV",channels:0);
~closeHat=Buffer.readChannel(s,"C:/Users/Public/EssaiSupercollider/Drums/CLHAT1.WAV",channels:0);
~openHat=Buffer.readChannel(s,"C:/Users/Public/EssaiSupercollider/Drums/OPHAT1.WAV",channels:0);
)
(
SynthDef(\microRythmKick,{
	arg rate=1,rateGrain=1;
	var impulse,claps,trig;
	impulse=Impulse.ar(rate);
	trig=Demand.ar(impulse,0,Dseq([1,0,0,0],inf));
	claps=GrainBuf.ar(2,trig,BufDur.kr(~claps),~claps,rateGrain);
	Out.ar(0,claps)
}).add;

SynthDef(\microRythmCloseHat,{
	arg rate=1,rateGrain=1;
	var impulse,claps,trig;
	impulse=Impulse.ar(rate);
	trig=Demand.ar(impulse,0,Dseq([0,1,0,1],inf));
	claps=GrainBuf.ar(2,trig,BufDur.kr(~closeHat),~closeHat,rateGrain);
	Out.ar(0,claps)
}).add;

SynthDef(\microRythmOpenHat,{
	arg rate=1,rateGrain=1;
	var impulse,claps,trig;
	impulse=Impulse.ar(rate);
	trig=Demand.ar(impulse,0,Dseq([0,1,0,1],inf));
	claps=GrainBuf.ar(2,trig,BufDur.kr(~openHat),~openHat,rateGrain);
	Out.ar(0,claps)
}).add;



)


a=Synth(\microRythmKick)
a.set(\rate,10)
a.set(\rateGrain,10)
(
{
	a=Synth(\microRythmKick,[\rate,10,\rateGrain,20]);
	b=Synth(\microRythmCloseHat,[\rate,10,\rateGrain,20]);
	0.01.wait;
	"part1".postln;
	c=Synth(\microRythmOpenHat,[\rate,10,\rateGrain,20]);
	10.wait;
	"part2".postln;
	a.set(\rateGrain,1);
	b.set(\rateGrain,1);
	10.wait;
	"part3".postln;
	b.set(\rate,1);
	c.set(\rateGrain,1);
	2.wait;
	"part4".postln;
	a.set(\rateGrain,10);
	b.set(\rateGrain,10);
	5.wait;
	"part5".postln;
	c.set(\rateGrain,10);
	a.set(\rate,5);
	c.set(\rate,5);
	10.wait;
	"part6".postln;
	a.set(\rateGrain,1);
	b.set(\rateGrain,1);
	c.set(\rateGrain,1);
	10.wait;
	"part7 et fin".postln;
	d=Synth(\microRythmKick,[\rate,5,\rateGrain,1]);
	e=Synth(\microRythmCloseHat,[\rate,5,\rateGrain,1]);
	f=Synth(\microRythmOpenHat,[\rate,5,\rateGrain,10]);
	a.set(\rateGrain,0.1);
	b.set(\rateGrain,0.1);
	c.set(\rateGrain,0.1);
	a.set(\rate,10);
	b.set(\rate,10);
	c.set(\rate,10);

}.fork;
)

a.free
b.free
c.free
d.free
e.free
raw 4972 chars (focus & ctrl+a+c to copy)
reception
comments