The Living Thing / Notebooks :

Csound

a less irritating audio programming language

Usefulness: 🔧 🔧 🔧
Novelty: 💡
Uncertainty: 🤪 🤪 🤪
Incompleteness: 🚧 🚧 🚧
Cabbage Studio for Csound is an alarmingly modern experience for people used to the classic Supercollider UI, whose characteristic widget is ERROR: Message 'foo' not understood. RECEIVER: nil. (sic)
Cabbage Studio for Csound is an alarmingly modern experience for people used to the classic Supercollider UI, whose characteristic widget is ERROR: Message 'foo' not understood. RECEIVER: nil. (sic)

Source: Cabbage audio.

Csound is an audio coding language. It is Supercollider’s uncle by marriage. Actively developed. Eccentric. Permissive licensing. Smallish. Clean API. Thus, it works beautifully with other languages, which is unusual.

Learning resources

There are various books:

Interoperation

c

Check out this minimal invocation of the csound api.

#include "csound.h"

int main(int argc, char **argv)
{
  // Create Csound.
  void *csound = csoundCreate(0);
  // One complete compile/perform cycle.
  int result = csoundCompile(csound, argc, argv);
  if(!result) {
  while(csoundPerformKsmps(csound) == 0){}
  csoundCleanup(csound);
  }
  // Destroy Csound.
  csoundDestroy(csound);
  return result;
}

You’ll need this API capability, because its interactive capabilities are, AFAICT, minimalist; a decent external sequencer is necessary for live work.

Csound committer Michael Gogins has put it to me that javascript is natural for this niche, and indeed, he has written a lot of code to this end.

Examples of various Foreign Function Interface invocations (lua, python, go) are in the manual. There is a repository of such examples, in fact.

python

There are a few confusing options and you have to track the release notes to grok the difference.

I recommend you ignore most of them.

Ctcsound

Use ctcsound, which is newer, based on ctypes, and runs in python 3. It is clean and easy. Note you may need to compile the latest version of csound to use it. It includes a port of icsound, which makes things easy.

csnd

The older interfaces are placed by the csound installer in an idiosyncratic fashion into the system python 2 packages folder, which is asking for trouble and I don’t recommend it.

csnd6, is one such older API, based on SWIG. There is a detailed example in the csound journal.

CsoundAC

CsoundAC embeds csound in python, with much extra C++ wrapper code.

import CsoundAC
csound.load("c:/projects/csound5/examples/trapped.csd")
csound.exportForPerformance()
csound.perform()

It’s not clear to me yet how good this is for live control.

Inceptpython

Moreover, python is, in turn, embedded in csound. Fractal infinite recursion left as an exercise.

Miscellaneous

Csound producs

VST audio plugins

Hadron is an open-source csound VST that’s pretty sweet.

IDEs and frontends

There are many frontends.

In addition to Cabbage, mentioned above,

Linkdump

Things I am currently reading: