Tidal futures

Work has started on a bit of a rewrite/refactor of Tidal, I thought I’d write a quick post about how things are progressing. There’s a github project here if you’d like more info or want to get involved.

Structure comes from where you want

In current Tidal, “the structure comes from the left” has become a bit of a mantra. In the next version, it’ll come from where you want.

For example `"1 2 3" + "4 5"` used to give you `"4 6 7"`, because the structure comes from the first part, and  that`2` in the middle starts in the first half of the cycle, so matches with `4`.

In the rewrite, by default, structure comes from both sides, so in the above example, you end up with the equivalent of `"1 [6 7] 8"` — the `2` gets split in two, to match with both `4` and `5`.

To get the old behaviour, of structure coming from the left, you’d use `|+`, i.e. `"1 2 3" |+ "4 5"`. To get structure from the right, you’d do `"1 2 3" +| "4 5"`, which would give you `"5 7"`.. Then `|+|` does exactly the same as `+`, i.e. it gets structure from both sides.

Unified pattern operators

`|+|`, `|+` and `+|` all work on patterns of parameters (now known as control patterns) as well as patterns of numbers. So these two are the same: `n ("1 2" + "3 4 5") + s "bass"` and `n "1 2" + n "3 4 5" + s "bass"`.

Of course there are also `*`, `/`, `%` and `-` versions of the above.

There is also `|>|` and `|<|` and friends; the arrow there points at where the values come from. So you could do `"[1 2] [3 5 6]" |> "5 2"` to take the structure from the left, and the values from the right, giving you `"[5 5] [2 2 2"`. Aha!

`|>` basically does what `#` does now, we’ll likely keep that as an alias..

On the way.. Stateful patterns

Patterns can now respond to state, the idea being that you can do things like `note "c a f e" # sound "bass" # speed (scale 1 1.6 \$ control "knob1")` where `knob1` somehow maps to an external controller. Latency might be an issue.. It’s all in bits at the moment though, the new version doesn’t actually make sound yet.. Will update this post as things develop.

Internals

The most exciting thing for me is that the code is a bit cleaner on the inside, with fewer bugs and edge cases, and things generally make more sense. There’s even some tests, a start at creating a more complete definition of what patterns are and how they should behave. Patterns are flagged as being either continuous or discrete, which clears up a lot of ambiguity that was around before.

Keep an eye on the project for updates!

Function of the Month #0 – preamble

Welcome to a new series of “Function of the month” (FotM) blog posts. We hope to build up a comprehensive picture of TidalCycles by periodically making a post with a short video. We plan to be true to the name, and do this every month, with a focus on a particular function. However allow us to deviate from this plan immediately by first taking some time to describe how the different parts of a standard Tidal system works. Take this as a hopefully illuminating preamble for this series.. We’ll get onto specific Tidal functions in FotM #1!

0. Introduction

A video accompanying the below will go here, once we’ve made it. In the meantime please feed back with comments and questions on the below, which we’ll then be able to respond to in the video itself.

A complete TidalCycles system has a few components which we’ll tour around, the TidalCycles language for generating pattern from code, the SuperCollider synthesis system which hosts SuperDirt for turning those patterns into sound, and an editor such as Atom which acts as a text editor for writing those Tidal patterns.  but lets start our tour with the TidalCycles language itself.

1) TidalCycles

TidalCycles is a computer language for generating pattern from code. It consists of an expressive mini-language for describing polyrhythmic sequences, and a wide range of pattern operators and functions for patterning such sequences in a variety of ways. For example, by rotating them, mirroring them, shifting them in time, combining them into weird interference patterns, and ‘glitching’ the sequence with random numbers.

You’ll have noticed that we often call TidalCycles by its shorter name Tidal. That’s actually what it was originally called, until someone started up a music streaming service with the same name, and we felt the need to differentiate..

Tidal is written in a programming language called Haskell. Strictly speaking, when you’re making patterns in Tidal you’re mostly writing Haskell code, but in practice you don’t need to learn Haskell in order to be a top Tidal coder. This is because Tidal is what is called a “Domain Specific Language”, embedded in Haskell, which supplies its own model of computation, operators, function and mini-language for sequences, all centred around pattern generation. That said, are some things about the underlying Haskell language that take a bit of getting used to though, like what that mysterious `\$` is doing, we’ll confront this in a later episode.

It’s important to note that the Tidal language does not make sound by itself, it only makes patterns. It talks to other software or hardware to make sound (using e.g. the OSC or MIDI protocol),  usually SuperDirt running in SuperCollider. However, quite a few people have plugged Tidal into custom software in order to generate patterned visuals, lights or even choreography. For now lets focus on the common case – SuperCollider and SuperDirt.

2. SuperCollider

SuperCollider is the synth behind most desktop live coding systems, and by default, Tidal is no exception. As we said above, Tidal is made for generating patterns, but doesn’t itself make any sound, that’s why you need SuperCollider installed. SuperCollider is a very well developed programming language that is designed for sound synthesis (and digital signal processing in general) that can itself be live coded. By default though, you’ll just use it in order to host SuperDirt.

2a) SuperDirt

SuperDirt is a sound synthesis framework designed especially for TidalCycles, and written in SuperCollider. You don’t need to know anything about SuperCollider in order to run SuperDirt, you just have to start it up, and Tidal will by default send messages to it in order to trigger sounds. SuperDirt comes with a fairly large library of sound samples, as well as a range of synthesisers.

With the latest version it is also possible to register MIDI devices with SuperDirt, so that you can trigger external sounds on soft/hardware synthesisers. This will be the topic of a FotM post later on.

If you run some Tidal code like this:

You’re sending two trigger messages to SuperDirt per cycle, first for the `cp` sound, and then the `supermandolin` sound. In the case of `cp`, SuperDirt will play a short sound sample, which it will find inside a folder called `cp` on your computer. You can find it from SuperCollider – from the menus select ‘open user support directory’, and then open ‘downloaded-quarks’ and then ‘Dirt-Samples’. You’ll see a bunch of ‘.wav’ files inside the `cp` folder, because `cp` isn’t a single sound but a set of them known as a ‘soundbank’. By default SuperDirt will play the first one – to play the second, you can specify `cp:1` in your pattern instead (it starts counting at 0).

You won’t find a folder in Dirt-Samples called `supermandolin`, because that is a synthesiser rather than sample-based soundbank. You can play notes as numbers like this:

or as note names like this:

(If supermandolin isn’t working for you, it’s almost definitely because sc3-plugins isn’t installed properly, which is required by most synths.)

3. Atom

Your main interface to all this is probably Atom, or otherwise one of the other supported text editors. Atom is where you type in and run your Tidal patterns, although strictly speaking, Tidal itself doesn’t run inside Atom but in its own process. You’ll have installed a ‘tidalcycles’ extension inside Atom, but this isn’t tidal itself, but an interface to it. Clear? Hopefully!

Summary

Ok, that was a brief tour of the different components of a standard Tidal system. There’s a text editor Atom, sending code to a Tidal process to run, which in turn sends messages to SuperDirt to make sound, which in turn runs inside SuperCollider. Hopefully that’s straightened out some confusions, but feel free to ask some questions below!

TidalCycles 0.9.8

TidalCycles 0.9.8 newly out! It replaces 0.9.7 which didn’t work well with many haskell versions. Here’s a quick run through the changes since 0.9.6. Any problems or questions, join us on the #tidal channel on talk.lurk.org, or the tidal list on we.lurk.org.

How to update

If you use cabal (rather than stack) to install, it’s just a matter of running `cabal update` then `cabal install tidal` from the commandline. I’m not clear on the best way to update using stack (as tidal hasn’t yet updated on stackage LTS), if you know please leave a comment!

New Bjorklund (aka Euclidean) functions

New function `einv`, which fills the “blanks” left by `e`. For example, `e 3 8 "x"` gives `"x ~ ~ x ~ ~ x ~"`, whereas `einv 3 8 "x"` gives `"~ x x ~ x x ~ x"`.

Another new function `efull` which takes two patterns rather than one, combining `e n k` on the first with `einv n k` on the second. For example, `efull 3 8 "2" "1"` gives `"2 1 1 2 1 1 2 1"`

Yet another function `distrib`, which is similar to `e`, but takes a list of numbers. `distrib [5,8] "x"` is the same as `e 5 8 "x"`, but `distrib [2,5,8]` will  do something rather freaky.. It will take the `(5,8)` pattern as a starting point (which is `"x ~ x x ~ x x ~"`) and then attempt to distribute two events evenly over those five xs as though they were contiguous,  creating `"x ~ ~ x ~ ~ ~ ~"`). Basically, give it a list of numbers which increase in value and you’ll find some interesting off-kilter rhythms.

`d1 \$ distrib [5,7,16] \$ sound "bd:7"`

Sequence parser

Now you can give `*` and `/` subpatterns in the parser. For example `"[a b]*[2 3]"` would be the same as `"[a b] [b a b]"` (i.e. the first half of `"a b a b"`, which is the pattern at twice the speed, and the second half of `"a b a b b a b"`, which is the pattern at three times the speed).

Floating point notes

Now notes are floating point. This means that you can do things like `d1 \$ s "drum*8" # n (sine * 8)`. It also means that for some synthesised sounds you can play between the notes (microtones?), e.g. `d1 \$ sound "supermandolin*8" # n sine`. There have been other adjustments in this area, so previously where you had to do fiddly conversions between integers and floats, you no longer have to.

ghc support

Tidal now supports the latest version of ghc (8.4.1). You should probably be running at least 7.10.3 by now but older versions may still work.

SuperDirt

Exciting SuperDirt update to follow soonish, including new MIDI support.

Enjoy!

TidalBot

TidalBot is back! You can tweet tidal patterns to @tidalbot on twitter, and it will give you back an mp3 of the pattern, as well as a PDF with a visualisation of it.. Here’s a couple of examples:

As a bonus, the latest pattern is currently being projected into the shop window of Access Space Labs on Fitzalan Square in Sheffield.

TidalCycles and Processing

TidalCycles is close friends with SuperDirt but can be configured to send trigger messages to anything that accepts Open Sound Control network messages (or MIDI).

A while back I made a quick example of how to live code Processing sketch from Tidal. You can find an example sketch and tidal file on github. See what can be done with this sort of approach here:

Atsushi Tadokoro is doing similar things in Tokyo, I think with openframeworks.

Yecto has been working on this sort of thing for a while too, check out his spine-tingling sh2hs2 system.

Interview with Malitzin Cortes a.k.a. CNDSD

The second in a series of interviews with TidalCycles people, this one with the awesome Malitzin Cortes, who is based in Mexico City and performs music as CNDSD, including with SuperCollider and Tidal. Follow her on Twitter and Facebook, and be sure to check out her work on soundcloud, tumblr and vimeo. You can also read a pro interview with her en Español in Noisey.

Hi Malitzin, are there particular ‘strategies’ you have developed/collected for
using Tidal? e.g. combinations of functions you like to use together,
particular ways you like to twist patterns etc. Feel free to share
particular examples!

Personally, my knowledge about Tidal has grown, studying the guide on the website and experimenting with these codes, as well with tutorials, testing with my own sounds to the extreme, sometimes simple sounds work best to test and understand how some functions affect the sound.

An extremely seductive quality of the tides is the way of writing, in which I find the logic and emotion of the sequence that I am beginning to compose.
It seems to me extremely poetic, we can write with grammatical sense and algorithmic sense at the same time, some converters like superimposition or palindrome, to mention two, that, combined with iterations can create deep and complex sonorous experiences.

Or to phrase that question another way, what parts of tidal do you
feel drawn to most? Has this changed over time, are their
techniques/functions you explore in depth but then grow bored with?

In the beginning some options lead me to a rhythm more quickly and predictably, but then I found complexity in these same functions through combination with others, leaving the common rhythm behind.

Playing with different sound parameters, the tempo of a sequence of patterns can be extended and become a mass of sound that doesn’t seem to have an identity as a rhythmic pattern, although in the background it is still there!

On the contrary it is difficult for me to get bored, for the moment I don’t think I have reached 5% of the potential of Tidal, I’m always testing functions and combinations and when I do not write well (due to a bad syntax) I learn, and discover that the correct syntax generates new effects and behaviors depending on the number of samples or synthdefs used.

To what extent do you use the standard dirt samples? If you use your
own samples as well do you feel this is important in some way?

I think that as in every library of whatever : images, cats or sounds, there are some more beautiful and interesting that you can not just discard. The default library was the first door to understanding how Tidal worked and what potential it has since you start with the first pattern and by continuing to use it, you discover and understand (especially if you are not a programmer) how a function transforms the sound.

I began to get ideas and the frantic desire to experiment with other sounds.

Personally I keep sounds extremely clean and forceful of this default library and I have dedicated to create one, which is the identity of what I compose and of my music: recorded sounds, voice samples, midi and endless synthdefs.

How do you see the tidal community/communities in relation to the
tidal language?

The community is extremely important in the process of learning and understanding the use of Tidal, as well as in the personal search for a sound identity and to know the work of other people who use it.

Some extremely committed and brilliant people in technical matters (Mike Hodnick) have really supported me in solving doubts and understanding Tidal better, also you learn a lot from the questions of others and from all the deductions that can come out when answering these questions.

Sharing music from different parts of the world makes you understand the sound and music panorama more deeply, how these artists use the same functions to create completely different realities and sound personalities.

How does Tidal compare to other music-making activities/software you have engaged with?

Contrary to what you might think, for me Tidal is extremely friendly and when you go deeper, it becomes more abstract and free than other softwares that I really love and use to compose and generate sounds.

Now Tidal has become a place where I can experiment, improvise live and also compose, the latter perhaps in a not so orderly way, not because it’s not possible, but because it’s so free that you create your own rules.

How approachable do you find the Tidal community/communities, do you think there is a language/cultural barrier and/or do you think there are separate communities growing around Spanish language and/or locality in Mexico/America?

If your knowledge of programming and English is poor, at first it can be very confusing, this is my case, but the same programming has made me want to acquire a higher level of English in order to understand Tidal better.

I think that with the existence of translate tools the barriers are becoming smaller when there is an intrinsic interest, I would like in the near future to be able to translate and give workshops in which Tidal can be understood in Spanish very clearly if the level of English of the people concerned actually represents a barrier to delve into it.

There are people in Mexico and Colombia developing their own live coding languages and in general are very willing to share their knowledge and experience, in SuperCollider mostly.

How does Tidal influence your work, when you are using it do you feel like you are composing, improvising, exploring?

I think all three, in my process the experimentation begins in the pursuit of understanding, also trying to find how I want to sound.

After mixing sounds and beginning to compose patterns improvisation is extremely easy and natural in Tidal, when you begin to listen and you propose to direct the sounds and rhythmic complexities or textures is where the composition process begins.

What do you think Tidal is?

For me it is the music of the future, not only in Tidal, it’s algorithmic music itself, but without doubt Tidal has achieved many things in terms of simplification thanks to functional programming, allowing it to go far when it comes to live coding and improvisation in a few lines.

I would like Tidal have more things, but I know that it is the beginning of something tremendous, that allows us to take sound to places uncommon and to transgress the motricity in the music. It’s that search of sounds that seem impossible and are only possible in the computer, Tidal allows you to find an unimaginable panorama of combinations.

I think I have explored little and I always want to know more and especially ask myself questions about whether it is possible that what’s in my mind musically can translate into a reality .

and always surprises me and leads me to take all sorts of decisions.

Thanks Malitzin!

TidalCycles Winter Solstice, Sheffield UK

We’re having a Winter Solstice party in Sheffield on 21st December at Access Space, tickets now up! Featuring some of the leading lights from the local tidalcycles community Heavy Lifting, Tich, Digital Selves, Class-Compliant Audio Interfaces, Co(n)de Zero and Nullish. It will get algorave-y at some point.. There’s a facebook event for those who are that way inclined..

Interview with Mike Hodnick a.k.a. Kindohm

The first in a series of interviews with TidalCycles people.

As I remember you started out with the 365 tidal patterns project, the first major foray into Tidal aside from myself. It must have been quite an ordeal getting tidal installed as an early adopter, can you remember what drew you in and made you put the work in?

The soul of Tidal is rhythm and patterns, and as a percussionist/drummer  (and programmer) this really resonated with me. In fact, this might be the  most important reason why I was so intrigued with Tidal. In Tidal, I saw ways  to create very complex rhythms that could evolve and change over time; I  would make a pattern with small amounts of code that would take minutes to cycle until repeating. As a music producer who liked to create complex drum rhythms, Tidal looked like endless fun!

But I think the reason I really got drawn in was because I realized I could use this type of music-making for more than just at-home fun. I really wanted  to get good enough at Tidal so that I could get out and perform with it.

I remember the date I installed it: December 5th 2013: https://github.com/tidalcycles/Tidal/issues/6

The installation process wasn’t too bad, but I knew it would be worth the wait and effort whatever time it took. I think I spent a couple of afternoons trying to get it to work. I had some prior Linux experience, and compiling classic Dirt wasn’t too bad. Linux audio and Jack were new to me though; I think that’s where most of my initial struggles came from. I also hadn’t used Emacs before, and Emacs was the best-supported editor at that time. It took some time to get the Emacs configuration correct. It definitely required a lot of trial and error with Jack and the Emacs config.

What ‘strategies’ have you developed/collected for using Tidal? e.g. combinations of functions you like to use together, particular ways you like to twist patterns etc. Feel free to share particular examples! How important are these strategies to you? I think you’ve defined a few of your own functions. Could you share some details? How has this gone as an otherwise non-Haskell programmer?

There are so many…

First, there’s the `stack`.

When I was working on 365 Tidal Patterns, I imposed a constraint that I had to put the pattern on a single line. Then I relaxed that constraint to only using one Dirt connection (e.g. `d1`). This is where I discovered I could use `stack` to create layers of patterns on one Dirt connection. From the start I think I’ve always been a fan of using a big `stack` to create layers of stuff:

The great benefit of the stack is you have two levels of transformation: one at the pattern level and one at the stack level. The pattern above has transformations at the pattern level (e.g. `(0.5 <~)`). Here is a pattern with transformations at the stack level:

Next, there’s moving time around. Early on when learning Tidal I started to do this a lot:

I then attempted to author my first Haskell function in Tidal to make this a first-class capability in Tidal. We called it `foldEvery`. My implementation didn’t work, and I think Ben Gold actually implemented the final version. It’s used like this:

Another really common thing I like to do is use different audio effects and transformations on different cycles to create constant variation in patterns:

I think that pattern will cycle 420 times before repeating. 420!!! With such little code you can get so much continuous variation. This never ceases to excite!

Another feature of Tidal that I exploit a lot is the polymeter syntax:

The above `d1` pattern will play “in five” while the `d2` plays in a regular division of eight (or four, depending on how you feel it). I love this type of rhythmic interplay: two patterns with the same pulse but different lengths. My favorite band when I was young was Helmet, and they did this type of thing all the time (drums in “four” while the guitars were in five, six, or some other division of time).

Another technique is to define a common rhythm for multiple patterns to use:

And as an added bonus, put that code in a `do` block so that you can change the rhythm and have all patterns take on the new rhythm at the same time:

As far as my own custom functions, I have defined many. Perhaps my favorite is one I call `rip`:

Which creates a sort of quick, backwards, rush effect.

I also use a custom function called `brakk` to time-stretch and create random drum breaks from pre-sliced break loops:

As a non-Haskell programmer, creating these types of shortcut functions is pretty easy because they just re-use existing common Tidal functions. It’s just like writing regular Tidal code, except you have to know how to give a function a name and express what parameters it will take. In contrast, I am not very good at lower-level Tidal functions or common Haskell language features to create new capabilities within Tidal.

Or to phrase that question another way, what parts of tidal do you feel drawn to most? Has this changed over time, are there techniques/functions/aspects you explore in depth but then grow bored with?

I haven’t really gotten bored with anything yet. It does take time and persistence, but eventually I kind of stumble across new ideas that result in something surprising. Then I try to find ways to exploit those ideas and run with them for a while. For example, I’ve kind of been exploring footwork’ish patterns by using `stut'` in weird ways. It’s a foundational idea that I can put all other strategies on top of. Hopefully other foundational ideas will keep emerging in the future and the strategies will stay fresh with them!

I’ve noticed you put your compositions on github. Is this just out of convenience or something you’ve made a explicit decision to do?

It’s both. I’m slightly paranoid about losing data and code, so GitHub is kind of a backup strategy. However, I’ve always liked sharing my code with others, so GitHub has this nice side effect of making everything available to the public.

I’ve always believed in giving away all of my secrets, whether it’s related to my career or in music. In my entire career I can only think of once when my work was plagiarized. I also just don’t think I have anything to gain by keeping everything to myself. I would love to make more friends in the Tidal world and use it together with more people; sharing my work will only help that.

How does Tidal influence your work, when you are using it do you feel like you are composing, improvising, exploring? Do you feel there’s some expectation for how tidal is used, that you’re going with or against?

When I use Tidal I feel like it is a varying balance of composing, improvising, and exploring. In the studio, it starts with exploring, some grain of an idea, and asking a lot of “what if?” questions. While exploring, I’m looking for something weird or odd that surprises me, or maybe I’m looking to apply a snippet I learned about on the Tidal slack channel. I think during exploration I’m trying to use code I haven’t tried before.

If the result is sonically interesting, then it might become a compositional foundation. I change my approach from code I’m not familiar with to code that can build around the foundational idea.

Improvisation is constant, really. I think one of the powers of Tidal is being able to make a change so quickly and hearing the result. Those “what if” questions can get answered immediately.

I don’t feel like there’s an expectation for how Tidal should be used. I don’t feel constrained in that way. I do feel that there are constraints due to Tidal’s architecture (e.g. a constantly running cycle, discrete events vs continuous events) but not because of an expectation. To me, “expectation” implies that there is a wrong way to use Tidal, and I’ve never felt that at all.

To what extent do you use the standard dirt samples? Do you feel it is important to use your own samples?

I don’t use many of the standard Dirt samples, but not because I don’t like them. I just have a creative desire to design sounds. Often times my sound design process is coupled with the exploratory process of live coding with Tidal. I try to couple an inspiring sound with a bit of new inspiring code.

Many Tidal artists use the standard Dirt samples and the result is an amazing transformation. I think there are nearly infinite creative possibilities in the standard samples.

How does Tidal compare to drumming/other music-making activities/software you have engaged with?

I’ve played drums and percussion since I was 12, and I think Tidal resonates with me because of this. Tidal is such a rhythmic tool and I love it.

I guess I think of Tidal as more of a composition and orchestration tool, whereas drums and percussion are more of a performance instrument. Of course I perform with Tidal, but I am more of a conductor; I orchestrate changes and direct what the parts of the composition are doing. As a percussionist, my concerns are more directed at the performance of a single instrument.

I’ve always liked working with drums in electronic music and creating drum parts that are humanly impossible to play, or that are rhythmically too difficult to “feel”. With traditional music-making software (e.g. DAWs like FL Studio) I would need to place every little note perfectly and it was a tedious process, especially if I wanted to achieve little repetition in the drum patterns. Tidal helps automate this approach and it is very satisfying as a result. I can tell Tidal how to process drums with a few lines of code and it achieves the same thing much more quickly.

How do you see the tidal community/communities in relation to the tidal language? How do you feel about tidal club, has it met your original aim for it, have new aims emerged?

I think the Tidal community and language are tightly coupled. The community has been a huge influence on language features and improvements. We’ve attempted to document Tidal as best we can on the web site, but because live coding is a creative process I think it has been very difficult to convey some concepts through documentation. In-person meetups and online communication are a critical part of spreading knowledge, sharing ideas, suggesting changes, and getting feedback.

And finally a direct but vague question – what do you think Tidal is?

At a very technical level, I think Tidal is a way to express patterns in code. Those patterns can be expressed as data in a file (e.g. an image), messages on a network (e.g. OSC messages to SuperCollider), or whatever else a programmer wants to do with those patterns.

At a more personal level, I think Tidal is the creative tool I’d been trying to find for about half of my life. I wasn’t even sure that I was looking for one. It sparked a creative part of me that I wasn’t sure existed before.

Thanks for sharing!