adding proper code

main
Luka Prinčič 2022-01-30 23:45:47 +01:00
parent 666cf46c66
commit eb3aa5624f
1 changed files with 129 additions and 0 deletions

129
algoforte01.scd Normal file
View File

@ -0,0 +1,129 @@
/*
*/
// algoforte #3 ///////////////////////////////////////////////////////////////////////
//
//
//
//
//
// processing input from piano
(
Ndef(\inDSPout, {
var snd, flt, rev, dly;
snd = SoundIn.ar([0,1]);
snd = snd * LFPulse.kr(LFNoise1.kr(1/5).range(3,20), 0,
0.5).range(LFNoise1.kr(1/10).range(0.6,1),1).lag(0.00001);
flt = BPF.ar(snd, LFNoise1.kr([1/4,1/5]).exprange(500,5000), 0.3, 2); // ??
dly = CombL.ar(flt + snd, 1, SinOsc.ar([1/60, 1/70]).range(1, 1.2), 10, 0.3 * LFNoise1.kr(1/10).range(0.4,1) , snd);
rev = JPverb.ar(flt + snd, 6, 0, 20) * LFNoise1.kr(1/10).range(0.4,1);
snd = snd + dly + rev * 0.8;
Limiter.ar(snd, 0.8);
})
)
Ndef(\inDSPout).fadeTime = 4
Ndef(\inDSPout).play(fadeTime:5)
Ndef(\inDSPout).end(30)
Ndef(\inDSPout).stop
(
Pbindef(\p220105b, \type, \midi, \midicmd, \noteOn, \midiout, m, \chan, 1,
\dur, Pseq([
Pn(1/2, 50),
Pseq([1, 1/2, Pn(1/4,4), 2], 20), // 7*20
Pseq([
1,
1/2,
Pn(1/4, 2),
Prand([2, 1/2, Pn(1/3,3)]),
Pwrand([1/2, Pn(1/8,4)], [0.9, 0.1]),
Pwrand([1/2, 6,], [0.9, 0.1]),
], 10 * 5 ),
Pn(1/2, 60)
])
* Pwhite(0.99,1.2),
\amp, Pseq([0.6, Pwhite(0.2,0.5,3), 0.5, Pwhite(0.2,0.5,2)], inf) * Pwhite(1, 1.1),
\degree, Place([0, 0, 2, 0, [2, 3, 5]],inf), // cycle of 5
\scale, Scale.minor,
\mtranspose, Pseq([
0,
5,
7,
[2,5],
[3,6],
[0,2]
[0,5,7],
[0,5,9],
[3,5,7,10],
[2,5,9,11],
[0,4,7,11] + 7,
[5,4,7,11],
[0,4,-7]
],inf) + Pseq([ Pn(0, 50 + (7*20)), Pseq([Pn(0,50), Pn(3,20), Pn(-2,20)], 3)], inf), // (50+140+(3x90))
\ctranspose,
Pseq([
Pn(0, 50+140),
Pseq([Pn(0,60), Pn(5, 60), Pn(0,60), Pn(7,60)]), // (4*60+50+140)
Pn(0,inf) //
])
+ Pseq([ Pn(0,300), Pwrand([0, 5, 7], [0.9, 0.05, 0.05], 100), Pn(0, inf)]),
\octave, Pwrand([5,[5,6],[4,6]], [0.8,0.1,0.1], inf),
\legato, Pwhite(0.5,4)
).play
)
// -->
b = Buffer.alloc(s, s.sampleRate*10, 1)
// start recording into buffer via 'in'
Ndef(\recbuf, {var sn=\in.ar(0!2); RecordBuf.ar(sn[0], b)})
// plug output from inDSPout to in of \recbuf
Ndef(\recbuf) <<>.in Ndef(\inDSPout)
// is there something in a buffer?
b.plot
// stop recording to a buffer
Ndef(\recbuf).clear
// GRANULATE THE CONTENTS OF THE BUFFER
(
Ndef(\gran, {
var snd = GrainBuf.ar(2,
trigger: Impulse.ar(LFNoise1.kr(1/10!3).exprange(1, 80) * LFNoise0.ar(100).range(0.7,1.1)),
dur: LFNoise1.ar(1).range(0.08,0.1),
sndbuf: b,
rate:[1,1/2,2], pos:LFNoise1.kr(1/20!3).range(0,1),
pan: LFNoise0.ar(100).range(-1,1)
);
snd = LPF.ar(snd, LFNoise1.kr(1/10!3).exprange(500,10000));
snd = Mix(snd);
snd = JPverb.ar(snd, LFNoise1.kr(1/10!2).range(1,10)) + snd;
Limiter.ar(Mix(snd), 0.8) * Env.circle([0.01,0.3,0.01],90,\cub).kr * 0.5;
})
)
Ndef(\gran).fadeTime = 5
Ndef(\recbuf).play
Ndef(\gran).end(30) // fadeout
Ndef(\recbuf).stop // stop immediately (send note offs)