[Csnd] VIM, Csound6, REPL
Date | 2013-04-20 16:47 |
From | Steven Yi |
Subject | [Csnd] VIM, Csound6, REPL |
Hi All, I've been doing a little side research into how to go about putting together a REPL for VIM for Csound 6. The goal would be to do the same kinds of things I was doing in the CS6 Live Coding videos, but from within VIM. My thoughts are to: 1) Create a github project and start with Luis Jure's csound vim tools [1] as a basis. 2) Reorganize the scripts so that they can work with pathogen [2] for easy installation 3) Use pyrepl.vim [3] as a basis for the REPL. This project uses python from within the .vim plugin to do the network handling and REPL evaluation. I think using the python wrapper for csound6 would be a fast way to get a working REPL. We could look at creating a C-coded csrepl executable to package with csound6 as a parallel project that could also be used by emacs or any editor that uses sockets to communicate to REPLS. Some other thoughts: * We don't necessarily have to limit this to Csound 6. We could do some work to make it work with both Csound5 and Csound6, though an :evalOrc kind of function would only work with CS6. (With csound 6, the library package name has changed to csnd6, so we can test to see if either/both csnd and csnd6 are installed). * We could also develop a csrepl.py script to connect to from the start. That could be a separate project that could then be tested from both emacs and vim. I looked at Stephane's csound-x [4] briefly just now and saw there was some kind of support for repl behavior going through clojure (and from there the Java API to Csound). I didn't read things but briefly, so maybe Stephane might comment on REPL support in csound-x. Now, these projects could be done as separate projects from csound, or also done within the main repo. At this point, I'm leaning towards a separate project, at least while things are developing. Also, I'm not sure how much time I'd have to work through this alone, so am looking for collaborators to work with. Thanks! steven [1] - http://www.eumus.edu.uy/docentes/jure/csound/vim/index.html [2] - https://github.com/tpope/vim-pathogen [3] - https://github.com/Bogdanp/pyrepl.vim [4] - http://www.zogotounga.net/comp/csoundx.html |
Date | 2013-04-20 17:26 |
From | luis jure |
Subject | Re: [Csnd] VIM, Csound6, REPL |
on 2013-04-20 at 16:47 Steven Yi wrote: > I've been doing a little side research into how to go about putting > together a REPL for VIM for Csound 6. The goal would be to do the > same kinds of things I was doing in the CS6 Live Coding videos, but > from within VIM. this would be great! > 1) Create a github project and start with Luis Jure's csound vim tools > [1] as a basis. i haven't worked on that project for years, i guess it needs a major overhaul... this could be an incentive to take look at those files again. > Also, I'm not sure how much time I'd have to work through this alone, so > am looking for collaborators to work with. i'm afraid that, with my limited skills, i can't contribute much to this project, but at least i could try to update and improve the old vim files. i hope you'll get more and more capable partners. best, lj |
Date | 2013-04-20 17:38 |
From | Steven Yi |
Subject | Re: [Csnd] VIM, Csound6, REPL |
Hi Luis, Thanks! I've used VIM for years, but until recently I never really used it beyond some basic editing. I've been spending time to learn more of VIM lately and I've been enjoying it a lot. Your vim files have always been valuable to me when I did quick CSD writing on the terminal. I think if this project gets anywhere, it will be because it has your work as a basis, so you've done a lot already. :) I just created a csound-vim project at github (https://github.com/kunstmusik/csound-vim) and will look at importing your files now. I guess if others join in, that'd be fantastic, and if not, I'll work on it off and on as time allows. Thanks again! steven On Sat, Apr 20, 2013 at 5:26 PM, luis jure |
Date | 2013-04-20 17:38 |
From | Jacob Joaquin |
Subject | Re: [Csnd] VIM, Csound6, REPL |
As a vim user, I'm all for this. Also might be worth looking into IPython and vim-ipython. On Sat, Apr 20, 2013 at 8:47 AM, Steven Yi <stevenyi@gmail.com> wrote: Hi All, codehop.com | #code #art #music |
Date | 2013-04-20 17:59 |
From | Steven Yi |
Subject | Re: [Csnd] VIM, Csound6, REPL |
Hi Jake, Thanks for the links! I'm trying to update Luis's scripts now to work with pathogen and will push to git when that's done (though, my battery is about to die, so might be later tonight :)). If you have time to contribute, that'd be great! steven On Sat, Apr 20, 2013 at 5:38 PM, Jacob Joaquin |
Date | 2013-04-20 18:05 |
From | Steven Yi |
Subject | Re: [Csnd] VIM, Csound6, REPL |
Just FYI, I went ahead and pushed Luis's code into the csound-vim repo. It doesn't load up correctly due to sourcing from $VIM. That'll be the first thing to fix up to work with pathogen, but battery is just about dead so i thought I'd push that now. :) Thanks! steven On Sat, Apr 20, 2013 at 5:59 PM, Steven Yi |
Date | 2013-04-20 19:04 |
From | Jacob Joaquin |
Subject | Re: [Csnd] VIM, Csound6, REPL |
I'll try to help where I can. My initial thoughts on how a vim/python-based REPL could work is as follows. 1. User loads up vim and starts a new IPython Notebook server.
2. User writes Csound code. 3. User selects code in visual mode. 4. User sends selected code to IPython Notebook server. 5. Cool things happen.
The end product is a capture of the entire Csound live-coding/improvisation. Complete with pretty graphs generated with matplotlib for things like f-tables, envelope shapes, and possibly FFTs. Here's a bunch of IPython Notebook examples:
IPython Notebooks might work with live performance. If all entries to IPython are timestamped, it might even be possible to play back a Csound Notebook performance, though really not certain about this. Notebooks may also serve as a great platform for creating tutorials for Csound6.
Just thinking out loud. On Sat, Apr 20, 2013 at 9:59 AM, Steven Yi <stevenyi@gmail.com> wrote: Hi Jake, codehop.com | #code #art #music |
Date | 2013-04-20 19:30 |
From | Jacob Joaquin |
Subject | Re: [Csnd] VIM, Csound6, REPL |
In fact, it seems that François Pinot has already demonstrated Csound with IPython in this Csound Journal article: Real-time Coding Using the Python API: Score Events On Sat, Apr 20, 2013 at 11:04 AM, Jacob Joaquin <jacobjoaquin@gmail.com> wrote:
codehop.com | #code #art #music |
Date | 2013-04-21 11:10 |
From | Stéphane Rollandin |
Subject | Re: [Csnd] VIM, Csound6, REPL |
> * We could also develop a csrepl.py script to connect to from the > start. That could be a separate project that could then be tested > from both emacs and vim. I looked at Stephane's csound-x [4] briefly > just now and saw there was some kind of support for repl behavior > going through clojure (and from there the Java API to Csound). I > didn't read things but briefly, so maybe Stephane might comment on > REPL support in csound-x. You said it all: from Clojure the REPL is basically there. I don't use Csound that way though so I have no experience of how well it works. If you suggest an use case (with some details) I could go and see if it is straightforward to use it or if some syntactic sugar is needed. Stef |
Date | 2013-04-21 15:20 |
From | Steven Yi |
Subject | Re: [Csnd] VIM, Csound6, REPL |
Hi Jake, I had a look at IPython's notebook system, it's quite neat! One thing this reminded me of is the older SuperCollider GUI's ability to edit RTF documents with inline SC Code. This allowed formatted text with intermittent code snippets the user could evaluate. The newer SC-IDE seems to have dropped support for RTF, but still allows text with intermittent code (the documentation browser in SC-IDE does show HTML formatted documents with the ability to eval code from there though, which is quite nice). The live coding demos I had done did pretty much the same, as I typed in comments and only evaluated blocks of csound text. It's not quite the same as IPython Notebooks and what you were discussing, but it's in a similar spirit I think. I think that inlining GUI things is a bit outside of what I had wanted to accomplish with this project. This isn't to say that it wouldn't be great, just that I want to limit the scope a bit, at least for this first few iterations. I think too that even if GUI inlining is the goal, the first steps would still be just getting through the basic REPL functionality. Also, I'd want to keep this csound-vim package focused on csound code. It seems there are a lot of python vim tools and those can be used with csnd. Another nice thing, as IPython Notebooks work locally, you can use csnd from python there already (I tried an "import csnd" and it worked at least. :)) I think it'd be neat if someone could setup an IPython Notebook server that had all of scipy as well as csound available. (Though, security would be tricky I imagine). Thanks! steven On Sat, Apr 20, 2013 at 7:30 PM, Jacob Joaquin |
Date | 2013-04-21 15:54 |
From | Steven Yi |
Subject | Re: [Csnd] VIM, Csound6, REPL |
Hi Stephane, Thanks for the explanation! The REPL feature I had in mind is very simple to start, with the basic commands: :EvalFile - evaluates file as CSD, ORC, or SCO :EvalSelectionOrc - eval selection as orc code :EvalSelectionSco - eval section as sco code I'm thinking now that the REPL would create a csound instance per buffer, and may have to have a default CSD used to get Csound started before just evaluating any code. I think that's enough to start (at least, it is for me as I'm learning how to write VIM plugins for the first time). That's about as far as I've thought through on this. The backend part should eventually get served by a binary executable I think, but using python now to write that using the Csound API start should simplify things. Thanks! steven On Sun, Apr 21, 2013 at 11:10 AM, Stéphane Rollandin |
Date | 2013-04-22 13:59 |
From | Stéphane Rollandin |
Subject | Re: [Csnd] VIM, Csound6, REPL |
> :EvalFile - evaluates file as CSD, ORC, or SCO > :EvalSelectionOrc - eval selection as orc code > :EvalSelectionSco - eval section as sco code How does this map to the Csound API ? Is the Csound 6 Java API available somewhere ? Stef |
Date | 2013-04-23 09:44 |
From | Steven Yi |
Subject | Re: [Csnd] VIM, Csound6, REPL |
The actions should map as: :EvalFile - csound.Compile() :EvalSelectionOrc - csound.CompileOrc(text); :EvalSelectionSco -csound.ReadScore(text); As Csound6 is not released, you'll have to compile it to use it. Once done, it builds a csnd6.jar to use. On Mon, Apr 22, 2013 at 1:59 PM, Stéphane Rollandin |
Date | 2013-04-23 10:58 |
From | Stéphane Rollandin |
Subject | Re: [Csnd] VIM, Csound6, REPL |
> As Csound6 is not released, you'll have to compile it to use it. Once > done, it builds a csnd6.jar to use. I'll wait for the release then... Stef |
Date | 2013-05-11 13:44 |
From | peiman khosravi |
Subject | Re: [Csnd] VIM, Csound6, REPL |
I've been doing some research and found this: http://www.vim.org/scripts/script.php?script_id=2771
I've tested it and it seems to work in principle. You can get an interactive shell going. It also support saving sessions, with all the buffer configurations. I'll play around a bit and report back.
P www.peimankhosravi.co.uk || Subscribe to RSS Feed To receive emails about upcoming concerts visit this page & enter your email address in the 'follow' section. On 20 April 2013 16:47, Steven Yi <stevenyi@gmail.com> wrote: Hi All, |