Problem with choose

Maybe it's a silly question but I've a sample folder called analog7a. If I run it by itself (d1 $ s "analog7a?0.2") there's no problem at all but if I declare it as a variable (let sound3 = "analog7a?0.2") running inside a pattern SC doesn't found it. Why?
Thank you!!!

Hi @nuntxaku - I'm not sure I quite understand but if you are trying to do something like

d1 $ sound "sound3"

SuperCollider will be looking for a folder called "sound3" - asfaik you can't call a variable from inside the mininotation.

What effect are you trying to acheive? As there may be another approach.

Hi @heavy.lifting thank you. That's not the problem. I did something like this (is just a little piece of a big block of code)

let sound1 = "scan"
let sound2 = "microones"
let sound3 = "analog7a?0.2"

d2
$ sometimesBy 0.15 (within (0, 0.25) (#squiz "[5]"). (hurry 4))
$ stack [
slow 2 $
slice 4 " 2 3 1 0" $
s (choose [sound1, sound2, sound3])
# n (irand 2)
# cut 1
# orbit 1

The problem comes when I write

let sound3 = "analog7a?0.2"

instead of

let sound 3 = "analog7a"

I think the probabilistic ?0.2 inside a "let" is the problem.

Ah, sorry, I understand what you're trying to do now.

I think this is to do with how choose spits out patterns & how the mininotation works. I'm not a genius on tidal innards so I can't explain this well. But I have found something else that I think does what you want:

let sound3 = (sound "arpy*8?0.2")

let sound4 = (sound "cpu")

d3 $ randcat [sound3, sound4]

So in your code something like this (I haven't tested it though, sorry!):

let sound1 =  (sound "scan")
let sound2 = (sound "microones")
let sound3 = (sound "analog7a?0.2")
d2
$ sometimesBy 0.15 (within (0, 0.25) (#squiz "[5]"). (hurry 4))
$ stack [
slow 2 $
slice 4 " 2 3 1 0" $
randcat [sound1, sound2, sound3]
# n (irand 2)
# cut 1
# orbit 1

Let me know if that helps!

1 Like

What is the exact problem here? I can run this fine (with the emacs mode for tidal, ghci-8.10.1)

let x = s "arpy*8?0.2"

d1 x

Note there is an empty line between , so I have to send (with control-e, this depends on the editor) the upper code block first (will not have audible effect but ghci binds the name x) and the lower block after that.

At the point where d1 x fails (to OP: please include the exact error message, always), what is the output of evaluating x alone? (It should show the ASCII representation of the events in the pattern.)

Alternatively, use one block of code (note the extra in)

let x = s "arpy*8?0.2"                                                              
in  d1 x 

Hi @jwaldmann - see my post above - the problem isn't with the let statement but with how choose works.

1 Like

@jwaldmann - also, this has been playing on my mind so I'm going to add a further response. I'm a bit put out that you have dismissed both OP and me when you clearly haven't tested this yourself. If you had you would have realised that OP does have a genuine problem. Actually my first response was to test a simple let and d1 x as you have done. It was only on looking deeper into the context that I realised choose was creating the issue with the ?0.2. (There is also the issue of choose being a continuous pattern and needing events to map to). There is no error message because the code is not "wrong", it's just not working as intended.

My solution solves the problem. Perhaps it still doesn't meet the desired effect OP is looking for, in this case we can revisit. Perhaps it isn't the most elegant solution. Perhaps I don't even really understand why choose isn't working as one might expect. However, my response is helpful, whereas your is not and dismisses both what is a genuine difficulty and a genuine attempt to help someone get the result they are looking for.

Why did you post this? Maybe this wasn't your intention, but it comes across as though you don't believe I could know what I was talking about in my post. I will be the first to put my hand up and say I don't have a strong technical background. However, I do know a lot about getting the desired musical response out of Tidal. I shouldn't have to explain myself here but I have been using and teaching Tidal for 4 years, and I've toured internationally performing with it. I'm a co-instructor on the online course with Alex, and I do know what I'm talking about.

Please be mindful that this is intended to be a welcoming and friendly community and there are people with different skill levels, technical backgrounds and experience here. Replies such as yours can be incredibly off-putting to posters, and particularly to people without a technical background. It makes people feel stupid for asking questions. And it can even make people feel stupid for trying to answer them.

4 Likes

Thank you!!!!

This took me a while but yep you've put your finger on it @heavy.lifting. I think randcat is the answer too.

One underlying issue is that choose takes a list of values, not a list of patterns, so mini-notation stuff like ?0.2 doesn't work in there.. Tidal ends up thinking you want to play a sound that's actually called "arpy*8?0.2", which of course superdirt fails to find. Also as @heavy.lifting says choose is continuous and doesn't have any structure.

randcat and choose look similar but these two subtleties in their behaviour means they're used in quite a different way.. hmm

2 Likes

Hi. Sorry, I was not reading and replying carefully enough, so I mistook the problem for something else (about white-space). Will try to do better.

@yaxu explained the technical reason: the types are different.

randcat :: [Pattern a] -> Pattern a
choose :: [a] -> Pattern a

The outcome is that the mini notation parser (that handles ?) is not applied inside choose ["foo?0"] because the list element has type String (not Pattern String).

Re: why did you post? I am planning to use Tidal in a course that I will be teaching, and I figure that the questions here, and those that will be asked by my students, will be similar.
I guess the difference is indeed that my students will have technical background. This shows in the style of my answers. I think that showing some technicalities (e.g., types of expressions) is helpful to "non-technical" people, but I also see your point that it can be off-putting. Thank you for reminding me.

2 Likes