Week 1 lesson 1 - Tidal interaction

Ok I've made another video, and although we're not supposed to start until Saturday there's no point holding this back!

It's aimed at people new to live coding, and goes through the basics of how to interact with Tidal - starting and stopping code and so on.

Look at the video description to jump to different parts, and switch subtitles on if I'm speaking too fast.

Again any questions or feedback about this let me know. Please let me know if you'd prefer it edited down, with the "um"s and "ah"s taken out, and I can experiment with that. Longer term I'd prefer to spend time making videos than editing them, but if it would be an improvement I'd be very happy to pay someone to do it from the pay-as-you-feel-wall cash.

Next lesson:
https://club.tidalcycles.org/t/week-1-lesson-2-loading-sample-packs/341

27 Likes

No need to edit, IMHO - I don't find it distracting at all. You'll probably need the time for the install thread anyway :slight_smile:

5 Likes

Also no need to edit in my opinion…

To be honest, there are some very heavily edited videos out there where they not only delete every “um”, “ah” but also most of the breaths and gaps between words; I usually find those very irritating and artificial. This video looked good to me!

5 Likes

I just chedked, On the mac, it looks like you can do control-enter or command-enter to evaluate a block of code: either work.

3 Likes

Great video!
I've been introduced to programming using languages with no significant white space, so I usually get tricked by indentation when interacting with Tidal
I don't know if this is the right time to ask but I'd love to see some tips to get indentation right, maybe in a future video :slight_smile:

You could try to toggle invisibles and toggle indent guide from the command palette in atom to have a visual cue of them. There are some packages as well that color the indent guides so that you can see when you’re inside an indent block in your code. Hope that helps

2 Likes

Good idea. Indentation rules are not something I’ve covered in workshops before but definitely worth going through.

4 Likes

Great video. No editing needed, you explain things at a good pace.

What is the grammar of each line e.g "d1 $ sound “bd sd”? What would you call d1 or d2, and what is the function of the dollar sign?

Thank you!

4 Likes

Good questions, I’ll do a proper, detailed breakdown of this very soon. In brief though you can think of d1 as a connection to (super)dirt. $ separates a function (in this case d1) from an input (in this case the pattern you’re passing to it, sound "bd sd"). Without it, d1 would only receive the sound, and the "bd sd" would be left dangling. An alternative is to use parenthesis like d1 (sound "bd sn"), that works but that can fiddly matching up the opening and closing brackets, when the pattern gets more complicated.

"bd sd" is a pattern of words, sound turns it into a pattern of sounds, and $ makes sure that happens before it’s given to d1, which then generates events from it to send to superdirt.

The dollar is Haskell syntax, and is probably the hardest thing to get your head around with Tidal. It takes a while before it ‘clicks’, but the good thing is that it really doesn’t much harder than this…

12 Likes

One thing I now find quite weird with the $ is that in your description it seems to do 2 different things at once. 1. « separate a function from an input » (ok) 2. sort of replace parenthesis, which seems quite different. Especially, how does the $ « knows » where the virtual parenthesis ends ? Why is d1 $ sound « bd sd » correctly understood as d1 (sound « bd sd ») and not, say, d1 (sound) « bd sd », with the « bd sd » left dangling ? Is it because the $ does something like « everything on my right is one input, stretch the virtual parenthesis till the end of that line of code » ?
Not sure I am clear in my confusion !

1 Like

Yes it’s strange. I suppose you can think about the parenthesis here d1 (sound "bd sn") as separating the input sound "bd sn" from the function d1 too.

Or maybe it’s easier to think about changing the order of how things are “worked out”? It’s the same as in arithmetic, (1 + 2) * 3 gives a different result (9) from 1 + (2 * 3) (which equals 7). Without parenthesis, 1 + 2 * 3 would equal 7, the same as the latter, because there’s an arithmetical rule that * takes precedence over +.

It might also help if I explained what $ actually does. Just like +, it’s an inline operator. It takes two inputs, a function (on its left) and an input to pass to that function (on its right). Then it passes that input to the function and returns the result. This is its entire definition: f $ x = f x. That’s it! It’s so simple that it’s difficult to understand. It’s almost like it’s doing nothing at all.

Pretty much the only thing that makes $ useful is that (just like +) it has very low precedence. In fact I believe it has the lowest possible precedence. This means that anything on its right hand side will be “worked out” first, before it gets hold of the result, to pass to the function on the left.

Does that help? Probably not… But don’t worry, we’ll work with lots of examples and the usefulness of $ with slowly become clear.

13 Likes

very useful!! thanks @stereo.vision!

yes this helped ! thanks !

1 Like

YES, this very much helps. It’s been about a year since I’ve touched tidal and this is the kind of stuff that really helps when you’re first fiddling around or coming back to it. Otherwise, I find myself “experimenting” in a bad way – i.e., doing stuff and having no real grasp of what’s happening.

Understanding how the functions and controls, etc. interact is pretty crucial – at least I’ve found it to be. Thanks for this.

Thanks a lot for taking the time to explain all with such a detail. It is so helpful to fully understand the theory behind this and put in practice!

This page tries to explain it.

Copy and paste the following lines into Atom:

import Data.List
sort "julie" ++ "moronuki"
sort $ "julie" ++ "moronuki"

Execute them one by one with Shift-Enter and watch the output in Atom’s status window at the bottom:

t> "eijlumoronuki"
t> "eiijklmnooruu"

Note how in the first example (lacking the $) the sort function applies only to “julie” and “moronuki” is simply appended, while in the second example (including the $), “julie” and “moronuki” are concatenated before the resulting string “juliemoronuki” is finally sorted.

9 Likes

Hi @yaxu

I get a little trouble when I’m putting the snare, collider show me this :

no synth or sample named ‘sd’ could be found.

You can try running ~dirt.loadSoundFiles; to load the basic library again, it might work :wink:

Here’s a more obvious example:

import Data.Char                -- package providing "toUpper" to make a single character upper case
uc xs = [ toUpper x | x <- xs ] -- our own function "uc" to make a string all caps
uc "julie" ++ "moronuki"        -- uc is applied only to julie, moronuki is added after the fact
uc $ "julie" ++ "moronuki"      -- uc is applied after julie, moronuki have been concatenated.

Result:

t>"JULIEmoronuki" -- uc is applied only to julie, moronuki is added after the fact
t>"JULIEMORONUKI" -- uc is applied after julie, moronuki have been concatenated.
2 Likes

Thanks @loopology. It’s worth noting though that this example is for working with lists, and Tidal isn’t based on lists but functions. So, in case anyone is wondering about the syntax here with ++ and <- etc, you’re unlikely to need that for tidal, so don’t worry about it.

1 Like