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:

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ā€¦

13 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