# Sieves to spectrum

hey, ive been investigating Sieves alot lately there is a Sieve class inside miSCellaneous_lib.

Ive been reading some resources like these to grasp how Xenakis worked with sieves to create pitches, rhythm and timbres:

https://www.jstor.org/stable/3681712

i would like to create a function where a specific sieve could be translated into frequency ratios for beeing used with additive synthesis:

``````(
// PSVunion_o([6, 5, 12, 0, 12, 2, 12, 4, 12, 7, 12, 9]).asStream.nextN(15);
// pseudo code;
var sieve = [0, 2, 4, 5, 7, 9, 11, 12, 14, 16, 17, 19, 21, 23, 24];

~sievesToPitch = { |sieve, range = #[c2, c4], tuning|
var array = sieve - 24; // two octaves down
array = array + 60;
array;
};
~sievesToPitch.(sieve, [36, 60], \just);
)
``````

I think it would be great if you could specify a range and a tuning, or do you have any better ideas?
With the implementation above ive specified a range from C2 to C4 by hand and its only ET12, no quarter tones.

I think the problem is that you have to make sure that the period of the Sieve lines up neatly with the range (divisions between min and max). In this case it works for mapping the Sieve to ET12 between C2 and C4, but just for this case.
Does somebody know how to generalize the function?

thanks a lot.

1 Like

Im using these now:

``````(
~sievesToPitch = { |sieve, step = 1|
(sieve * step).midiratio;
};
~sievesToPitchJust = { |sieve|
sieve + 1
};
)

(
// conversion of one set of intervals from "Xenakis - Pour la Paix" to points
var intervals = [1, 3, 1, 1, 5, 1, 2, 1, 6, 1, 4, 1, 1, 2, 1, 1];
~sieve = intervals.toSieve(\intervals).list.asArray;
~sieve.debug(\sieve);
// if you dont have the Sieve class, these are the points
// ~sieve = [0, 1, 4, 5, 6, 11, 12, 14, 15, 21, 22, 26, 27, 28, 30, 31, 32]
)

// Harmonic series
(
var ratios, inharmonicity;
~root = 40.midicps;
ratios = ~sievesToPitchJust.(~sieve);
inharmonicity = 0.001;
ratios = ratios * (1 + (ratios * ratios * inharmonicity)).sqrt;
~freqs = ratios * ~root;
{
var sig = SinOsc.ar(~freqs) * ((~freqs / ~root).log2 * -8).dbamp;
Limiter.ar(sig.sum) ! 2 * 0.1;
}.play;
)

// midiratios, quarter tones: step: 1 / 2
(
var ratios;
~root = 70.midicps;
ratios = ~sievesToPitch.(~sieve, step: 1 / 2);
~freqs = ratios * ~root;

{
var sig = SinOsc.ar(~freqs) * ((~freqs / ~root).log2 * -8).dbamp;
Limiter.ar(sig.sum) ! 2 * 0.1;
}.play;
)
``````

One for mapping the sieves to midiratios and the other for using them for harmonics.
Is it possible to introduce a tuning, so that i could merge both functions to one? thanks