How to Read the ABC Notation: Pitch and Duration
The ABC notation is a type of notation system.Write musical scores in plain textUsing this method, just a few dozen bytes can describe a melody—whether placed directly in a chat window or within code comments, it remains perfectly organized. It may look daunting, but in reality, its core rules consist of only three:Letters indicate pitch, numbers indicate duration, and vertical bars delimit measures.This page loads the C major scale (do re mi fa sol la si do, then descending), providing the most intuitive example for understanding these three rules—allowing you to simultaneously observe how the pitches rise, how the durations are notated, and how the measures are divided.
Notation using text: letters represent pitch, numbers represent duration; the four lines of header information specify the number, time signature, default duration, and key signature, respectively.
direction for use
File header: Lines K and L are the two most important lines.
The ABC file uses a series ofSingle-letter colonThe section at the beginning of a row is called the information field. The three most critical ones are:X: This refers to the track number (each file may contain multiple tracks; X:1 indicates the first track);K: It indicates the key (K:C denotes C major; K:G denotes G major);L: 是Default note length(L: 1/4 indicates that all notes without a number are quarter notes).M: The time signature is M: 4/4. Both K and L must be specified; otherwise, the parser would not know which key to use or what the default note values should be. In the example, K is set to C and L is set to 1/4, so each subsequent letter represents a quarter note.
Pitch: Uppercase letters represent a lower octave, while lowercase letters represent a higher octave.
ABCneed The seven letters from A to GRepresents pitch names other than do, re, and mi; the octave is based on...Uppercase, lowercase, and symbolsdiscriminate:Uppercase letters (C D E F G A B)It is the octave near the central C;Lowercase letters (c d e f g a b)An octave higher; append a symbol after the lettercomma(C,)Lower by an octave, then addA prime (′)Raise by an octave (can be stacked). Use the altered note for this purpose. ^ indicates increase, _ indicates decrease^F indicates ascending to F; the symbols # and b are also acceptable. In the example, moving from C to c and then back to C completes exactly one octave.
Duration: The number refers to a "multiple," not a "frame count."
This is the point that beginners are most likely to misunderstand.The number following the letter indicates "how many times the default length (L)"., rather than "a few beats." When L = 1/4, C = quarter note and C2 = eighth note.DoubleThat is, a half note at C4 equals a whole note; whereas C/2 denotesa halfThe default duration is an eighth note, while C3/2 denotes a dotted quarter note. Therefore, when you see G2, do not interpret it as "the note G lasts two beats" —it actually indicates "twice the default duration"; the exact number of beats depends on the relationship between L and M. This conversion rule is the most common point of error in ABC notation.
Beam lines and common notation
Vertical bar | Divide measuresThe parser then checks whether the total duration of each measure complies with the time signature; if the time signature is incorrect, notes may appear clustered together or the measure lines may disappear. Other commonly used notations:z is a rest.(z2 denotes a rest of twice the default duration);> and < are shorthand notations for dotted rhythms.G> A indicates that G is elongated and A is shortened;|: and:| is a repeat symbol(The second paragraph in the example uses this);Text enclosed in double quotation marks is a chord symbol., write it before the musical notes. By mastering these skills, you will be able to both read and write the vast majority of monophonic melodies.
frequently asked questions
- Why are these two lines—K: and L:—required?
- K: Determine the key signature - it determines which notes need to be automatically raised or lowered (for example, all F's in K:G are automatically F#), without which the parser cannot determine the pitch.L: Determines the default note length - it determines how many notes a bare letter represents, without which the parser cannot determine duration. Other fields (X, T, M) usually have default values when missing, but these two are required.
- Are the numbers after the letters the number of beats?
- No, it is a multiple of the default length. When L:1/4 (the default quarter note), C is a quarter note, C2 is a half note, C4 is a whole note, C/2 is an eighth note, and C3/2 is a dotted quarter note. The conversion to "several beats" depends on the denominator of the time signature: in 4/4 time, a quarter note is one beat, so C2 is two beats; but if it is 2/2 time (half notes are one beat), C2 is only one beat.
- What happens if I write it wrong?
ABC parserquite tolerant, many errors will not be reported, but will appear as "not looking right": when the total duration of the notes in the bar does not match, the bar line may be ignored or the notes may be squeezed; when K: is omitted, the pitch of the entire section may not be determined. When this tool detects content that cannot be fully parsed, it will prompt "Missing information field" instead of directly displaying a blank spectrum, making it easier for you to locate the problem.
- Can I write multiple songs in one file?
- can。用 X: 行分隔,X:1 是第一首、X:2 是第二首,每首之后重新写 K: 和 L:。这个工具会渲染整个文件的内容(可能连续显示多段乐谱)。另外 T: 是标题字段,可以写中文——ABC 的信息字段支持 Unicode,但音符部分只接受 ASCII。
- 示例里的竖线和反复记号有什么用?
- 竖线 | 只是视觉上的小节分隔,去掉它乐谱照样能解析,但会变得很难读、也无从检查小节时值。反复记号 |: 与 :| 则是真正的指令,表示这一段要重复演奏——播放时合成器会真的重复,渲染时谱面上会出现反复记号。所以前者是"给人和解析器看的分隔",后者是"给演奏者的指令"。