Announcing Pink and Score: libraries for music systems design and composition, written in Clojure

Hi All,

I’d like to announce two Clojure libraries for music systems design and composition called Pink[1] and Score[2].

Pink is a library for music system design. It currently contains code for an audio engine, events processing, and signal processing. It is heavily influenced by Music-N systems (i.e. Csound, SuperCollider), but explores some novel areas of music system design, such as using audio-rate functions as arguments to instruments.  This allows such things as reusing an instrument whether it has a fixed pitch, a glissandi, randomized frequencies, etc., depending on what the user decides to pass in as an argument (rather than encoding that within the instrument design).  Events are also generalized as delayed function applications, which allows a great flexibility for the user to decide what will happen when an event is processed.

Score is a higher-level library for music score generation.  This library contains two primary score generation models–one based on CMask[3], the other on SuperCollider’s Patterns[4]–each of which solves various score generation use cases. Score also contains some useful functions for converting units to frequencies and working with non-standard scales that have scale degrees different than the western standard of 12 tone equal temperament. The library is designed to stand alone and work with various other systems.  I currently use it in my integrated music environment Blue[5] to generate Csound scores, as well as starting to use it with Pink.

I’ve also added a music-examples[6] project that I’m using to explore use of Pink and Score together.  There is also an example there using Incanter to plot the audio signals generated from a French Horn model as well as the output of an envelope generator. (This was useful for debugging some instrument code that went awry. 🙂 )

Some notes:

* In the Clojure world, most people working on music probably use Overtone. I think Overtone is an excellent project and will probably handle many people’s use cases. However, I am interested in use cases which are–as far as I understand–not possible with Overtone, particularly crossing the event boundary with audio-rate functions as arguments.  (I believe that’s a limitation of SuperCollider rather than Overtone though; if that situation has changed since last I looked into it, then please let me know.)  I am also very much interested in encapsulating projects as fully as possible, for the purpose of having higher preservation of musical works.  This made me curious to explore a pure-JVM solution.

* Most of the experimentation so far has been done using the REPL and Vim.  You can check out the code in the demo folders in Pink/src and Score/src for some hints.  I hope to get around to documentation and tutorials soon.

* I have not yet fully benchmarked Pink, though it has so far been adequate for the various test musical ideas I have run.  I don’t expect it to run as quickly as C/C++ based systems such as Csound and SuperCollider, though I do expect to push things as fast as it can go on the JVM.  To that end, if you look at the code of Pink, you’ll find lots of typehints, as well as a design that reuses arrays between function calls. These are done to perform as quickly as possible as well as minimize memory usage. I’ll be continuing to explore optimizations; any suggestions would be very welcome!

* For those who might know me from my work on Csound, I am very much planning to continue my work there.  Working on Pink has helped to experiment with engine design ideas that would be more difficult to do with Csound’s code. I hope to bring back some of the architecture and design ideas back to Csound when I have a chance.

* These projects are not yet mature, but I felt they have reached a point where I could invite others to take a look.  At this point, I have some short-term plans (i.e. working with audio samples, engine code for writing to disk), but the longer-term is still a bit nebulous.  As it is, the libraries are not in a shape to submit to clojars. If you are interested to experiment with them, you can do so by checking them out with Git and running ‘lein install’, then adding dependencies (see the music-examples project.clj for an example).

Thanks!
steven

[1] – https://github.com/kunstmusik/pink
[2] – https://github.com/kunstmusik/score
[3] – http://www.bartetzki.de/en/software.html
[4] – http://doc.sccode.org/Tutorials/A-Practical-Guide/PG_01_Introduction.html
[5] – http://blue.kunstmusik.com/
[6] – https://github.com/kunstmusik/music-examples

Published
Categorized as Pink

Leave a comment

Your email address will not be published. Required fields are marked *