To my amazement and delight, my blog post went mildly viral on Reddit and Hacker News, bringing about a spike in activity on GitHub. I’m thankful for this not only because it brought a handful of new contributors to the project, but also because it pushed me to work extra hard on making improvements and adding new features.
A lot has changed in the last three months. Here’s a run-down of some of the new features that have been added to Alda since then.
There is now a
key-signature attribute which, when set, provides default flats and sharps for the appropriate notes depending on the key. This makes it easier to write an Alda score when you’re in a key that has a lot of flats or sharps.
The key of B major, for example, has five sharps: F#, C#, G#, D# and A#. Before key signatures in Alda, if you wanted to express a B major scale, you would have to remember to include sharps on all of the right notes:
Now you can express a B major scale this way:
There are two new ways to represent rhythms in Alda.
As an alternative to representing the length of a note in terms of standard music notation (e.g. half, quarter, eighth), the length of the note can be expressed in terms of seconds or milliseconds:
Notes can also be “crammed” evenly into exact note lengths.
For example, you can cram five notes into the duration of a half note:
You can also include note-lengths on the notes inside of a cram, which will have the effect of giving the longer notes more time relative to the others. The duration of the entire cram expression does not change.
See the Alda docs for more information about CRAM.
Notes, chords and other Alda “events” can be repeated by appending
Events can also be grouped together inside of square brackets and repeated:
Inline Clojure Code
Alda now supports writing Clojure code alongside Alda code in a score. Any code placed between parentheses in an Alda score is read and evaluated as a Clojure S-expression. Here’s a simple example:
This feature opens the door for Clojure programmers to do all kinds of interesting things when writing scores. It’s possible to define your own functions and values and use them programmatically in an Alda score. This allows you to do things in your score that a computer can do but a human composer can’t, such as choosing notes to play at random:
Improvements to the Alda REPL
We’ve added a number of useful commands to the Alda REPL.
:help displays a list of the available commands. Additional information about commands and their options is available by typing
:help and the name of the command, e.g.
:score commands are the start of a robust system we are developing that will make it easy to write scores interactively in the Alda REPL.