How to sequence random patterns?

SeqPLoop does not regenerate random values on the “loop”. Ur does, but Ur doesn’t seem ideal for sequencing events in the same way as SeqPLoop.

let
notes = n (segment 12 $ irand 12) # s "supervibe"
notesUrShort = ur 1 "notes" [
  ("notes", notes)
  ] []
notesUrLong = ur 10 "notes" [
  ("notes", notes)
  ] []
in do
  d1 $ "cp"
  d2 $ seqPLoop [  -- Same notes every cycle.
    (0, 1, notes)
    ]
  d2 $ seqPLoop [  -- Same notes every cycle.
    (42, 43, notes)
    ]
  d2 $ notesUrShort  -- Different notes.
  d2 $ seqPLoop [  -- Same notes every cycle.
    (0, 1, notesUrShort)
    ]
  d2 $ seqPLoop [  -- Same notes every cycle.
    (42, 43, notesUrShort)
    ]
  d2 $ seqPLoop [  -- Same notes every cycle.
    (0, 1, notesUrLong)
    ]
  d2 $ seqPLoop [  -- Same notes every cycle.
    (42, 43, notesUrLong)
    ]
  d2 $ seqPLoop [  -- Same notes every cycle.
    (0, 1, (<~) (segment 999 $ irand 999) notes)
    ]
1 Like

Here is one workaround:

let
notes = n (segment 12 $ irand 12) # s "supervibe"
seqPLoopFunc randSeed = seqPLoop [
  (0, 1, (<~) randSeed notes),
  (1, 2, (<~) (randSeed + 1) notes) -- Different notes per cycle
  ]
in do
  setCycle 0
  d1 $ "cp"
  d2 $ seqPLoopFunc (irand 999)
  d2 $ seqPLoopFunc (fast 1.1 $ irand 999) -- Different notes per loop