Skip to content

hlolli/csound-mode

Repository files navigation

License GPL 3 MELPA Stable Melpa Status

csound-mode

This package provides both a basic major mode for editing Csound files, as well as a REPL for fast feedback when composing/sound-designing using Csound.

csound-mode provides a set of essential features for interactive development:

  • REPL
  • Interactive code evaluation
  • Code completion
  • ElDoc
  • Indentation rules
  • Syntax highlighting and rainbow delimited score parameters

Installation

You can install csound-mode from MELPA using the following command:

M-x package-install [RET] csound-mode [RET]

Alternatively, download latest release. and add it manually to load-path like shown here:

;; Change directory path according to csound-mode dir location.
(add-to-list 'load-path "~/.emacs.d/csound-mode/")
(require 'csound-mode)

Requirements

  • Emacs 25+
  • Csound 6.10+ (any release/compilation after 1. December 2017)

Usage

csound-mode comes with major-mode-hooks, meaning that every time a csound file(.csd/.orc/.sco) is opened in emacs, csound-mode will be automatically loaded as major mode. While making it easier to install, this could potentially overwrite other major-mode you have set for csound files.

If you're using csound-mode directly from the git repo, and you happen to use the use-package macro. Then this could be used in your init.el file.

(use-package csound-mode
  :mode (("\\.csd\\'" . csound-mode)
     ("\\.orc\\'" . csound-mode)
     ("\\.sco\\'" . csound-mode)
     ("\\.udo\\'" . csound-mode))
  :load-path "packages/csound-mode/")

Keybindings

C-c C-p csound-play Same as doing csound filename -odac

C-c C-r csound-render Same as doing csound filename -o filename.wav

C-c C-z csound-repl-start

C-c C-k csound-abort-compilation abort compilation (e.g. playback)

C-M-x/C-c C-c csound-evaluate-region

C-x C-e csound-evaluate-line

C-c C-l csound-repl-interaction-evaluate-last-expression

C-c C-s csound-score-align-block cursor needs to be within a score block

M-. csound-score-find-instr-def cursor needs to be within a score block

C-c C-d h csound-manual-lookup searches for a function definition in the Csound-manual

Run the tests

The tests depend on the package test-simple.el. Run the tests locally from the command line

emacs --batch --no-site-file --no-splash --load test/csound-mode-tests.el