Music composer,
arranger, producer. Freelancer.

Making music in terminal

Making music in terminal

Few years ago I saw that famous interview with George R. R. Martin, where he claimed that he is writing his books on an ancient MS-DOS PC with word processor from the 80. - WordStar 4.0. Martin said that he hates spell-check and good old WordStar does everything he wants and it doesn’t do anything else. Last year, Bryan Lunduke (YouTuber and promoter of GNU/Linux) wrote an article, in which he described his experiment consisting in being limited to command line for 30 days. He wrote:

My computers, even the low-powered ones, felt faster (command-line software tends to be a whole lot lighter and leaner than those with a graphical user interface). Plus, I was able to focus and get more work done without all the distractions of a graphical desktop, which wasn't bad.

I thought that it is a great take on the concept of minimalism (lower-case "m"). I myself, back in the days of Windows 9x, had a collection of floppy disks with useful MS-DOS software, just in case if my Windows machine breaks down. Now, I began to think about the possibility of composing in terminal environment, without graphical user interface. I asked myself - what is the cheapest machine I could get away witch this task? Can I write score and make music on a computer with 80286 cpu (80286 cpu was released in 1982, about the same time as WordStar 4)? I wanted to create extreme minimalistic and posibly the cheapest working environment. Because old computers are now collector's items, and are rather expensive, I decided to go with Raspberry Pi Zero - popular single board computer that you can buy a new one for less than £5.

How to make music... but without graphical interface?

Raspberry Pi runs its own version of Linux. I decided to use LilyPond - a terminal application and its specific language designed for music engraving. This is how LilyPond is described on its webpage:

LilyPond is a compiled system: it is run on a text file describing the music. The resulting output is viewed on-screen or printed. In some ways, LilyPond is more similar to a programming language than graphical score editing software.

You do not write music by dragging notes from a graphical toolbar and placing them on a dynamically refreshing score; you write music by typing text. This text is interpreted (or “compiled”) by LilyPond, which produces beautifully engraved sheet music.

The second-most important program for this project was text editor. I needed an editor which I could program or just make my own key bindings. Probably every major text editor will do, I decided to go with Vim - because this one is extremely versatile and lightweight, and also Vim is already preinstalled in almost every GNU/Linux distribution.

When we write our code in Vim, we can use Lilypond to compile it into a pdf file with traditional score, and midi file, which we cane use to playback our comosition. But to actually see our score in musician-friendly format we need to install pdf viewer. Viewer should, of course, work without gui and display images in framebuffer. I found out Green — simple pdf viewer for framebuffer. Little program called Timidity ++ is great to playback midi files generated by Lilypond. Timidity is able to use soundfonts for playback and rendering wave files, it also has built-in effects like reverb or flanger. Speaking of soundfonts - I wanted to use only free and widely available elements, so i decided to use the VSCO 2: Community Edition - it's a collection of free samples and soundfonts. It doesn't sound as good as professional libraries but it will do. To wrap these elements into one working environment, I've written simple configuration file for Vim that binds F5-F8 keys to system commands for triggering compilation in Lilypond (F5), running score preview in Green (F6), starting/stopping playback in (F7) and rendering wave file in Timidity ++ (F8). Now I could control playing, previewing score and rendering from Vim!

Steps to reproduce my workflow are described below:

Git is needed to download and compile Green: sudo apt install git Install/update Lilypond, Vim and Timidity++: sudo apt install lilypond vim timidity

Install Green: git clone https://github.com/schandinat/green.git sudo usermod -a -G video {your_username} sudo apt install libpoppler-glib-dev libsdl1.2-dev cd green make sudo make install

Download VSCO 2: Community Edition soundfonts (get the SFZ version).

Install Polyphone...

sudo apt install polyphone ...and convert SFZ to SF2 (we need SF2 format for Timidity, but it is easy and quite intuitive process).

Finally, it's time to tell Timidity ++ that it should use soundfont to play midi and render wave files. Create file named timidity_custom.cfg and inside set path to soundfont:

soundfont /path/to/your_soundfont.sf2

Here is an example of multiple soundfonts used in Timidity's configuration file.

To to get my keybindings for Vim download this file, or you can clone git repisitory (there are also bindings for Micro-Editor, if you don't like Vim): git clone https://github.com/przem360/lilypond-bindings.git Now, if you decided to use Micro-Editor, you should create a separate shell script for running Green - name it pdfprev.sh and save it inside Micro-Editor's directory.

pdfprev.sh: SDL_NOMOUSE=1 green $1 Also, in case you are using my key bindings, don't forget to update path to timidity_custom.cfg in lilypondBindings.vimrc (or in lilypondBindings.lua).

Everything is ready, now you can run Vim specifying path to lilypondBindings.vimrc... vim -u /path/to/lilypondBindings.vimrc ... and write your composition!

If you would like to check what I've made with Lilypond and Timidity++, you can listen to my track called Pulse on SoundCloud.

This short piece is released under Creative Commons licence, so you can download it, and use it in your own projects (even commercial ones) for free. It would be nice though if you would credit me in your project. You can also download source files (.ly and midi) from github and make changes in composition.

Bibliography

Lunduke, Bryan (2019), Without a GUI--How to Live Entirely in a Terminal, Linux Journal. Retrieved 02 February 2020.

Lunduke, Bryan (2016), 30 days in a terminal, Networkworld. Retrieved 02 February 2020.

photo

widget image

Custom instrumentation

If you can think of any particular style, instrumentation or arrangement that would fit to your project - I can do it for you. Sky is the limit. Just share your idea I'll create your desired soundtrack.

But if you prefer to stay focused on other aspects, you can show me your project, no matter if it is a film, spectacle or video game, you can show me our project and I'll come up with something exclusively for you.

widget image

Montage ready

I can provide you either score sheets or complete, mixed and mastered recordings. Nowadays composer can create big projects only with computer and samples but sometimes real instruments are better solution. You can decide what will be recorded and ho it will be done.

What's new?

make-music-in-terminal Making music in terminal How far can we go with digital minimalism? Can we make music on cheapest computer?
leitmotif Leitmotif in film scoring What are leitmotifs? Why are they great way to create a memorable soundtrack?
cue-sheet What are cue sheets? Cue sheet makes it easier to prepare a good soundtrack. Let's see how it looks and what its history is.
score2tracker Modern composers vs music trackers Composers interested in creating music for retro games often find it hard to work with trackers. One simple tool can make it easier.