Best way to get code to the running instance of Tidal?

Oops - put this under the wrong topic initially!

I've been going over the tidal plugin for vim, and I think it's a bit crufty, could use some cleaning up, and can likely be written to take advantage of some of the features of neovim (essentially modeling it after scnvim). Will be working on that on my side for a bit before I share it with the community.

It looks like the current version simply takes the code that you've evaluated, pastes it into the running GHCI repl, and then the repl evaluates it. Is this a correct understanding ? If so, is this the best way to get code to a running tidal process ? If not, what is the best way of sending code to the tidal process ? (I can imagine for larger blocks of code sending over text could get messy, hence the question.)

Hope this wasn't a dumb question - I've been having a lot of fun with Tidal so far, and I'd like to contribute how I can.

thanks,
John

2 Likes

I believe you have a correct understanding of the vim-tidal plugin. It is basically a wrapper around tmux that sends text from one tmux pane to another.

I have become a huge fan of this approach as it makes it easy to add support to any command line editor. It also makes it trivial to do cool hacks like controlling tidal from shell scripts or sending from your local editor to a remote GHCi instance on another computer.

Looking forward to see what you come up with.

2 Likes

Great - thanks. I think what I'm planning on doing is probably going to not allow for some of the tricks you're using and will probably be somewhat opinionated, but I'm planning on leaving the configuration open enough so that you'll be able to provide your own boot script, do your own mappings, etc.

I'm basically aiming towards an environment contained within a single vim instance that doesn't require too too many outside dependencies.

Yes this is how most of the editor plugins work.

I did make a websocket api once, with a browser-based editor to use it:

It almost definitely doesn't work with recent tidal versions, but wouldn't take loads of effort to fix.

It would be interesting to explore again as it could potentially allow for interesting experiments like the highlighting and VU meters seen in my feedforward editor (which doesn't use/need this kind of API as it's written in Haskell).

Thanks for the input! I didn't need a websocket interface, thankfully, and was able to get this happening with just a vim buffer and some creative pasting. I've still got some wonkiness with the way vim renders text and I've put some shims in there, but I'm fairly certain that's due to my lack of knowledge of neovim scripting and not anything with Tidal/Haskell.

Here's a screenshot for proof!

This means you don't have to run Tidal in a separate window, and all the communication / etc is happening within one instance of vim. The window is hideable, can be put anywhere/etc. I'll share it with the community once I've worked out some of the bugs, but it's functioning properly now and I'm pretty stoked about that.

2 Likes

interesting! how would you go about interacting with tidal via shell/ghci? can you recommend any resources on this? :slight_smile: (my plan is to generate some tidal code inside of supercollider and evaluate it)

Ah, so this doesn't function as a terminal, so you can't type in it, but it's a buffer that you send text to, and that essentially functions as the terminal.

If you're generating tidal code inside of supercollider, in this case you'd have to somehow get the string externally before pastiing it into GHCI - it seems like there should be a better way of doing this - potentially by having some sort of listening port within tidal that can take in patterns as strings.

Coming back to this thread !
I have my Tidal plugin working, and I've just gotten some glue together in supercollider to do stepwise midi recording (e.g. like Finale/scoring program) and display it in music notation. i.e.:

I'm going to write some code to turn those rhythms and note values into TidalCycle notation. As mentioned in my previous post, I'd ideally like to be able to send that notation from Supercollider to Tidal/GHC over a socket so that I don't have to copy/paste/evaluate.

The tidal websocket code you shared looks promising as a jump-off point, but Haskell is a bit of gibberish to me for now. Do you have any suggestions for where I should start to learn Haskell with an eye towards understanding Tidal and extending its functionality ?

Thanks! sorry for the broad question.

5 Likes