dark mode light mode Search Menu


Alda on Github

What is Alda?

Before computers, musicians used blank sheet music to write down their compositions and their instrument parts in larger compositions. There are a number of music notation software tools that create the same effect — writing notes and other details on lined sheet music.

However, notation software can distract musicians with all the possible variations of notation. Sometimes it also can be hard to find the menu you need when all you want to do is write down notes.

Dave Yarwood, the programmer who created Alda, is both a classically trained musician and a composer. He studied Music Composition at the University of North Carolina and explored ways to make electronic music. Yarwood found MML (Music Markup Language) which was included with the Microsoft BASIC language in the 1970s and 1980s. MML code used mck (Music Creation Kit) to compile MML code to play music.

Eventually Yarwood migrated back to live performance with non-digital instruments. He found writing music with visual software like Sibelius useful but also complicated.

Alda is Yarwood’s solution to some of the problems of MML and music notation software with all their distracting options. Musicians can use any basic text editor to write their compositions then listen to them on a computer. Alda commands are simple and obvious. For example, to have a trombone play the notes C D E and F, you would type this code:

trombone: c d e f

The Alda language includes simple commands to account for many different music notation situations, for example, instruments, volume, octaves, sharps and flats, rests, and note lengths.

Alda also is interesting because it is a language in its early days of development. There are many features already implemented. However, Yarwood and others working on this open source language eventually want to include the ability to export Alda files to MusicXML format so compositions can be imported into Sibelius, Finale, MuseScore, and other music notation software for printing as lined sheet music.

In other words, Alda works today to create music. If you’re interested, you also can watch in the future as the language grows and evolves. If you are or become a programmer, maybe you can contribute to development of Alda.

The name of the language — Alda — means tree in the Quenya language, a fictional language created by JRR Tolkien and used by elves. The creator of Alda, Dave Yarwood, wanted a name that suggested a tree with its many branches.

How is Alda used?

Once installed, you can use any command line interface software tool to start Alda and call up the REPL, an interactive session where you can type music notation then hear back your composition as you piece it together. Writing compositions also can be done in any simple text editor then played with a single command with Terminal, iTerm, or other command line tool.

In the future, when the language includes the ability to export to MusicXML or similar universal file formats, compositions created in Alda can be imported into common music notation software tools and converted to standard lined sheet music.

How to set up and use Alda?

Installing the Alda language on your computer is a great way to learn and practice basic programming skills with Github — software used to store and retrieve software files — and command line interface (CLI) software tools. CLI software lets you work with files on your computer and remote computers by typing commands one line at a time. Once you memorize a handful of common commands, it’s often faster and easier to type than use visual interfaces like a file browser.

Macs include Terminal and the latest Windows includes bash software, both CLI tools. I use iTerm on a Mac computer. There are a number of other free CLI tools. You also may be able to hack these steps with a web browser and file browser, visual software tools. However, programmers typically use CLI tools to work with files and Github.

Alda is a fun language if you know (or want to learn) a little bit about music. It’s not too hard to use the REPL interactive session or to write out lines of Alda code into a text file and drop it into your alda-lang folder then use the alda —file your-file-name.alda command to play your file.

There are many more details about how to represent musical notation as code in the gentle introduction to Alda written by Dave Yarwood. Links below let you learn about the Alda language, as well as command line interface tools and other music software that might be fun to explore.

Instructions to set up and play with Alda

If you do not have a Github.com account, you’ll need to go to their site and sign up. You’ll also need to follow their instructions to install git on your computer at this URL: https://help.github.com/articles/set-up-git/ Your computer also may, or may not, need the latest version of Java. The Java download URL is listed below.

Download alda from the Releases page (https://github.com/alda-lang/alda/releases) to your Downloads folder.

With Terminal, iTerm, or other CLI tool, type these commands to change directory and create an alda-lang folder at your user root folder (~/ on Mac and Linux computers):

cd ~/
mkdir ~/alda-lang

Then enter alda-lang folder by typing these commands:

cd alda-lang

Move alda file from your downloads folder to alda-lang folder then type ls command to list contents of this folder to check files were moved:

mv ~/Downloads/alda ~/alda-lang
ls -l

Make alda file executable:

chmod +x alda

Move alda file to /usr/local/bin system folder for binary executables:

mv alda /usr/local/bin

Clone github alda repository URL (add Github if needed) then type ls command to list contents of this folder to check files were downloaded:

git clone https://github.com/alda-lang/alda
ls -l

Enter alda-lang/alda folder:

cd alda

Install FluidR3 sound files by calling the install script:


Start Alda language server and play Bach example located in the examples folder:

alda start
alda play --file examples/bach_cello_suite_no_1.alda

Play code example:

alda play --code "piano: f e d c"

Using REPL to write music with Alda

Alda also has an interactive tool called a REPL (Read Evaluate Play Loop) where you can type commands to try them out as you write Alda scripts with your musical composition.

In your ~/alda-lang folder, type alda repl then press the Enter key to start Alda’s interactive command line mode. If needed, type :help for commands.

Type c d e f then press the Enter key. Nothing happens. You need to specify what instrument to play.

Now type piano: c d e f (don’t forget the colon after the word piano!) then press the Enter key. Alda plays these notes with a piano.

Type trombone: c d e f then press the Enter key. A trombone plays these notes. Try playing these four notes with a banjo, bottle, and soprano-saxophone.

Type this code for fun piano: d d e d g f+ then press the Enter key. Do you recognize the music? It’s the first part of the Happy Birthday song. The f+ signifies F# or F sharp.

For more fun, type alto-saxophone: d d e d g f+ and press the Enter key. Or bottle: d d e d g f+.

Type quit (or bye or exit) to close the REPL and leave its interactive mode.

At the CLI software command line, close the Alda server:

alda stop

Do you see the differences between using direct commands and using commands in REPL?

When you don’t use the REPL, you need to call the alda server and pass it commands, for example:

alda play --code "piano: f e d c"

This direct command tells alda to play code with a piano playing notes f e d c. Double quotes mark the start and end of the code passed to the Alda server.

In the REPL, the Alda server is already running so you only need to pass music commands, no double quotes required:

piano: f e d c


Below are links where you can learn about Alda and how the language makes it easy to create music.

Learn More





MML (Music Macro Language)




Where to Find Command Line Interface Software


Linux Command List for Command Line Interfaces



You may or may not need to load the latest version of Java on your computer.



Related Posts