Tags : english, open-source, music, code, jvm, sciart, guitar, alda-tabs, software

Note
This post explains how to easily compose music with alda-tabs, a Domain Specific Language for Guitar Players which runs in the JVM. I have developed alda-tabs as an open source project so you can download it for free in GitHub.

What is alda-tabs?

  • It is a Domain Specific Language for guitar players.

  • It is a piece of software to help guitar players to "execute" their music notes in the JVM, compose songs and get audio feedback.

  • It is an extensible tool for music programming mainly oriented to guitar players.

  • It is built on the top of Alda, a DSL for music composition in the JVM, so it is compatible with both Alda and Clojure.

Why is so easy to code guitar songs with alda-tabs?

  • It does not require programming skills.

  • It does not require traditional music notation.

  • It is as straightforward as writing simple guitar sketches in a notebook.

  • You only have to copy your tabs from the paper to a text editor and execute alda-tabs.

alda tabs

How can I create complex digital music with alda-tabs?

  • With alda-tabs you can execute any .alda file, so you can write your songs/programs in both Clojure, Alda and alda-tabs in the same block of text.

  • It talks to the JVM, so any experimented programmer can do impossible things :-)

  • It is just a layer on the top of Alda, so if you know music theory, then you can write complex songs using music notation.

How is the alda-tabs syntax?

Note
Remember that with alda-tabs you can always use the standard Alda syntax and Clojure code. You can learn more about both languages later to explore the whole potential of alda-tabs. But don’t worry, you don’t need to know more yet. Just follow this tutorial and enjoy :)

What I am gonna show you here is the easy and super simple alda-tabs syntax:

  • The tab notation

  • The chord notation

In 10 minutes you will be able to write songs in a text editor and listen the result in your speakers.

Tab notation

Imagine that you want to play all the strings of the guitar, one after another:

score1

This example is a regular guitar tab in which all the strings are played sequentially with one hand and in which there are not fingers of the other hand pressing the fret.

So the fret number would be 0 in the six positions of the sequence.

How would we write this in Alda syntax?

Don’t worry, I will explain how to do it in alda-tabs syntax bellow (see How to do it in alda-tabs?) but it is important to read this before to compare alda-tabs with Alda.

In Alda syntax we would need to know the note equivalents of each position. And in addition:

  • We would write the octave and the note, one after another:

guitar: o4 e o3 b o3 g o3 d o2 a o2 e
  • Another way would be to write the initial octave increasing/decreasing it when needed:

guitar: o4 e/>b/g/d/<<a/e

How to do it in alda-tabs?

Remember that alda-tabs is based in the simple concept of a tab. Basically, the notes of a guitar can be defined by numeric combinations, a number to identify the string (from the first at the bottom to the sixth at the top) and a fret.

To write a note in alda-tabs you only have to write ta followed by the string number and the fret number.

With alda-tabs we can write the same sequence that we have previously expressed in Alda. But this time we don’t need to know which note we are playing, we only need to write the tab, the position of our finger considering the string and the fret:

 guitar: ta10 ta20 ta30 ta40 ta50 ta60

In this example, we are asking the JMV to play a guitar with the open strings 1, 2, 3, 4, 5 and 6, one after another. That is, ta10 equals string 1 and fret 0 and so on.

Take a look now of the fretboard:

notes fret

If you want to play the first note C, according to the graphic displayed above, you don’t need to know the octave, you just will pick the string 2 in the fret 1: ta + 2 + 1.

guitar: ta21

You can also modify the duration of a note adding a character at the end. For example:

guitar: ta21 ta21W ta21Q ta21D ta21H

What does it mean? If you don’t specify a duration, this will be whole beat (W). You can also play the note during half beat (H), double (D) and quarter (Q). Those note durations will be proportional to the tempo of the score. For example, the following two sentences are not the same:

(tempo 100)
guitar: ta21 ta21W ta21Q ta21D ta21H
(tempo 300)
guitar: ta21 ta21W ta21Q ta21D ta21H

Play with these combinations to see the difference. For more complex timing, check the advanced tips bellow.

Chord notation

Imagine that rather than a sequence of notes you want to play a chord. A basic example would be playing all the open strings at the same time:

score2

You can do this in three ways:

  • In Alda syntax, using the character / to play the notes at the same time:

guitar: o4 e/>b/g/d/<<a/e
  • In alta-tabs syntax, using the tab notation with different voices:

guitar: V1: ta10 V2: ta20 V3: ta30 V4: ta40 V5: ta50 V6: ta60
  • In alta-tabs syntax, but using the chord notation:

guitar: (c 0 0 0 0 0 0 W)

As you can see, the chord notation is just a Clojure function c with seven parameters, the fret of each one of the six strings and the duration of the chord.

For example, the D chord would be

(c 2 3 2 0 x x W)

re

You can also use the chord notation to play single notes. For example, the two following sequences are exactly the same:

# alta-tab syntax

ta10 ta20 ta30 ta40 ta50 ta60

# alda-tab chord syntax

(c 0 x x x x x W)
(c x 0 x x x x W)
(c x x 0 x x x W)
(c x x x 0 x x W)
(c x x x x 0 x W)
(c x x x x x 0 W)

Advanced tips

You can play tabs with specific durations, in seconds or milliseconds by using the function t. In this case you should write the number of the string, followed by a dot and the fret. Add the end, you should express in String format ("") the duration you want.

guitar: (t 1.0 "2s") (t 2.0 "10ms") (t 2.2 "100ms")

You can do the same with your chords:

guitar: (c 0 x 1 2 2 x "5s")

How can I install alta-tabs?

  • Follow the steps to install Alda.

  • Clone this repo and open the folder alda-tabs in your terminal.

  • Run the Alda server with alda up.

  • Create a simple text file, write your song using the alda-tabs syntax and save it.

  • Execute ./alda-tabs.sh followed by the path of the file you want to play.

  • Listen the result.

  • If you want to stop a song you can stop the alda server with alda down.

Note
You can also play some scores (provided in the /examples folder) and modify their content to explore different sounds.

Examples

Note
In this document you can both read the code and listen the output of its execution in alda-tabs. However, the provided audio file is non-stereo. The original output of alda-tabs, however, includes panning. So explore the real result executing the code/song in your own instance of alda-tabs.

Example 1: Chords and arpeggios

You can start exploring the potential of alda-tabs with chords and arpeggios with the example #01:

./alda-tabs.sh examples/01-guitartabs-example.alda

Example 2: The sound of Pi

Try to compose mathematical songs extending Alda and alda-tabs with Clojure. See the example #02:

./alda-tabs.sh examples/02-pi.alda

Example 3: Complex songs

You can also see how beautiful songs with multiple instruments can be written with Alda with the example #03:

./alda-tabs.sh examples/03-hope-for-future-ext.alda