Livecoding with supercollider in spacemace

in supercollider •  7 years ago 

Let's try livecoding with supercollider in spacemace.

git clone https://github.com/dathinaios/spacemacs-supercollider.git ~/.emacs.d/private/supercollider
ls

Good, layer is in place. The installation assumes that SuperCollider.app is in your Applications directory, let's check

ls /Applications/

| Stickies.app | | | |
| SuperCollider | | | |
| System | Preferences.app | | |

I don't see anything wrong.

Now let's start a supercollider project

cd ~/sandbox/
mkdir spacemacs-supercollider
cd spacemacs-supercollider
touch core.scd

How do I enter the major mode?

ls ~/.emacs.d/private/supercollider/

I don't see anything wrong. I should probably restart emacs

Still not working … I know why! dot file do not have supercollider layer.

(defun dotspacemacs/layers ()
  (setq-default dotspacemacs-configuration-layers '(supercollider)))

Hit ,RET Works!

Let's see how to play a note in SC:

"Hello World!".postln;

I have no idea where the heck the output went. Maybe try to play a sound:

{ SinOsc.ar(440, 0, 0.2) }.play;
SinOsc.ar(440, 0, 0.2);

No luck.

Look at the buffer, there is an error about the spacemacsconf.yaml

It appears that the space in Application support folder is creating the issue. fixed that by:

(defun sclang-reset-spacemacs-conf()
  "Reset the library yaml file to defaults. You will have to reinstall
  all your Quarks."
  (interactive)
  (if (y-or-n-p "You will have to re-install all your quarks. Do it?  ")
      (progn
        (defvar dummy-config-file
          "~/.emacs.d/private/supercollider/dummy_conf.yaml")
        (defvar spacemacs-config-file
          "~/.emacs.d/private/supercollider/spacemacs_conf.yaml")
        (delete-file spacemacs-config-file)
        (copy-file dummy-config-file spacemacs-config-file)
        )))
(defun sclang-create-spacemacs-conf-file ()
  (defvar dummy-config-file
    "~/.emacs.d/private/supercollider/dummy_conf.yaml")
 (defvar spacemacs-config-file
   "~/.emacs.d/private/supercollider/spacemacs_conf.yaml")
 (unless (file-exists-p spacemacs-config-file)
   (copy-file dummy-config-file spacemacs-config-file)))
(defun supercollider/init-sclang ()
  (use-package sclang
    :init
    (sclang-create-spacemacs-conf-file)
    :config
    (progn
      (setenv "PATH" (concat (getenv "PATH") ":/Applications/SuperCollider.app/Contents/MacOS"))
      (setq exec-path (append exec-path '("/Applications/SuperCollider.app/Contents/MacOS" )))
      (setq sclang-library-configuration-file "~/.eamcs.d/private/supercollider/spacemacs_conf.yaml"))))

And most importantly, remove ~/Libray/Application Support/SuperCollider foler! Restart emacs. ,ss starts the server and ,, evals the statement perfectly!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Congratulations @gzmask! You have received a personal award!

1 Year on Steemit
Click on the badge to view your Board of Honor.

Do not miss the last post from @steemitboard:
SteemitBoard World Cup Contest - The results, the winners and the prizes

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @gzmask! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!