«sieves» by eli.rosenkim

on 20 Apr'22 13:31 in xenakismodulesieve

function for working with xenakis' sieves made of residual classes/modules function takes a set of arguments for modulus, shifter and number of digits to compute, and returns a set, which can be used to construct sieves

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
// https://research.gold.ac.uk/id/eprint/15753/1/11.2-Dimitris-Exarchos-&-Daniel-Jones.pdf


(//function that creates a set from arguments defining a residual class
~mod = {
	arg modulus, residue, terms;
	var set, i=0, term = residue;
	set = Set[];
	while(
		{i < terms},
		{
			set.add(term);
			term = term + modulus;
			i = i+1;
		}
	);
	set;
};
)

//Symmetric sieves may be expressed merely as a union of two different modules
(~mod.(3, 0, 4)|~mod.(4, 0, 4)).asArray.sort; //to get just the first period of the intervallic sucsession, the terms computed should be equal to the highest modulus. The period is equal to the LCM of the moduli, or 12.
(~mod.(3, 0, 4).union(~mod.(4, 0, 4))).asArray.sort.differentiate.drop(1); //intervallic sucsession
(~mod.(3, 0, 8).union(~mod.(4, 0, 7))).asArray.sort.differentiate.drop(1);//two periods of the intervallic sucsession, the terms computed for the module with the larger modulus should be twice the larger modulus minus one

(~mod.(2, 0, 3)|~mod.(3, 0, 3)).asArray.sort;
(~mod.(2, 0, 3)|~mod.(3, 0, 3)).asArray.sort.differentiate.drop(1);
(~mod.(2, 0, 6)|~mod.(3, 0, 5)).asArray.sort.differentiate.drop(1);//two periods of the intervallic sucsession, the terms computed for the module with the larger modulus should be twice the larger modulus minus one


//two different ways to write the major scale
(~mod.(4,2,4)&~mod.(3,2,4)) == ~mod.(12,2,1) //you can write scale degrees either as an intersection of modules with modulus 3 and 4, or as a module with modulus of the period of the tuning (in this case 12 for 12tet)
(~mod.(4,0,4)&~mod.(3,0,4)) == ~mod.(12,0,1)


(~mod.(12,0, 3) | ~mod.(12,2,2) | ~mod.(12,4,2) | ~mod.(12,5,2) | ~mod.(12,7,2) | ~mod.(12,9,2) | ~mod.(12,11,2)).asArray.sort; //two octaves of major scale written using modules with modulus 12
(~mod.(12,0, 3) | ~mod.(12,2,2) | ~mod.(12,4,2) | ~mod.(12,5,2) | ~mod.(12,7,2) | ~mod.(12,9,2) | ~mod.(12,11,2)).asArray.sort.differentiate.drop(1);//familiar major pattern

((~mod.(4,0,4)&~mod.(3,0,4)) | (~mod.(4,2,4)&~mod.(3,2,4)) | (~mod.(4,4,4)&~mod.(3,4,4)) | (~mod.(4,5,4)&~mod.(3,5,4)) | (~mod.(4,7,4)&~mod.(3,7,4)) | (~mod.(4,9,4)&~mod.(3,9,4)) | (~mod.(4,11,4)&~mod.(3,11,4))).asArray.sort;//one octave of major scale written using intersections of modules with modulus 3 and 4

//regrouping by modules with modulus 4 via distributive property
(
(( ~mod.(4, 0, 4) & (~mod.(3, 0, 4)|~mod.(3, 1, 4)) ) |
( ~mod.(4, 1, 4) & (~mod.(3, 0, 4)|~mod.(3, 2, 4)) ) |
( ~mod.(4, 3, 4) & (~mod.(3, 1, 4)|~mod.(3, 2, 4)) ) |
( ~mod.(4, 2, 4) & ~mod.(3, 2, 4) )
).asArray.sort;
)


//The theoretical expression of an asymmetric sieve is impossible without using intersection. Any sieve that can be expressed using only union is symmetric, although the symmetry can be large and "rotated" (not at the middle index of the ordered set). Decomposing the sieves such as the decomposition of the major scale in the previous sections is not possible for sieves with prime periods.
raw 3030 chars (focus & ctrl+a+c to copy)
reception
comments