Music: Practice & Theory Stack Exchange is a question and answer site for musicians, students, and enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for a high-level programming language. I did some googling and found a number of examples (some summarized here but haven't found quite what I need.

The key feature I'm looking for is that the language will let me create music based on some input material (a melody), and then lets me specify the rest of the piece as a series of transformations on the initial input material. The types of transformations I'm looking for are fragmentation (specify a subset of the original), transposition (change pitch), augmentation and diminuation (change duration), inversion (change direction of intervals), retrograde (change order).

Does something like that exist?

UPDATE: I'm currently trying with music21 ( It will probably allow me to do this, but probably not in such a way that it will be straightforward to edit or read.

share|improve this question
I'm using c++ on win32. It's not the tool, it's the project you make with it. That's a pretty loosely defined project you got so far... And let's face it. People make way better music than computers ever have. And ever will. – Stephen Hazel Apr 12 '14 at 2:45
@StephenHazel I am not asking for a computer program that generates music for me. I am asking for a computer program that lets me express a composition as a series of transformations based on my input. Your c++ example does not make sense. Suppose I would be asking for a program that lets me extract substrings based on a text pattern, then surely you would recommend some regexp library to me? Well then, I'm asking for a language that lets me create music based on a series of well-defined manipulations of input music. – Roland Bouman Apr 12 '14 at 11:49
@Roland, What about MIDI? – Jesus Christ May 5 '14 at 18:12
@JesusChrist, yeah what about it indeed? MIDI offers only an encoding. In other words, very much too low-level. – Roland Bouman May 5 '14 at 20:34

11 Answers 11

up vote 9 down vote accepted

Besides Haskore which is already mentioned in the paper you refer to and the ones mentioned by others, there is SuperCollider and Pure Data.

I absolutely understand your question. I've been looking for such a high-level thing myself. Here are my personal thoughts on this:

I haven't found anything good and came to the conclusion that there are no ready-made generally-accepted abstractions out there. This is probably because everybody agrees on what a delay, a sawtooth or a butterworth filter is, but there is no generally accepted method to write music.

So your best bet is to find a language which has enough "abstractive powers" so you can write your own abstractions. There is no doubt that Haskell is such a beast, but it is difficult (though rewarding) to learn.

I am currently fiddling with Supercollider to get there. I only started a few days ago, so I don't know how far it'll get me. The least thing it'll do for me, is liberation from MIDI. I can control the sound anyway I want. Even if you (as you say) are only interested in writing note-sequence-transformations, you may quickly outgrow this approach, because it'll all sound the same. Then you may wish to have more control over the instruments than Midi allows you. At least this is where I am now.

But there are also OSC-Bindings for Haskell, so I may use Supercollider for the sound synthesis and Haskell for the composition synthesis. I am also pondering over a player-synthesis which would go between the two.

share|improve this answer
Martin, thank you! I'll check out the products you mentioned. Like you said, I'm starting to believe there currently is nothing that matches my requirement. I'm currently looking into cobbling it up with JMusic or JFugue (as I'm comfortable with java). However, I'll be sure to consider your suggestion for Haskell. – Roland Bouman Apr 13 '14 at 22:27

See this SO question. I'm not sure if this is exactly what you need, but it might help.

Because I'm just linking another question, I'd normally put this as a comment. However I don't have commenting permissions on this site (yet).

share|improve this answer
Thanks! Well that question sure has a lot of answers, many more examples than the paper I linked to. Not sure yet if the thing I'm looking for is in there, but it looks promising. Thanks again! – Roland Bouman Apr 12 '14 at 0:02

You may be interested in the CHucK programming language.

share|improve this answer
Can you add a little more information about this language? – Shevliaskovic Apr 12 '14 at 8:59
Thanks. When I first drafted this question, I stumbled upon CHucK before posting it. I played around with it for a bit, I think it's cool, but it's just a bit too low level for what I have in mind. For instance, in CHucK I have no meter, no scales, not even notes. Just synthesizers and time. So CHuck is one or two layers too far down for what I really need. – Roland Bouman Apr 12 '14 at 11:52

Getting into tracker software might another approach. You could consider the tracker score notation the programming language, and the tracker player the complier/interpreter.

There are plenty of music modules (songs) you can load and play with. These are shared all the time.

You can use tracker software out of the box to edit your 'input music' (E.g. OpenMPT).

There are lots of open-source libraries that allow you to play music in this format e.g: So getting your hands on the source code to a player may get you to ahead in manipulating aspects of a song via your programs.

This is how many computer games played music (especially older, arcade games where memory was limited and could not afford whole sample data of final songs to exist).

Many tracker module players already allow crude song control; mute instrument, swap instruments, mute track, change tempo, jump to song position. Games can already execute crude song control in real time in synchronisation with in-game events (jump to same pattern position in a different set of patterns or unmute channels whilst the game character is using an invincibility power-up, or for the end-of-level fight against the big boss man).

Many tracker editors are also open source (MilkyTracker, OpenMPT) and will have functions for transposing parts of the song (since they're keyboard shortcuts within the application) as well as playing the songs (since the song editors also play the songs).

Hopefully, this might give you some ideas. Despite not being a traditional programming language.

share|improve this answer

One can consider Lilypond to fit in this mold: although it is more focused on typesetting music, it can output a MIDI representation of the score. However, I find that, in terms of basic usage, it is not easy to achieve expressive effects in the midi output. In addition, it has no real-time capabilities. I mention it primarily since it may provide ideas (or code) for implementing a high-level interface if you end up rolling your own system.

share|improve this answer

Give a try to OpenMusic, a visual programming language for symbolic music. It’s a bit frightening at first, but the tutorial should get you going pretty quick.

share|improve this answer
Hey that looks really interesting. Thanks! I'll take a look. – Roland Bouman Apr 12 '14 at 11:50

I am not sure if they include all of the features you require. But the java jmusic library is quite extensive, I think that would be your best shot.

Otherwise other options would be JFugue, music21 (python) or the visual programming language CSound, from ircam, also very extensive.

share|improve this answer
Dorien, dankjewel! Ik ga het denk ik idd eerst maar eens met jmusic proberen. – Roland Bouman Apr 15 '14 at 19:45
Graag gedaan. Het is de meest uitgebreide bibliotheek die ik al ben tegengekomen. Als je nog iets beters vindt laat zeker weten. – dorien Apr 16 '14 at 19:53

Édouard mentions OpenMusic, somewhat similar, and descendant of PatchWork is PWGL ( Looking at what you need from a language it might be useful especially 'constrains' part of PWGL. Learning curve is steep (LISP) but well worth your time. Some great external libraries for rhythm manipulation too. good luck

share|improve this answer

I think Overtone has what you're looking for and more. It's a Clojure library that acts as a powerful front-end to SuperCollider. It may take a while to learn how to use it (especially if you're new to Clojure), but once you do, it's quite powerful and flexible. You can do things like define a melody as a sequence of scale intervals, and then combine that with any particular scale and sequence of note duration values, which gives you a lot of freedom to play around with variations on a theme. It's worth checking out, even if you're not familiar with Clojure!

FWIW, I'm working on developing my own front-end to Overtone (I know; it would be a front-end to a front-end) that lets you leverage much of what it's capable of, but using a much simpler syntax aimed more towards musicians/composers than programmers. It's nowhere near usable at the moment, but hopefully will be someday in the near future. Until then, I heartily recommend Overtone :)

share|improve this answer

Sounds like you want to do something similar to Andrew Sorensen, which is amazing. He uses a language called Extempore, similar to Lisp with a bit of C in it, which allows you to define and play stuff in real time. You can see this in action in this video, where he performs a piece doing live coding.

share|improve this answer
Thank you! Yes, I did see that Tedx talk, but it seemed like a pretty low level language to me - more about sound manipulation than symbolic (notation) manipulation, which is what I'm looking for. Thanks anyway! – Roland Bouman Sep 19 '14 at 19:47
I suppose you can build something on top of that, just some more structures like scales, so you can manipulate scales instead of having to work directly with semitones all the time. – Chochos Sep 19 '14 at 22:14
probably one could. But I'm looking for something that already has that. From what I've seen so far, music21 is closest to what I'm looking for. – Roland Bouman Sep 19 '14 at 22:39

Years ago I played around with a language called KeyKit. It represents music as phrase objects and has concepts of notes, chords plus a ton of functions for manipulating and generating music both via coding and by using built-in, simplified graphical controllers. I think that the language is fairly simple to learn. I think the guy that created it still uses it and you might even get answers from him for questions:

As an aside, I'm wondering if you found what you were looking for. I'm also interested in knowing what else is out there that works well for symbolic / algorithmic music composition.

share|improve this answer
Thanks for the suggestion! Nope, still haven't found it, but your suggestion looks promising! – Roland Bouman Jul 25 '15 at 0:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.