# Get Tidal code from Atom plugin

**URL:** https://uzu.lurk.org/t/get-tidal-code-from-atom-plugin/2626
**Category:** TidalCycles
**Tags:** innards
**Created:** [19 December 2020 21:27 UTC](https://uzu.lurk.org/t/get-tidal-code-from-atom-plugin/2626 "2020-12-19T21:27:29Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![antonelse](https://uzu.lurk.org/user_avatar/uzu.lurk.org/antonelse/32/424_2.png) [@antonelse](https://uzu.lurk.org/u/antonelse)
#### Post date: [19 December 2020 21:27 UTC](https://uzu.lurk.org/t/get-tidal-code-from-atom-plugin/2626/1 "2020-12-19T21:27:29Z")

</div>

Hi everyone,  
I'm involved in a project that uses the Processing language for the video part.  
My task is to provide the executed Tidal code to the Processing app in such a way as to be shown over the visual.

Basically, _I have to send the code to Processing_ in some way but I don't know how.  
Maybe through an OSC message that embeds the entire code? Or, using a specific "get" function in Haskell?

I have no idea, and _any words of advise would be good_.  
I apologize for the trivial question, I’m a novice with Haskell 😀

---

<div class="post-metadata">

### Author: ![a1g0rhythm](https://uzu.lurk.org/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@a1g0rhythm](https://uzu.lurk.org/u/a1g0rhythm)
#### Post date: [20 December 2020 04:44 UTC](https://uzu.lurk.org/t/get-tidal-code-from-atom-plugin/2626/2 "2020-12-20T04:44:20Z")

</div>

I would start at tidal-vis, it dynamically renders a color pattern for the OSC messages and can generates svg or pdf files. I used it to make a svg but haven't looked inside. It should have clues to catching osc messages and sending them to processing.

> **[tidalcycles/tidal-vis](https://github.com/tidalcycles/tidal-vis)**
>
> Tidal is a domain specific language for live coding pattern. This package allows colour patterns to be rendered as PDF or SVG files.

---

<div class="post-metadata">

### Author: ![ndr\_brt](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ndr_brt/32/396_2.png) [@ndr\_brt](https://uzu.lurk.org/u/ndr_brt)
#### Post date: [20 December 2020 08:28 UTC](https://uzu.lurk.org/t/get-tidal-code-from-atom-plugin/2626/3 "2020-12-20T08:28:11Z")

</div>

If you need to send all the code (evaluated?), that could be done modifying the atom plugin:  
The normal behavior is that the code is sent to a ghci instance, but it could also be sent through osc...  
Maybe we can implement it as a feature of the plugin, feel free to open a issue and a pr on the repository

> **[tidalcycles/atom-tidalcycles](https://github.com/tidalcycles/atom-tidalcycles)**
>
> Atom package for TidalCycles. Contribute to tidalcycles/atom-tidalcycles development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![antonelse](https://uzu.lurk.org/user_avatar/uzu.lurk.org/antonelse/32/424_2.png) [@antonelse](https://uzu.lurk.org/u/antonelse)
#### Post date: [20 December 2020 09:23 UTC](https://uzu.lurk.org/t/get-tidal-code-from-atom-plugin/2626/4 "2020-12-20T09:23:30Z")

</div>

Thanks a lot 🙂 I will try this now!  
One question: from the OSC  
` -- Send pattern as osc both to SC and to tidal-vis`  
` tidal <- startMulti [musicTarget, patternTarget] config`  
I can retrieve the SuperCollider code right (not the Tidal one), and set it to Processing through the `patternTarget` OSC message, right?

---

<div class="post-metadata">

### Author: ![antonelse](https://uzu.lurk.org/user_avatar/uzu.lurk.org/antonelse/32/424_2.png) [@antonelse](https://uzu.lurk.org/u/antonelse)
#### Post date: [20 December 2020 09:27 UTC](https://uzu.lurk.org/t/get-tidal-code-from-atom-plugin/2626/5 "2020-12-20T09:27:52Z")

</div>

Thanks man 😉 I will try this solution but it will take time for me, since I’m not very experienced in the field 🙃 but, if you have information about the new version let us know anyway.

---

<div class="post-metadata">

### Author: ![gamar3is](https://uzu.lurk.org/user_avatar/uzu.lurk.org/gamar3is/32/3020_2.png) [@gamar3is](https://uzu.lurk.org/u/gamar3is)
#### Post date: [23 December 2020 16:26 UTC](https://uzu.lurk.org/t/get-tidal-code-from-atom-plugin/2626/6 "2020-12-23T16:26:33Z")

</div>

Hi, I have a related desire so I'm hijacking the thread a bit.

In my case I'd like to capture the output of `drawLine`; my purpose is to be able to visualise euclidean patterns, so I can compose more complex structures while getting a clear view of the outcome. I know there's cleaner ways to go about it -- my first shot was to try tidal-vis but I can't install it.

In the end I'd like to set up a minimal web app with a simple UI to put in mininotation and show the output of `drawLine`. But I have no idea how to 1. send a command to tidal from another process and 2. capture the Tidal output.

[let me know if this is unrelated to the thread, we can probably break this out into a separate discussion]

---

<div class="post-metadata">

### Author: ![antonelse](https://uzu.lurk.org/user_avatar/uzu.lurk.org/antonelse/32/424_2.png) [@antonelse](https://uzu.lurk.org/u/antonelse)
#### Post date: [23 December 2020 21:01 UTC](https://uzu.lurk.org/t/get-tidal-code-from-atom-plugin/2626/7 "2020-12-23T21:01:07Z")

</div>

> [@gamar3is](#):
>
> 1. send a command to tidal from another process

Hi @gamar3is 😉 Yaaa it'll be beautiful!  
So, for now, I was able to send the Tidal code from the atom plugin to Processing adding just a few lines in the `repl.js` file of the Atom plugin. The plugin uses the `osc.js` library, so I opted for using that.  
But up to now, it is not well-scripted (are not very experienced in programming 😉 ).

I these days I found also [this](https://github.com/yaxu/p5dirt). Maybe it can help you.  
Let me know 😉

---

<div class="post-metadata">

### Author: ![ndr\_brt](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ndr_brt/32/396_2.png) [@ndr\_brt](https://uzu.lurk.org/u/ndr_brt)
#### Post date: [24 December 2020 07:46 UTC](https://uzu.lurk.org/t/get-tidal-code-from-atom-plugin/2626/8 "2020-12-24T07:46:40Z")

</div>

That can be unreleated to the thread, could be cool to integrate some visualizations based on the `drawLine` function

> [@gamar3is](#):
>
> 1. send a command to tidal from another process

In the atom plugin there's a process that launches a `ghci` instance and loads the `BootTidal.hs` file, so tidal is loaded over there. To eval tidal expression the code is sent to that process as it if were a REPL (ghci IS a repl after all 🙂 )  
So, if you use tidal from the atom plugin the only way to send commands to that tidal instance is to do that inside the atom plugin.  
I know that there's a _work in progress_ project called [tidal-listener](https://github.com/tidalcycles/tidal-listener) that will permit to communicate with tidal via OSC, but it's still not complete enough I think

> [@gamar3is](#):
>
> 1. capture the Tidal output.

As before, in the plugin the output of that process is the tidal output, it can be catched and shown into the plugin.

Thinking about it in a "new atom plugin feature" it could be that, every code evaluation, the plugin could try to evaluate all the patterns in the block with drawLine and shown them in the console. Don't know how this thing could work, but it maybe worth a try.

---

<div class="post-metadata">

### Author: ![a1g0rhythm](https://uzu.lurk.org/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@a1g0rhythm](https://uzu.lurk.org/u/a1g0rhythm)
#### Post date: [1 January 2021 00:14 UTC](https://uzu.lurk.org/t/get-tidal-code-from-atom-plugin/2626/9 "2021-01-01T00:14:24Z")

</div>

Another example of using ocs from TidalCycles to Processing for inspiration.  
Atsushi Tadokoro has published his Tidalcycles to Processing code on his github

video of Processing output and Tidalcycles input.

> **[tado/tidalp5](https://github.com/tado/tidalp5)**
>
> TidalCycles visualization examples with Processing.

  
Atsushi Tadokoro's github for tidal processing interface, and generous Tidal code  

> **[tado/TidalProjects](https://github.com/tado/TidalProjects)**
>
> Contribute to tado/TidalProjects development by creating an account on GitHub.
