Skip to main content

Module sieve

Module sieve 

Source
Expand description

Xenakis sieves, ported from music21’s sieve module.

A sieve is a logical expression over residual classes. 3@0 selects every integer congruent to 0 modulo 3; |, & and ^ combine classes as union, intersection and symmetric difference; - complements one; and {} or () group. Applied to semitones, the resulting integer set is a scale — the major scale is (-3@2 & 4) | (-3@1 & 4@1) | (3@2 & 4@2) | (-3 & 4@3).

Only the part music21’s SieveScale actually needs is ported: parsing an expression, testing membership, and reading off the interval widths of one period. music21’s sieve.py is a 2,000-line module that also does sieve compression, Zeroth/Sieve segment formats and pitch-range realization, none of which has a caller here.

Structs§

Sieve
A parsed Xenakis sieve.