Live stream #5 - general catchup + Q&A

Hi all members of @cycle0 and @cycle1!

It's definitely time for a live stream. Some will be early in the course, some will be 'caught up' and following the videos as I add them.. So all questions welcome! Especially as it's always good to go over earlier topics.

It'll be in just under 12 hours from now. Hopefully this will show the time in your timezone:

I'll be live here:



I had problems getting this to work in the video:

d1 $ struct (binaryN 16 (irand 9999)) $ up " 3 6 5 4 2 5 6" # sound "supergong" 

Here's the solution:

d1 $ struct (binaryN 16 (segment 1 $ irand 9999)) $ up " 3 6 5 4 2 5 6" # sound "supergong" 

irand is a continuous flow of random numbers, which it causing no events to be created. By using segment 1, only one random number is picked per cycle, and everything starts working. I was having a brain freeze in the live stream and kept trying struct 1 which makes no sense.



Ok thank you very much, i get it now.

In fact, i had a second related question that would have followed the first one :slightly_smiling_face:
Why does that piece of code constantly picking a random number (and not just one on evaluation)?

let x = segment 1 $ irand 9999
d1 $ struct (binaryN 16 (x)) $ sound "bd:0"

I also tried without the "do" block without any success:

x = segment 1 $ irand 9999

d1 $ struct (binaryN 16 (x)) $ sound "bd:0"

My goal here is being able to change the pattern's rhythm by evaluating the "do" block or the variable line (in the second example scenario).

In Tidal, random numbers are a function of time, so will indeed keep changing. Here's one workaround that uses the system random number generator:

import System.Random

  x <- randomRIO (0, 9999)
  d1 $ struct (binaryN 16 (pure x)) $ sound "bd:0"
1 Like

Ok thanks it works very well. Now i feel that it would be really useful to learn Haskell basics.