Week 4 lesson 2 - random marathon: rand, irand, mininotation randomness, scramble, shuffle, choose + more

Ok my bad... In fact I was just trying to understand the function because i never use it and I already have a little something for looping duties:

lock n offset = timeLoop n . ((offset |- (slow n $ run n)) <~)

:ok_hand:

1 Like

I love the discussion about engagement with randomness above.

One text that takes on randomness km creative processes in a really interesting way is Michael Cook and Simon Colton: Generating Code For Expressing Simple Preferences: Moving On From Hardcoding And Randomness" (2015, Proceedings of the Sixth International Conference on Computational Creativity).

The abstract:

Software expressing intent and justifying creative decisions are important considerations when building systems in the context of Computational Creativity. However, getting software to express subjective opinions like simple preferences is difficult without mimicking existing people’s opinions or using random choice. In this paper, we propose an alternative way of enabling software to make meaningful decisions in smallscale subjective scenarios, such as choosing a favourite colour. Our system uses a combination of metrics as a fitness function for evolving short pieces of code that choose between artefacts. These ‘preference functions’ can make choices between simple items that are neither random nor based on an already existing opinion, and additionally have a sense of consistency. We describe the system, offer some example results from the work and suggest how this might lead to further developments in generative subjectivity in the future.

Basically they displace the randomness from random number generator to comparator functions like >, < which they evolve using generic algorithms.

The example programs are silly but useful, e.g.

public int compare(int i, int j) {
    if ((i < i)) {
        return 0;
        return 0;
    }
    if (((j + i) < j)) {
        i = i;
        return -1;
    }
    else {
        j = -491;
        return 1;
    }
    return 0;
}

Another kind of randomness is something which is maybe better described by other terms, but random chains which are not independent from one another; stateful randomness, or path-depenedent randomness. Things like random walks etc.

1 Like

Hi! First time posting here as i'm a very new user/learner (started 3 days ago). I just have a quick question regarding the below:

Is there a way to apply ? to a group so that it affects the entire group and not the individual parts?

Also i just wanted to say thanks to Alex @yaxu for...

  1. making Tidal Cycles (it's awesome)
  2. for your tutorial videos. They are really great.

Thanks!
Chris

hi @chris_collis, you can use degrade or degradeBy to remove events of an entire pattern.

d1 $ degradeBy 0.5 $ sound "kick [clap:4 off clap:5] kick snare" # speed 1.5 should do the trick.

degrade = degradeBy 0.5 = ?

1 Like

No? They wanted to "affect the entire group", presumably "group" = " syntactic unit" (in brackets, or before *2 in my example). Can be achieved with struct (using different queries to show effect of randomisation)

ghci> flip queryArc (Arc 0 1) $ struct (degrade "1*4") ("bd sn*2 bd*4 sn*4" :: Pattern String)
[(¼>⅜)-½|"sn",¼-(⅜>½)|"sn"]
ghci> flip queryArc (Arc 1 2) $ struct (degrade "1*4") ("bd sn*2 bd*4 sn*4" :: Pattern String)

[(1>1¼)|"bd",(1¼>1⅜)-1½|"sn",1¼-(1⅜>1½)|"sn",(1½>19/16)-1¾|"bd",1½-(19/16>1⅝)-1¾|"bd",1½-(1⅝>111/16)-1¾|"bd",1½-(111/16>1¾)|"bd"]

previous discussion:
mininotation degradeBy operator "as a whole" · Issue #869 · tidalcycles/Tidal · GitHub ? notation location · Issue #742 · tidalcycles/Tidal · GitHub

1 Like

For this specific question, I am interpreting "group" as this particular grouping of samples:

"kick [clap:4 off clap:5]? kick snare"

and "[affecting] the entire group" to mean randomly remove events from this particular pattern.

I suppose you could just put the whole thing in brackets and apply the ? operator to it, like so:

sound "[kick [clap:4 off clap:5]? kick snare]?"

or you could use degrade which is maybe the more blunt-force way of achieving this

thanks for the reply and yes sorry I should have been clearer. I didn't mean the whole pattern but just the "group" of notes between the square brackets as in the below.

"kick [clap:4 off clap:5]? kick snare"

so I would like [clap:4 off clap:5] to either play or not play. i'm probably not explaining well as I don't know the terminology but thanks for the assistance :slight_smile:

if you want a random choice between

either kick [clap:4 off clap:5] kick snare (all of the events in the inner group)

or kick ~ kick snare (none of the events in the inner group)?

then d1 $ sound $ mask "1 1? 1 1" "kick [clap:4 off clap:5] kick snare"

(mask - not struct as I wrote above)

2 Likes