For faster navigation, this Iframe is preloading the Wikiwand page for 帮助:乐谱.

帮助:乐谱

标签<score>...</score>可以生成乐谱(五线谱)。默认使用GNU LilyPond标记语言,也可以用ABC记谱法。详见Extension:Score

本文就LilyPond的语法作简单说明,关于LilyPond的语法细节,参见LilyPond文档。语法错误的文档被归类在Category:有乐谱生成错误的页面

标签属性[编辑]

属性 描述
lang="ABC" 使用ABC记谱法
lang="lilypond" 使用LilyPond(默认)
midi="1" 在曲谱图片上生成链接,链接至其自动生成的MIDI文件
vorbis="1" 在曲谱下方生成播放器,播放自动生成的Ogg Vorbis文件
raw="1" 作为完整的LilyPond文件编译(要求lang属性为lilypond)
override_midi="…" 在曲谱图片上生成链接,链接至指定的MIDI文件
override_ogg="…" 在曲谱下方生成播放器,播放指定的Ogg文件

案例[编辑]

简单

<score>
{c' d' e' f' f' fes' eis' e'}
</score>

生成


{c' d' e' f' f' fes' eis' e'}


略复杂

<score>
  \transpose c g \relative c' {
  \key c \minor
  \time 4/4
    c4 e8 e g4 g              % 百分比号后是注释
    <c es g>2 <c es g>        % 单书名号生成和弦
    es4 d( ces b)             % 括号生成连结线
    a4. r8 a4 a               % r 代表休止
    e-- e-> e-. g\fermata     % 重音和其他音乐符号
    \bar "|."
  }
</score>

生成


  \transpose c g \relative c'{
  \key c \minor
  \time 4/4
    c4 e8 e g4 g          % (text after the % is just a comment)
    <c es g>2 <c es g>    % angle brackets create chords
    es4 d( ces b)         % parentheses create ties
    a4. r8 a4 a           % r creates rests
    e-- e-> e-. g\fermata % accents and other signs
    \bar "|."
  }
% This is just a comment line

语法[编辑]

LilyPond代码派生自LaTeX,大小写敏感,无视连续空格和换行。代码必须用<score>...</score>围起来。音符必须放在大括号里面 {...}。百分比号 % 后的代码视为注释

音高

输入字母音名来表示音高(如a b c ),中间用空格隔开。
后缀 -is表示升半音(aisbiscisdiseisfisgis)。
后缀 -es表示降半音 (aesbescesdeseesfesges)。

所有音符默认是在中央C向下一个八度中英语Helmholtz pitch notation。如c 会生成

\new Staff \with { \remove "Time_signature_engraver" }{c}

\new Staff \with { \remove "Time_signature_engraver" }{\clef bass c}

。 上撇号(')用来升八度,逗号(,)用来降八度。如中央C的表示方法是c'

\new Staff \with { \remove "Time_signature_engraver" }{ c'}

 <score>
  {
   a,, c, e, a,
   c e a c'
   e' a' c'' e''
   a'' c''' e''' g'''
   \bar "||"
   aes'' bes'' gis'' dis''
  }
 </score>

 {a,, c, e, a, c e a c' %Middle C
  e' a' c'' e'' a'' c''' e''' g''' \bar "||" aes'' bes'' gis'' dis''}

用相对音高可以减轻工作量。在大括号前加上\relative进入相对音高模式,根据前一个音符来推算八度。全谱第一个音符的八度则从\relative 标签后的标识音推算。如 \relative c

相对音高模式计算八度时,默认视为前音符上下三度的内的八度(不计算半音),并使用 ', 来跨八度。

 <score>
 \relative c' {
  e f <c e g>2
  a'4( b c) c,
  d8 e f16 g a b
  c4. a8 e' f g, f r \autoBeamOff e d c
  b4 a g b-> c2.-> r4
  \bar "|."
  }
 </score>

 \relative c' {
  e f <c e g>2
  a'4( b c) c,
  d8 e f16 g a b
  c4. a8 e' f g, f r \autoBeamOff e d c
  b4 a g b-> c2.-> r4
  \bar "|."
  }

注明音调

乐谱默认为C大调。用\key g \major\key c \minor或直接写上调式\key c \dorian\key c \mixolydian来转调。任何地方都可以转调。

需要注意一点,调式与音高无关。转调只会影响变音记号的显示,不会改变音高。在转调的音高上的每一个音符仍必须用 (-is) 和 (-es) 来表示半音升降。如果不写,会被当成还原音。举一个升C大调上的例子:

<score>
 \relative c' {
   \key cis \major
   \time 6/8

% -is 后缀代表升半音
   cis8 dis eis fis gis ais

% 不带后缀代表还原音
   b c d e f g
  }
</score>

 \relative c' {
   \key cis \major
   \time 6/8
% Notes with -is suffixes indicating sharps
   cis8 dis eis fis gis ais
% Notes without accidentals (naturals)
   b c d e f g
  }

节奏

字母音名后的数字代表音符时值,中间不加空格 (a4 b8)。1代表全音符,2代表二分音符,4是四分音符,8是八分音符,以此类推。如果不写明时值,默认用和前一个音符一样的时值。如果前面没有音符,则默认为4分音符。

字母 r 代表休止符。小数点代表附点(将音符时值延长一半) (c4.)。

 <score>
   \relative c''{b1 b2 b4 b8 c r4 b4. b}
 </score>

\relative c''{b1 b2 b4 b8 c r4 b4. b}

拍号

乐谱默认拍号是4/4拍。 用 \time 命令来设定其他的拍号。 若要设置成二二拍,输入\time 2/2,三四拍(华尔兹节奏)则输入\time 3/4。大多数时候拍号可以随便改。

隐藏拍号

有些音乐的谱例中,拍号可能多余。输入\remove "Time_signature_engraver" 隐藏拍号。

<score>
{
  \new Staff \with { \remove "Time_signature_engraver" }
  <d' fis' a'>2
}
</score>
{ \new Staff \with { \remove "Time_signature_engraver" } <d' fis' a'>2 }

速度

如果需要用vorbis = "1"等属性来提供试听功能,则需要定义乐曲速度。使用\tempo来定义速度。\tempo 4= 135定义为每分钟135个四分音符,每分钟播放音符越多,乐曲速度越快。乐曲中间可以改变速度。

试听不同速度的欢乐颂。

<score vorbis="1">
\relative c' {
  \tempo 4 = 70
  e4 e f g g f e d
  \tempo 4 = 160
   c c d e d4. c8 c2
}
</score>
 \relative c'  {  \tempo 4 = 70  e4 e f g g f e d   \tempo 4 = 160  c c d e d4. c8 c2 }

弱起小节

\partial 4会生成一个包括一个四分音符的弱起小节。\partial 4*2 会生成一个包括两个四分音符的弱起小节。以此类推。Help:乐谱#添加歌词里有一个例子。

自定义符杆


\relative c'' {
   \time 3/4
   r4. g8 a8 b8
}

程序会自动生成符杠。如果觉得自动生成的符杠不好看或者不想要,可以把\noBeam放在被划杠的音符中间来删除,如g a b \noBeam g。若要在一段区间内完全关闭自动划杠,用\autoBeamOff\autoBeamOn 开关。

<score>
  \relative c'' {
     \time 3/4
     r4. g8 \noBeam a8 b8
  }
</score>

\relative c'' {
   \time 3/4
   r4. g8 \noBeam a8 b8
}

若要手动划杠,在符杠开始和结束的音符输入一对方括号。a8 b[ c d e] f这样把最先和最后的两个音符撇开,b、c、 d和e划成一杠。

 \relative c''{a8 b[ c d e] f}

添加歌词

\addlyrics可以添加歌词。读LilyPond文档详细了解歌词的对齐方式。

<score>
  \relative g' {
    \key g \major \time 3/4
    \partial 4 d
     e d g
     fis2 d4
     e d a'
     g2 d4
     d' b g
     fis e c'
     b g a
     g2 \fermata
     \bar "|."
   }
   \addlyrics {
     祝你 生 日 快 乐
     祝你 生 日 快 乐
     祝你 生 日 快 乐 -
     祝你 生 日 快 乐
   }
  </score>

  \relative g' {
    \key g \major \time 3/4
    \partial 4 d
     e d g
     fis2 d4
     e d a'
     g2 d4
     d' b g
     fis e c'
     b g a
     g2 \fermata
     \bar "|."
   }
   \addlyrics {
     祝你 生 日 快 乐
     祝你 生 日 快 乐
     祝你 生 日 快 乐 -
     祝你 生 日 快 乐
   }

对齐中文歌词比英文略简单。因为中文一个字符对应一个音节,所以一般用空格将每个字隔开即可,不需要用到--来连接单词。_用来跳过一个音符。

和弦名

和弦名可以加在单独的ChordNames谱中,附在五线谱边(上述至此讲的都是五线谱),方法如下:

<score>
<<
  \new ChordNames \chordmode {
    \set chordChanges = ##t       % 设置只在和弦变化时显示(本例中为不重复显示Am)
    a4:m a4:m         |                         % 第一小节 - A7的话是 a:7
    g2                       |                          % 第二小节
  }
  \new Staff \relative c''{
    \key a \dorian
    \time 2/4
    a8 a16 a a8 a16 a |   % 第一小节
    b8 a g4           |           % 第二小节
  }
>>
</score>

<<
\new ChordNames \chordmode {
  \set chordChanges = ##t
  a4:m a4:m         |% measure 1
  g2                |% measure 2
}
\new Staff \relative c''{
  \key a \dorian
  \time 2/4
  a8 a16 a a8 a16 a |% measure 1
  b8 a g4           |% measure 2
}
>>

注: 在ChordNames谱中可以用字母 s 而不是 r (休止符)表示没有和弦。

r 会把“没有和弦”直接

<<\new ChordNames \chordmode {r2} \new Staff \with { \remove "Time_signature_engraver" } \relative c''{c}>>

写出来。而 s 只空出和弦名,不会显示。

在五线谱中用 s 表示一个不印刷的休止符。

强调和其他符号

LilyPond中还能用各种符号,如\fermata (自由延长符号)。还有 {e-> f-- g-+ a-. b-^ c-_ d-|}等。^-_表示符号的位置,后面直接输入要标注的文字。

<score>
  \relative c' {
  e-> f-- g-^ a-.
  b_"Joyfully" c^"渐强" d-! e\fermata
  }
</score>

生成


  \relative c' {
  e-> f-- g-^ a-.
  b_"Joyfully" c^"渐强" d-! e\fermata
  }

简谱用户[编辑]

维基媒体不直接支持用代码显示简谱,但是针对习惯写简谱的编辑使用本标签,可以利用以下几个技巧。

首调唱名

对于习惯使用首调而不是固定调的编辑,写移调后的乐谱可能遇到困难。如E大调中的七个音符需要写成e fis gis a b cis dis e,必须正确地写上固定调中变化半音的后缀-is-es,否则会被当成还原音。

\transpose可以减轻工作量。\transpose本为直接移调,利用这个语法可以在没有变化音的C大调上写上首调,再转到其他调上。如

<score>
\relative e' {
   \key e \major     
  e fis gis a b cis dis e   %固定调写法
}
</score>
<score>
\transpose c e {   %将C调转为E调,显示效果与固定调写法相同
  \relative c' {
     \key c \major     
     c d e f g a b c 
  }                                 
}
</score>

生成


\relative e' {
   \key e \major     
  e fis gis a b cis dis e   %固定调写法
}

\transpose c e {   %将C调转为E调,显示效果与固定调写法相同
  \relative c' {
     \key c \major     
     c d e f g a b c 
  }                                 
}


参见[编辑]

{{bottomLinkPreText}} {{bottomLinkText}}
帮助:乐谱
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?