如何只用「純文字」,隨時隨地打出漂亮的五線譜?(LilyPond)
跳至導覽
跳至搜尋
這是好和弦的第 208 集,首播日期為 2019 年 2 月 23 日。
在這一集 Wiwi 介紹了樂譜軟體──LilyPond。
目錄
YouTube 影片
主題時間表 | |
---|---|
主題 | 時間 |
LilyPond 簡介 | 1m1s |
開始使用 LilyPond | 1m41s |
基本語法 | 2m32s |
其他輔助軟體 | 5m27s |
LilyPond 存在的意義與優點 | 6m11s |
摘要
輸入
- LilyPond 的表示式皆須包含在大括號
{}
中。 - 區分大小寫,例如:
{c d e}
是有效的;{C D E}
是錯誤的。 - 多餘的空格、換行或是 tab 皆會忽略,以下兩者視為相同:
{c d e} {c d e}
增加空格無關緊要,但缺少空格可能會導致錯誤,建議在每個語法元素前後插入空格。
- 註解/註釋
- 單行註解:輸入
%
並在後方輸入註解,輸入的內容不會被編譯。 - 多行註解:輸入
%{ %}
並在括號內輸入註解。
- 單行註解:輸入
代碼 | 結果 |
---|---|
{ c d e f %單行註解 g a b c } |
<score>
{ c d e f %單行註解 g a b c } </score> |
{ c d e f %{ 多行註解 多行註解 多行註解 多行註解 %} g a b c } |
<score>
{ c d e f %{ 多行註解 多行註解 多行註解 多行註解 %} g a b c } </score> |
音符
輸入音符
- 在
{}
中輸入小寫的音名(c d e f g a b
)以輸入音符,以r
代表休止符。 - 每個音之間以空格分開。
代碼 | 結果 |
---|---|
{c d e f g a b c} |
<score>
{c d e f g a b c} </score> |
{c r c r} |
<score>
{c r c r} </score> |
音高
- 若無指定八度,音域預設為 C3-B3。
- 在音名後加上
'
以高一個八度,加上,
以低一個八度。- 多次使用以上符號可以改變超過一個八度。
代碼 | 結果 |
---|---|
{ c' d' e' f' g' a' b' c'' c, d, e, f, g, a, b, c,, } |
<score>
{ c' d' e' f' g' a' b' c c, d, e, f, g, a, b, c,, } </score> |
- 在前面加上
\relative
以進入相對模式。在相對模式中,每個音預設會被當成最靠近前一個音的八度。也可在\relative
後方指定起始參考音。
代碼 | 結果 |
---|---|
\relative { c' d e f g a b c c, d e f g a b c } |
<score>
\relative { c' d e f g a b c c, d e f g a b c } </score> |
\relative c' { c d e f g a b c c, d e f g a b c } |
<score>
\relative c' { c d e f g a b c c, d e f g a b c } </score> |
音符時值(節奏)
- 在音名後面輸入數字以指定音符時值(預設為四分音符),沒有輸入則視為與前一個音相同。
1
表示全音符,2
表示二分音符,4
表示四分音符,以此類推。- 以
.
表示附點,附點的時值必須完整標明。
代碼 | 結果 |
---|---|
\relative c' { c8 c c c c4 c c4. c8 r4. r8 } |
<score>
\relative c' { c8 c c c c4 c c4. c8 r4. r8 } </score> |
\relative c' { c4 c c4. c8 } |
<score>
\relative c' { c4 c c4. c8 } </score> |
\relative c' { c4 c c. c8 } |
錯誤用法,無法編譯。 |
升降記號
- 在前面加上
\language "語言"
以指定語言。 - 升降記號的表示方式取決於檔案中指定的語言。
- 在預設的荷蘭語模式下,在音名後加入
is
表示升記號,es
表示降記號。 - 在英語模式下,在音名後加入
s
表示升記號,f
表示降記號。 - 重升、重降都是將對應的升降號重覆兩次而成。
- 在預設的荷蘭語模式下,在音名後加入
代碼 | 結果 |
---|---|
\relative c' { c cis d des c cisis d deses } |
<score>
\relative c' { c cis d des c cisis d deses } </score> |
\language "english" \relative c' { c cs d df c css d dff } |
<score note-language="english">
\relative c' { c cs d df c css d dff } </score> |
拍號
- 輸入
\time
指定拍號,預設為四四拍。- 4/4 為四四拍 6/8 為六八拍,以此類推。
- 四四拍和二二拍預設使用「𝄴」和「𝄵」符號,若想使用數字須加上
\numericTimeSignature
(使用\defaultTimeSignature
恢復預設)。
代碼 | 結果 |
---|---|
\relative c' { \time 3/4 c c c \time 6/8 c4. c \time 4/4 c4 c c c } |
<score>
\relative c' { \time 3/4 c c c \time 6/8 c4. c \time 4/4 c4 c c c } </score> |
\relative c' { \numericTimeSignature c1 \time 2/2 c \defaultTimeSignature \time 4/4 c \time 2/2 c } |
<score>
\relative c' { \numericTimeSignature c1 \time 2/2 c \defaultTimeSignature \time 4/4 c \time 2/2 c } </score> |
速度標記
- 輸入
\tempo
指定速度,共三種用法。\tempo "任意文字"
\tempo 音符時值 = 速度(BPM)
\tempo "任意文字" 音符時值 = 速度(BPM)
代碼 | 結果 |
---|---|
\relative c' { \time 3/4 \tempo "Andante" c4 c c \time 6/8 \tempo 4. = 96 c4. c \time 4/4 \tempo "NiceChord" 4 = 120 c4 c c c } |
<score>
\relative c' { \time 3/4 \tempo "Andante" c4 c c \time 6/8 \tempo 4. = 96 c4. c \time 4/4 \tempo "NiceChord" 4 = 120 c4 c c c } </score> |
譜號
- 輸入
\clef
指定譜號,預設為高音譜號。- 高音譜號:
\clef "treble"
- 中音譜號:
\clef "alto"
- 次中音譜號:
\clef "tenor"
- 低音譜號:
\clef "bass"
- 高音譜號:
代碼 | 結果 |
---|---|
\relative c' { \clef "treble" c1 \clef "alto" c1 \clef "tenor" c1 \clef "bass" c1 } |
<score>
\relative c' { \clef "treble" c1 \clef "alto" c1 \clef "tenor" c1 \clef "bass" c1 } </score> |
例如可以用下面的代碼打出《生日快樂歌》:
\relative c'' { \time 3/4 \partial 4 g8 g | a4 g c | b2 g8 g | a4 g d' | c2 g8 g g'4 e c | b a\fermata f'8 f | e4 c d | c2. \bar "|." }
彩蛋及其他
一邊……一邊聽
這次的大包裝 MP3 版可以一邊「追垃圾車」一邊聽。