«Three one liners ( or, better, many liners )» by ttsesmetzis

on 24 Nov'14 09:03 in bitwisealgorithmic

Based on the examples and references from http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/one-liner-C-code-in-SC-td6854421.html#a6903794

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
Ndef(\oneLine).play
(
Ndef(\oneLine,{
	var t, x, y, z, exp = 11, length;
	length = 2.pow( exp );

	t = PulseCount.ar( Impulse.ar( 8000 ) );

	y = InFeedback.ar( 16, 2 );

	x = ( t >> 6 | ( y * 2 << 3 ) );
	// x = ( t * 5 >>  12  ).bitXor( y * 3 << 6  & ( [ 16, 18 ] * t ) );

	Out.ar( 16, x);

	x % length / ( length - 1 ) * 2 -1  * 0.5;
}
)
)

(
var voices = 5;
Ndef(\oneLine).clear;
Ndef(\oneLine, {
	var t, x, y, z, exp = 11, length;
	length = 2.pow( exp );
	t = PulseCount.ar( Impulse.ar( 8000 ) );

	y = InFeedback.ar( 16, voices );

	x = ( t * 5 >>  12  )
	.bitXor( 
		y * 3 << Demand.kr(
			Impulse.kr( 0.1 ! voices ) , 
			0, 
			Drand( (3..11), inf ) 
		) & ( 
			(13..17).choose.postln * t 
		) 
	);

	Out.ar( 16, x);

	x % length / ( length - 1 ) * 2 - 1  * voices.reciprocal;
}
);

Ndef(\y, { Splay.ar( LeakDC.ar( Ndef.ar(\oneLine, voices) ) ) } ).play
)
raw 914 chars (focus & ctrl+a+c to copy)
reception
comments