gzmask avatar

Livecoding with supercollider in spacemace

gzmask

Published: 19 Jul 2017 › Updated: 19 Jul 2017Livecoding with supercollider in spacemace

Livecoding with supercollider in spacemace

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!

Leave Livecoding with supercollider in spacemace to:

Written by

Read more #supercollider posts


Best Posts From gzmask

We have not curated any of gzmask's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From gzmask