Getting different threads of random elements from lists

SuperCollider:

(
	SynthDef (\mult_synth) {
		arg sustain = 1, pan = 0, amp = 0.2, out = 0,
		freq = 220, numerator = 3, denominator = 2;

		var sig, env;
		env = Line.kr (amp, amp, sustain, doneAction:2);
		sig = SinOsc.ar (freq * numerator / denominator);
		sig = Pan2.ar (sig, pan, env);

		OffsetOut.ar (out, sig);
	}.add;
)

in TidalCycles:

d1 $ n "0!6"
# s "mult_synth"
# pF "numerator" (choose [1..12])
# pF "denominator" (choose [1..12])

I was wondering whether there was a neat / cute way to seed the choose functions to be uncoupled? In the above example, both functions are choosing the same "random" number from the list, causing the frequency to always be multiplied by 1.


edit: Mike Hodnick suggests using the rotate function <~ (from here)

edit 2: so the syntax for patterns works as follows:

d1 $ n "0!6"
# s "mult_synth"
# pF "numerator" ((1 <~) $ choose [1..12])
# pF "denominator" ((2 <~) $ choose [1..12])

... so long as the patterns are being rotated by different amounts, the streams will contain different numbers :ok_hand:

1 Like

Yes, rotate, or slow, by any amount. Anything that modifies time.

Only very recently I learned that Tidal's mininotation parser contains some magic to de-correlate randoms within one string:

-- correlated: (always 0 and 2, or 1 and 3)
stack ["[0|1]*8","[2|3]*8"] :: Pattern Int 
(0>⅛)|0
(0>⅛)|2
...
(¾>⅞)|0
(¾>⅞)|2
(⅞>1)|1
(⅞>1)|3

-- not correlated:
"[[0|1]*8,[2|3]*8]" :: Pattern Int
...
(½>⅝)|1
(½>⅝)|3
(⅝>¾)|0
(⅝>¾)|3
(¾>⅞)|0
(¾>⅞)|2
...

Implementation: see seed (creation: Tidal/ParseBP.hs at main · tidalcycles/Tidal · GitHub , usage: Tidal/ParseBP.hs at main · tidalcycles/Tidal · GitHub) . This could deserve a comment in the source?