-
Notifications
You must be signed in to change notification settings - Fork 819
Lilypond
LilyPond is a music engraving program, devoted to producing the highest-quality sheet music possible. It brings the aesthetics of traditionally engraved music to computer printouts. LilyPond is Free/Libre Software (part of the GNU Project). We use it with Music Blocks software in order to export the user-generated music to sheet music.
We will use Music Blocks to create the music and then convert that to sheet music. For that:
- Using Music Blocks create the desired music.
- Export the LilyPond code.
- Download Lilypond (In order to turn the LilyPond code into Printable Standard Music Notation).
- Download Frescobaldi (if desired).
- Basic knowledge of Music Blocks software
- Curiosity about sheet music
Open the LilyPond download page and download the software "For Users" as per your operating system.
Read GNU/Linux Installation on the Lilypond webpage
- Right click the link and save it as
filename.sh
(for example save aslilypond-2.18.2-1.linux-64.sh
) - Open a terminal and go to the directory into which the
.sh
file was downloaded (by default ~/Downloads), e.g.,
cd ~/Downloads
chmod +x lilypond-2.16.2-1.linux-64.sh
sudo ./lilypond-2.16.2-1.linux-64.sh
Read Windows Installation on the Lilypond webpage
Download the .exe
file and run it to launch the installation process.
- Open the
.tar.bz2
file once it gets downloaded. - Clicking it will, open the
Archive Utility
and extract it's contents. - After they have been extracted, you will see a
LilyPond application
file in the directory that pops up. - Drag and drop this file to the
Applications
on the left pane. - This will now enable you to see the "LilyPond" in your applications, i.e. It will get installed and you can drag and drop it from there to your dock, in order to have a shortcut for
LilyPond
in the dock. - You can double-click it to run the program.
- Alternatively, run it from a terminal with the command
open -a LilyPond
.
<img src='https://rawgit.com/Daksh/guides/master/lywithmb//images/save_as_ly_bt.svg'
save as lilypond block
As you play music in Music Blocks, the notes you play are stored in a cache. The save as lilypond
block is used to transcribe the notes in the cache into a .ly
file.
Note: Use the <img src="https://rawgit.com/Daksh/guides/master/lywithmb//images/eraser_bt.svg" height="36" (Erase button) to clear the cache before you run your project to ensure you only get the notes from that project.
You can imagine this feature as a microphone. It starts recording as soon as you start the activity. So each time that you play a sound, it gets recorded in memory. When you run the save as lilypond
button, a copy of all what it has recorded up until in the specified file.
If you want to clear the memory, press the Erase button on the main menu. Let us imagine a scenario:
tone_played: Do
tone_played: Re
save_button pressed
tone_played: Do
save_button pressed
chunk_played: Mi Fa
save_button pressed
eraser_button pressed
save_button pressed
chunk_played: Mi Fa
save_button pressed
So that would output something like:
Do Re
Do Re Do
Do Re Do Mi Fa
Mi Fa
Hint: Everytime the save button gets pressed, the .ly
file gets downloaded
- Open a Terminal
- Go to the directory into which you have exported the
filename.ly
file from Music Blocks (by default~/Downloads
). - Run the command
lilypond filename.ly
. - This will generate a
.pdf
file in the same directory.
- Copy the generated
filename.ly
file to desktop. - Drag and drop this file on the LilyPond shortcut.
- The
.pdf
and logs are created and can be found on the desktop.
-
Open
LilyPond.app
by double clicking it. -
Close the example file which it opens.
-
Use
File > Open
to open your.ly
file: -
From the menu along the top left of your screen, select
Compile > Typeset
-
A new window will open showing a progress log of the compilation of the file you have just saved.
Once the compilation has finished, a .pdf
file will be created with the same name as the original file. This file will be automatically opened in the default PDF viewer and displayed on your screen.
If the .pdf
file is not displayed check the window with the progress log for any errors.
You must save any new edits you make to your file before you Compile > Typeset
and if you are not using the default Preview PDF viewer that comes with the Mac Operating system and you have the .pdf
file generated from a previous compilation open, then any further compilations may fail to generate an update .pdf
until you close the original.
##Using Frescobaldi
Optionally, you can install frescobaldi
a Graphical User Interface (GUI) for LilyPond.
- Open a terminal and run the command:
sudo apt-get install frescobaldi
. - To use frescobaldi, run the command
frescobaldi
. - Drag and drop
.ly
files onto the window it launches.
- For Windows a full installer is available, which contains all of the components needed by Frescobaldi (e.g., the "Frescobaldi.Setup.2.x.x.exe" file).
Note: It might be necessary to install the Visual C++ 2008 runtime module from Microsoft.
- When the installation is completed, you will see the Frescobaldi icon in the Start Menu.
- Once you open the newly installed software, you can just drag and drop your
.ly
file onto it, to start editing.
- Download the DMG disk images. (64 bit and 32 bit versions are provided (the "Frescobaldi-2.x.x-x86_64.dmg" and "Frescobaldi-2.x.x-i386.dmg" files, respectively)
- Click to open the downloaded
.dmg
file. - This will open up a pop up in which you can see the
Applications
shortcut and the Frescobaldi logo, drag the logo onto the Applications shortcut. - Doing that will take you to the
Applications
folder and you can drop it there.
- If you have not already installed Homebrew or MacPorts, choose one of them and install.
- You should have LilyPond installed.
- To install Frescobaldi, open a Terminal and enter the command for the package manager you installed:
- Homebrew:
brew install frescobaldi --without-lilypond
(if you omit--without-lilypond
, Homebrew will install also a copy of LilyPond, but this is not recommended). - MacPorts:
sudo port install frescobaldi
- After the installation, Frescobaldi’s launcher script will be in your
$PATH
, so you’ll be able to launch Frescobaldi by enteringfrescobaldi
in a Terminal.
- Homebrew:
#####Application bundle The installation process generates also the application bundle Frescobaldi.app, that can be used to launch Frescobaldi.
- Homebrew: you’ll see a couple of commands at the end of the installation process, that you can copy and paste in order to link the application bundle into your
~/Applications
or/Applications
directory. - MacPorts: you can find the application bundle inside the
/Applications/MacPorts
directory.
If you don’t want the application bundle, you should install with the command:
- Homebrew:
brew install frescobaldi --without-lilypond --without-launcher
- MacPorts:
sudo port install frescobaldi -app
If you installed LilyPond in the usual location, i.e. you copied the application bundle LilyPond.app
into the /Applications
directory, Frescobaldi should automatically recognize it and you should be able to compile your LilyPond source files right away. If for some reasons this doesn’t happen, you need to point Frescobaldi to the correct location: go to “LilyPond Preferences” in Frescobaldi’s preferences, click “Add…” and either click the directory icon and select LilyPond’s application bundle or directly insert its path (the typical value is /Applications/LilyPond.app
).
Frescobaldi is a lightweight, yet powerful, music and text editor with many features added and enhanced particularly for LilyPond. Major features include point-and-click links between the code and music views, detailed score wizards, built in LilyPond documentation browser, syntax highlighting and automatic completion. Frescobaldi is written in Python, with PyQt4 for its user interface. It acts as a front-end for the Lilypond software, as it helps in editing the input file given to be processed and helps to check the output pdf
simultaneously. The conversion at the back of Frescobaldi, is done with LilyPond itself.
You can customize your LilyPond output by adding your own name, the title of your musical creation, and your intended copyright to the .ly
file. To do so, open filename.ly
in a text editor and change the header, e.g.,
\header {
dedication = "To my best friend Someone"
title = "The Last One"
subtitle = "Breathless"
instrument = "Guitar"
composer = "Mr. ABC XYZ"
copyright = "Mr. Mouse (c) 2015 -- CC-BY-SA"
tagline = "Made from Music Blocks v.0.9"
}
Similarly, you can change the meter, add MIDI instruments, add a Guitar Tab Section, and add MIDI Section.
Note: Comments in .ly
files are made by using a %
at the start of a line of text.
More customization details are found in the .ly file. Further references include:
- Text Input
- Learning Manual
- Music Glossary
- Freely sharable music notation generated with LilyPond
- Lilypond output in a web browser
<img src='https://rawgit.com/Daksh/guides/master/lywithmb//images/example.svg'
The save as lilypond
block will transcribe your composition. The
output of the program above is saved to ~/Downloads/hotdog.ly.
\version "2.18.2"
mouse = {
c'8 c'8 c'8 c'8 c'4 c'4 g'8 g'8 g'8 g'8 g'4 g'4 a'8 a'8 a'8 a'8 a'4
a'4 g'8 g'8 g'8 g'8 g'4 g'4 f'8 f'8 f'8 f'8 f'4 f'4 e'8 e'8 e'8 e'8
e'4 e'4 d'8 d'8 d'8 d'8 d'4 d'4 c'8 c'8 c'8 c'8 c'4 c'4
}
\score {
<<
\new Staff = "treble" {
\clef "treble"
\set Staff.instrumentName = #"mouse" \mouse
}
>>
\layout { }
}
<img src='\images\sheetmusic.png'
\version "2.18.2"
% <comments removed>
\header {
dedication = "Made with LilyPond and Music Blocks (https://musicblocks.sugarlabs.org)"
title = "My Music Blocks Creation"
% subtitle = "Subtitle"
% instrument = "Instrument"
composer = "Mr. Mouse"
% arranger = "Arranger"
copyright = "Mr. Mouse (c) 2015 -- CC-BY-SA"
tagline = "Made from Music Blocks v.0.9"
}
meter = {
\time 3/4
\key c \minor
\numericTimeSignature
\partial 4
\tempo "Andante" 4=90
}
\score {
<<
% GUITAR TAB SECTION
% Delete the %{ and %} below to include guitar tablature output.
%{
\new TabStaff = "guitar tab"
<<
\clef moderntab
>>
%}
>>
\layout {}
% MIDI SECTION
% Delete the %{ and %} below to include MIDI output.
%{
\midi {
\tempo 4=90
}
%}
}
% MUSIC BLOCKS CODE
% Below is the code for the Music Blocks project that generated this Lilypond file.
%{
[[0,["start",{"collapsed":false,"xcor":0,"ycor":0,"heading":0,"color":0,"shade":50,"pensize":5,"grey":100}],250,150,[null,null,null]],
[1,["pitch",{}],705.5,128.5,[null,2,3,null]],
[2,["solfege",{"value":"sol"}],779,128.5,[1]],
[3,["number",{"value":4}],779,160,[1]],
[4,["savelilypond",{}],324.5,363.5,[null,5,null]],
[5,["text",{"value":"tada.ly"}],458,363.5,[4]]]
%}
You can use the following two files test1.ly
and test2.ly
to check if LilyPond and Frecobaldi installed properly:
test1.ly
\version "2.18.2"
{
c' e' g' e'
}
test2.ly
\version "2.18.2"
mouse = {
c'8 c'8 c'8 c'8 c'4 c'4 g'8 g'8 g'8 g'8 g'4 g'4 a'8 a'8 a'8 a'8 a'4
a'4 g'8 g'8 g'8 g'8 g'4 g'4 f'8 f'8 f'8 f'8 f'4 f'4 e'8 e'8 e'8 e'8
e'4 e'4 d'8 d'8 d'8 d'8 d'4 d'4 c'8 c'8 c'8 c'8 c'4 c'4
}
\score {
<<
\new Staff = "treble" {
\clef "treble"
\set Staff.instrumentName = #"mouse" \mouse
}
>>
\layout { }
}
This work is licensed under the Creative Commons Attribution 4.0 International License
Daksh Shah - 2015