# Autonomous Tidal Code Generation

**URL:** <https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064>\
**Category:** TidalCycles\
**Tags:** innards\
**Created:** [20 May 2020 11:12 UTC](https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064 "2020-05-20T11:12:51Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![lwlsn](https://uzu.lurk.org/user_avatar/uzu.lurk.org/lwlsn/32/1306_2.png) [@lwlsn](https://uzu.lurk.org/u/lwlsn)\
**Post date:** [20 May 2020 11:12 UTC](https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064/1 "2020-05-20T11:12:52Z")

</div>

Hi all !

Going to be working on a project over the coming months on autonomous Tidal code generation and thought I’d start up a discussion in case anyone’s been working on anything similar recently.

Some other exciting works that I’ve been pointed towards recently are:

1. Simon Hickinbothom and Susan Stepney from University of York created an evolutionary algorithm for the extramuros platform.

[http://eprints.whiterose.ac.uk/113747/1/evomusart16.pdf](http://eprints.whiterose.ac.uk/113747/1/evomusart16.pdf)

As part of this, they’ve written a grammar for tidal patterns, which seems to work quite well: [https://github.com/franticspider/antlr4tidal](https://github.com/franticspider/antlr4tidal)

1. Jeremy Stewart, Shawn Lawson, Mike Hodnick and Ben Gold have been working on “Cibo” a neural network autonomous code generator..

[https://iclc.toplap.org/2019/papers/paper101.pdf](https://iclc.toplap.org/2019/papers/paper101.pdf)

Also another paper recently came out of the most recent ICLC proceedings.

They’ve also released downloadable packages for writing code to json to train their networks, available on atom and sublime text (package is jensaarai 0.2.1)

If anyone else has been working on something similar, feel free to share here!

Will hopefully be able to share some of the outcomes of the project here over the next few weeks.

---

<div class="post-metadata">

**Author:** ![lwlsn](https://uzu.lurk.org/user_avatar/uzu.lurk.org/lwlsn/32/1306_2.png) [@lwlsn](https://uzu.lurk.org/u/lwlsn)\
**Post date:** [20 May 2020 11:13 UTC](https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064/2 "2020-05-20T11:13:19Z")

</div>

Also if anyone is interested, here’s a draft of a context-free grammar for Tidal generation that I started writing as a side project recently.

[https://gist.github.com/lwlsn/c57a2a1c2d77430d1e02b305d18b66c6](https://gist.github.com/lwlsn/c57a2a1c2d77430d1e02b305d18b66c6)

Hopefully can share some code for this soon, when it’s a bit more functional..

---

<div class="post-metadata">

**Author:** ![dktr0](https://uzu.lurk.org/letter_avatar_proxy/v4/letter/d/858c86/32.png) [@dktr0](https://uzu.lurk.org/u/dktr0)\
**Post date:** [20 May 2020 15:41 UTC](https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064/3 "2020-05-20T15:41:07Z")

</div>

This version of the Daem0n piece had crude Tidal generation (modulated by equally crude machine listening and a mapping layer pasted together with string and glue...): [https://www.youtube.com/watch?v=EcRtmWUdnx4](https://www.youtube.com/watch?v=EcRtmWUdnx4)

---

<div class="post-metadata">

**Author:** ![dktr0](https://uzu.lurk.org/letter_avatar_proxy/v4/letter/d/858c86/32.png) [@dktr0](https://uzu.lurk.org/u/dktr0)\
**Post date:** [20 May 2020 15:42 UTC](https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064/4 "2020-05-20T15:42:58Z")

</div>

Also the tidal-parse module (aka MiniTidal in Estuary) has a detailed Tidal grammar (expressed in the form of combinatorial parsers).

---

<div class="post-metadata">

**Author:** ![jarm](https://uzu.lurk.org/user_avatar/uzu.lurk.org/jarm/32/2756_2.png) [@jarm](https://uzu.lurk.org/u/jarm)\
**Post date:** [20 May 2020 19:26 UTC](https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064/5 "2020-05-20T19:26:10Z")

</div>

Very exciting @lwlsn!

Probably worth mentioning Charlie and co's Tidal PEG: [https://github.com/gibber-cc/tidal.pegjs](https://github.com/gibber-cc/tidal.pegjs)

---

<div class="post-metadata">

**Author:** ![renick](https://uzu.lurk.org/user_avatar/uzu.lurk.org/renick/32/626_2.png) [@renick](https://uzu.lurk.org/u/renick)\
**Post date:** [21 May 2020 03:49 UTC](https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064/6 "2020-05-21T03:49:02Z")

</div>

check the work done by [https://twitter.com/kakuya\_sris](https://twitter.com/kakuya_sris)

he has had a system doing this for tidal for a few years now.

---

<div class="post-metadata">

**Author:** ![lwlsn](https://uzu.lurk.org/user_avatar/uzu.lurk.org/lwlsn/32/1306_2.png) [@lwlsn](https://uzu.lurk.org/u/lwlsn)\
**Post date:** [21 May 2020 09:46 UTC](https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064/7 "2020-05-21T09:46:39Z")

</div>

Oh this is v cool, thanks!

---

<div class="post-metadata">

**Author:** ![lwlsn](https://uzu.lurk.org/user_avatar/uzu.lurk.org/lwlsn/32/1306_2.png) [@lwlsn](https://uzu.lurk.org/u/lwlsn)\
**Post date:** [21 May 2020 09:47 UTC](https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064/8 "2020-05-21T09:47:12Z")

</div>

will check it out, thanks renick!

---

<div class="post-metadata">

**Author:** ![cleary](https://uzu.lurk.org/user_avatar/uzu.lurk.org/cleary/32/177_2.png) [@cleary](https://uzu.lurk.org/u/cleary)\
**Post date:** [22 May 2020 00:21 UTC](https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064/9 "2020-05-22T00:21:38Z")

</div>

Maybe not tidal per se, but maybe of interest still

William Fields and Tom Hall live stream and breakdown tomorrow

[https://club.tidalcycles.org/t/live-stream-announcements/317/12?u=cleary](https://club.tidalcycles.org/t/live-stream-announcements/317/12)

---

<div class="post-metadata">

**Author:** ![tscholak](https://uzu.lurk.org/user_avatar/uzu.lurk.org/tscholak/32/517_2.png) [@tscholak](https://uzu.lurk.org/u/tscholak)\
**Post date:** [23 May 2020 14:38 UTC](https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064/10 "2020-05-23T14:38:34Z")

</div>

Hi, if you are looking for ways to generate expressions in a formal grammar using a neural network, I can recommend looking into the transition system introduced by the TranX semantic parsing framework, [https://github.com/pcyin/tranX](https://github.com/pcyin/tranX). I am using this approach currently to predict SQL from natural language questions.

In TranX, grammars are declared using ASDL. term expressions are converted to sequences of grammar production actions that build the recursive term structure from root to leaves and from left to right. This conversion is necessary so that generic sequential decoding models can be used. in the original TranX approach, a recurrent LSTM stack is used, but in principle this method can also be used with transformer decoders or language models.

---

<div class="post-metadata">

**Author:** ![lwlsn](https://uzu.lurk.org/user_avatar/uzu.lurk.org/lwlsn/32/1306_2.png) [@lwlsn](https://uzu.lurk.org/u/lwlsn)\
**Post date:** [25 May 2020 16:52 UTC](https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064/11 "2020-05-25T16:52:29Z")

</div>

super interesting, thanks 🙂

---

<div class="post-metadata">

**Author:** ![kindohm](https://uzu.lurk.org/user_avatar/uzu.lurk.org/kindohm/32/395_2.png) [@kindohm](https://uzu.lurk.org/u/kindohm)\
**Post date:** [23 July 2020 20:34 UTC](https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064/12 "2020-07-23T20:34:54Z")

</div>

A while back I created an Atom package that generates (and plays) Tidal code from Tracery grammars. This package hasn't been maintained in some time and I believe some users are having trouble getting it to run, but perhaps the implementation is valuable:

> **[GitHub - kindohm/tidal-autocode: Auto-generates sound patterns for the...](https://github.com/kindohm/tidal-autocode)**
>
> Auto-generates sound patterns for the TidalCycles livecoding environment. - GitHub - kindohm/tidal-autocode: Auto-generates sound patterns for the TidalCycles livecoding environment.

And here is a video recording of it in action:

[![](https://img.youtube.com/vi/o4Uz14RagmA/maxresdefault.jpg "TidalCycles Auto-Raver Extended Test") ](https://www.youtube.com/watch?v=o4Uz14RagmA)

I don't really have plans to enhance it. License is MIT, so feel free to fork/use/enhance!

---

<div class="post-metadata">

**Author:** ![lwlsn](https://uzu.lurk.org/user_avatar/uzu.lurk.org/lwlsn/32/1306_2.png) [@lwlsn](https://uzu.lurk.org/u/lwlsn)\
**Post date:** [23 July 2020 20:37 UTC](https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064/13 "2020-07-23T20:37:59Z")

</div>

Paper on reinforcement learning with Python module and Supercollider quark from the Tidal Club discussion: "RaveForce: A Deep Reinforcement Learning Environment for Music"

[https://www.duo.uio.no/handle/10852/73776](https://www.duo.uio.no/handle/10852/73776)

---

<div class="post-metadata">

**Author:** ![artheist](https://uzu.lurk.org/user_avatar/uzu.lurk.org/artheist/32/594_2.png) [@artheist](https://uzu.lurk.org/u/artheist)\
**Post date:** [24 July 2020 02:01 UTC](https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064/14 "2020-07-24T02:01:56Z")

</div>

Definitely worth trying, works as a SC class, still a proof of concept, but a lot of room for improvement.

---

<div class="post-metadata">

**Author:** ![John\_Murphy](https://uzu.lurk.org/user_avatar/uzu.lurk.org/john_murphy/32/579_2.png) [@John\_Murphy](https://uzu.lurk.org/u/John_Murphy)\
**Post date:** [10 August 2020 17:20 UTC](https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064/15 "2020-08-10T17:20:16Z")

</div>

The RaveForce code seems super interesting. Definitely worth trying out - I think it'll likely get you some interesting timbres and synthdefs as it works its way through the gradient.

As an adjacent topic that I brought up on another thread - has anyone had any luck with getting haskell code sent to Tidal outside of passing it to GHCI via a text buffer (e.g. through an osc message as text) ? From my investigation, it seems like this is going to require some work in Haskell, but the "hint" library ([https://hackage.haskell.org/package/hint](https://hackage.haskell.org/package/hint)) may be the right jumping off point ?

---

<div class="post-metadata">

**Author:** ![lwlsn](https://uzu.lurk.org/user_avatar/uzu.lurk.org/lwlsn/32/1306_2.png) [@lwlsn](https://uzu.lurk.org/u/lwlsn)\
**Post date:** [12 February 2021 17:38 UTC](https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064/16 "2021-02-12T17:38:02Z")

</div>

Had a go at running tidal through GPT-2 today and got some cool new patterns to try

 ![GPT-2 Tidal](https://club.tidalcycles.org/uploads/default/original/2X/7/7c5e2990da9020cca6242dff3d3bc8f104fafcae.jpeg)

---

<div class="post-metadata">

**Author:** ![Hong\_Xu](https://uzu.lurk.org/user_avatar/uzu.lurk.org/hong_xu/32/1896_2.png) [@Hong\_Xu](https://uzu.lurk.org/u/Hong_Xu)\
**Post date:** [25 July 2021 04:38 UTC](https://uzu.lurk.org/t/autonomous-tidal-code-generation/1064/17 "2021-07-25T04:38:48Z")

</div>

very cool! how did you use the pretrained model? do you have code to share for your fine tuning process?
