Help:Sheet music

Overview
The Score extension renders musical notation and optionally generates audio and MIDI previews.

Here's a mindlessly simple LilyPond input file, using syntax for LilyPond 2.4.: When run through LilyPond, it renders the musical notation, e.g. as PostScript, or on a wiki page using the Score extension:

The generated MIDI files leave out many expressive effects, making them unsuitable to demonstrate nuances of music (notation).

A more complicated piece, again written in LilyPond notation, looks like this:

""

and it outputs as this:

Transcribing music
You do not need to be able to write music yourself to be able to transcribe music from existing, published sources. Reading basic musical notation is not that difficult and once you know what the symbols mean it is usually easy to write out the appropriate code in either LilyPond or ABC.

Each note is made of one to three parts:
 * 1) Note head: All notes have a note head, a circular mark like a dot. Notes heads show the pitch of the note.
 * 2) Stem: Most notes have stems, they are the vertical lines connected to the notes head(s). Multiple note heads on one stem are a "chord".
 * 3) Flag: Some notes have flags, short diagonal "tails" at the end of the stem opposite to the note head. Flags show the duration of a note. Two or more notes with flags next to each other are often connected together; these connections are called "beams".

Notes are written in "bars" on a "stave" (or "staff"). A stave starts with a "clef" and will usually have five lines. A bar is a section of the stave, representing a period of time, marked by vertical lines called "bar lines".

Knowing the pitch and duration of notes is important. The pitch is shown by the vertical position of the note head. Each line and each space is a different pitch. Pitches are represented by the first seven letters of the alphabet (A, B, C, D, E, F and G), the next pitch after G is A again and the pattern repeats.



On staves with a treble clef (the first example in the diagram), the bottom line is E. The space above is F and the line above that is G; and so on until the top line, which is F. Common mnemonics that can help you to remember these are "Every Good Boy Deserves Favours" (for the pitches on the lines) and "FACE in the space" (for the pitches on the spaces between lines).

On staves with a bass clef (the second example in the diagram), the pitches are two lower than with a treble clef. The bottom line is G and the top line is A. Mnemonics that can help you to remember these are "Good Boys Deserve Favours Always" (for the pitches on the lines) and "Any Cow Eats Grass" (for the pitches on the spaces).

The duration of the note is shown by its appearance.

For more complicated symbols, please refer to List of musical symbols on Wikipedia and the Wikisource help page Help:List of musical symbols.

It may also help to read parts of Music Theory on Wikibooks, especially the page "How to read Music".

General notes on writing with Score
Score ignores excess white space, which can be useful when writing music just as it is with writing computer code. The following is perfectly functional code: However, with long pieces, it can be hard to read for anyone attempting to edit it (even for the original user). Pipes can be entered to indicate separate bars, for example: This is a little better because a user who has noticed a mistake in the third bar can more easily find the code the corresponds to that bar.

To make it even clearer, white space (including line feeds/carriage returns) can be used to break up the code into easily legible sections. For example: Indenting sections helps show where sections begin and end, and what those sections contain.

Maintenance templates
Pages with missing scores can be tagged with the missing score maintenance template. This will add the page to the Texts with missing musical scores‎ tracking category.
 * Missing score

LilyPond

 * See also: Help:LilyPond

Basic LilyPond notation
All notations must open and close with the score tags, e.g. 

When writing in LilyPond, "commands" start with a backslash and "expressions" are containing in curly brackets. All notations must be contained in a single musical expression. A command followed by an expression counts as a single musical expression.

For example,  and   are commands;   is a musical expression.

"Relative mode" is the simplest way to write in LilyPond notation. In this mode notes are assumed to be the closest pitch to the previous note. Absolute notes can be entered instead. The command  will start in Bass C (C3, small octave).

The code so far, using relative mode and Bass C but no notes as yet, will appear as:

Notes can be entered as the appropriate letters, separated by spaces. LilyPond is whitespace insensitive, so it does not matter how much space is put between any element. Notes can be separated into different lines or follow each other in unbroken sequence without causing any difference.

Notes can be raised an octave by adding an apostrophe after the letter, raised two octaves by adding two apostrophes, and so forth. Similarly, notes can be lowered octaves by adding commas after the letter in the same way. This applies to the note used in relative mode as well:  is Middle C,   is Treble C,   is Low C, etc.

The duration of notes can be specified by adding a number after the letter: 1 2 4 8 or 16. The default is 4. All subsequent notes will repeat the duration of the previous note until a new duration is specified. If raising or lowering a note as well as changing the duration, the number follows the apostrophe or comma.

For example:

Lyrics
Song lyrics can be added directly to a score. They are held in a separate expression and have their own code for certain situations.

The expression for lyrics, which should be added between the same  tags, is. The whole score will appear something like:

The words of the lyrics should be places in the expression following the addlyrics command. Each syllable should be separated by a space. LilyPond will automatically assign each syllable to a different note.

Example:

The assignment of syllables to notes can be altered by code based on underscores. Multiple syllables can be aligned to the same note by connecting the syllables with underscores. Alternatively, one syllable can be aligned to multiple notes by using underscores instead of subsequent syllables (which would otherwise be assigned to those notes instead). Extender lines can be created with a double underscore (with space either side of it).

Where a word is split into syllables this is indicated with hyphens between the syllables. Hyphens can be created with a double dash in the lyrics (with spaces on either side).

ABC notation

 * See also: Help:ABC notation

The Score extension also supports ABC. This was originally designed for monophonic Western folk music, although it can be used to typeset pretty complex stuff. It's simpler to learn than LilyPond.

Here's an example of ABC notation in wiki markup "" This produces

Header lines
Pieces in ABC notation start with header lines that either provides information or can affect the way the score is displayed. Each one is a capital letter, followed by a colon and the appropriate value.

For example, L is the header line for default note length. The following sets the note length for a piece at a crotchet or quarter-length note:

Audible output
As well as simply allowing Wikisource users to write in musical notation, the Score extension can generate a MIDI file from the score notation and even turn this into audio that you can play on the page.

Clicking the image generated by the Score extension offers links to download the LilyPond and generated MIDI files. To enable audio playing, add  (replaces the deprecated   attribute) to the opening   tag. The extension creates a JavaScript control module below the image of the score, which can stream the generated audio file; you can play and pause and adjust the volume of the audio.

Example:

Additionally, you could override the MIDI and Ogg Vorbis files. With additional attributes, the Score extension can instead use a MIDI or Ogg Vorbis file uploaded to Wikisource or Wikimedia Commons (in the File: namespace as normal).
 * The override_ attributes are deprecated, see mw:Project:Tech News/2019. Instead you can provide wikilinks to these media files.

Examples:

Merging multiple parts of score-based music from Page namespace

 * See: Template:Tscore

LilyPond

 * LilyPond homepage
 * LilyPond Manual
 * Simple notation
 * Cheat Sheet
 * LilyPond Glossary
 * Integrating text and music
 * LilyPond wiki
 * LilyPond Quick Guide


 * Help:Score on English Wikipedia has more examples of entering LilyPond syntax in the  element.

ABC

 * ABC notation homepage
 * ABC tutorial by Steve Mansfield
 * ABC Primer by John Chambers