Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable UDP communication between termux csound-mode and csound app #7

Merged
merged 3 commits into from
Mar 21, 2019
Merged

Enable UDP communication between termux csound-mode and csound app #7

merged 3 commits into from
Mar 21, 2019

Conversation

tj64
Copy link
Contributor

@tj64 tj64 commented Mar 19, 2019

Hi, I now prepared csound-mode in a way that I can successfully run it on Android by using it inside Termux Spacemacs, and communicating via UPD with the Csound Android App.

This is based on two enhancements:

  1. I created a "fake process" to keep comint happy
  2. I created a new custom variable csound-repl-start-server-p which is true by default, but inhibits all references to the Emacs Csound server subprocess when nil.

csound-play and csound-repl-start do work, albeit only if inside the Csound Android the UPDlisten.csd has been started and listens at port 8099.

csound-render returns a message that output to a file needs to be configured inside the (server) csd file within <CsOptions> when no Csound server subprocess has been started in Emacs.

I created a new branch for this, tj-master, but since you only have a master branch, my pull-request goes there. You should test the linux desktop version of csound-mode (setq csound-repl-start-server-p t), if I haven't messed up anything. For testing on Android you will need the fantastic termux app.

I made example files work (sound), but due to my beginners ignorance with csound syntax, I could not get "real" example songs play yet. From the examples it looks straightforward, split the song csd file in two files, server and client file so to say, with an f0 variable inside the server score, and (only) the real score content inside the client file. This works when I trigger client events with schedule, but those frequent i1 statements in the example files score do give parser errors. I have to learn more about csound syntax I guess ...

Cheers Thorsten

PS
By the way, this is really a marvelous mode, I'm looking forward to play around with it on my smartphone. If you accept this pull request, another superb thing would be a Spacemacs layer for Csound, since with it's one key menus and bindings, and transient modes, Spacemacs would be a fantastic environment for REPL live coding.

Normally, everything useful for a mode goes into a Spacemacs layer. I have one question wrt to this: there is another impressive Emacs mode for Csound, csound-x, why there are two modes, what is their relation? Should both modes complement each other in a Spacemacs layer, or would that be redundant?

@hlolli
Copy link
Owner

hlolli commented Mar 20, 2019

Looks fantastic, thanks for this. I notice that I haven't set up any CI testing, going to set it up asap. The only comment I have before testing this myself is:

(defcustom csound-repl-kr 750000

Would make sense to have a default kr tough most users just stick with ksmps. But the default should then be sr divided by ksmps.

@tj64
Copy link
Contributor Author

tj64 commented Mar 20, 2019

Hi, I now set kr to ksmps by default, but it has its own custom var.
By accident (opening the identical csoundtest.txt instead of csoundtest.csd) I figured out that last-csound-buffer is not always a list and built in a check for this.

I'm sorry for all this whitespace noise in the commit, I used whitespace mode on the buffers, but this should have gone in a separate commit.

@tj64
Copy link
Contributor Author

tj64 commented Mar 21, 2019

BTW, this article about scoreless csound brought me right on track wrt to dealing with csound syntax in Emacs (repl or client csd file).

@hlolli hlolli merged commit 4bbf2c3 into hlolli:master Mar 21, 2019
@hlolli
Copy link
Owner

hlolli commented Mar 21, 2019

It looked good to me, just fixed the 4 spaces indentation to 2 spaces, maybe you can .dir-local your elisp indentation to 2 :) go free on PR's if you bump into fixes. I'm trying to build some tests, hopefully I get it working soon, then I should be able to merge from you without much worries. I could start a develop branch, but I like the fact that latest git commit becomes available on melpa-unstable. Then I can bump the version number and a stable packet gets created.

@tj64 tj64 deleted the tj-master branch March 21, 2019 16:14
@tj64
Copy link
Contributor Author

tj64 commented Mar 21, 2019

Thanks for merging, I think you definitely can delete this tj-master branch that is now in your repo, should not be there anymore. Next time I make a PR from master to master.

And I created a .dir-locals file, but for the heck of it cannot remember or find the variable to set directory local elisp indenting ;-)
But I think the 4 spaces came from a little test with semantic indentaton in spacemacs, which I don't use anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants