I‘d like to program interactive/ncurses-style command line interfaces for some of my pd patches. It’s been a few years (around 12) since I learned some basic programming skills (mostly web-related: php and MySQL, some python, a bit of C#). I read a bit about libpd, ncurses, and some other cli-libraries but couldn’t figure out which language would be most suitable.
Ultimately it’s mostly about midi sequencer/controller patches, so I also thought about not utilising pd/libpd at all and do everything in c/c++/… but i also have some dsp patches I’d like to use in a terminal and generally really enjoy programming in pd, so… I’m indecisive and feel lost in this great world of programming languages.
Can you point me in some directions, maybe some resources (tutorials, beginner-friendly documentation, etc) and share your insights or thoughts about my endeavour? That would be great, thanks!
-
Programming CLI interfaces for pd patches: which programming language do I need to learn?
-
@fina If it is just a few patches you can just start pd with -nogui and communicate to your patches over UDP using [netsend] and [netreceive]. Downside is that it means your patches need to be designed/reworked around this use but it is quick and easy and you can use pretty much any language even shell languages like bash using tput and pdsend/pdreceive. Python with or without ncurses would work for this method.
Edit: Forgot to mention, if you go the ncurses route you may want to check out CDK if you have not already done so, widget library for ncurses which can save a good deal of time and has bindings for a few languages.
-
to add onto that it's convenient to have a simple abstraction that allows for dispatching to sends based on the 1st element in a list (and that gets cast from 'anything')
so you can send "blah list thing1 thing2;" from the pdsend program (or some program sending to it) or directly over network
and receive "list thing1 thing2" at a[r blah]
object in pd
and that can also be wrapped into 1 object of course:
As far as which languages to use, personally I tried using Lua coroutines and even made a library to run scores with pdlua https://github.com/sebshader/lscore, but right now I think I'm going to use nelua for the next version (other candidates have been crystal, Felix, and kotlin).
But those might not play the best w/ the terminal and nurses, for that I'd probably go with something like Lua or lua-jit maybe