如何在Lilypond中缩写“具有相同音符的高八度,带括号的音符"? [英] How to abbreviate 'note with the same note an octave higher, parenthesized' in Lilypond?

查看:358
本文介绍了如何在Lilypond中缩写“具有相同音符的高八度,带括号的音符"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我编写的代码这个:

Currently I write lilypond code that looks like this:

\version "2.14.2"

P = #parenthesize

\relative c, {
  \clef bass 
    <c \P c'> <e \P e'> <g \P g'>2 <c, \P c'>4 <d \P d'> <e \P e'>2
}

在这里我反复地指的是'音符,以及同一音符高出八度,并用括号括起来".

where I repeatedly mean 'this note, together with the same note one octave higher, parenthesized'.

我想要一种简化的方式,以便我可以这样写:

I'd like a way to abbreviate this, so that I can write something like this:

\version "2.14.2"

poct = ...

\relative c, {
  \clef bass 
  \poct c \poct e \poct g2 \poct c,4 \poct d \poct e2
}

有关我的早期问题的有用答案中所建议的那样,我尝试使用

As suggested in a helpful answer to an earlier question of mine, I have tried to use a music function, but there is no way I can get this to work. The closest I can get is

poct = #(define-music-function
     (parser location note)
     (ly:music?)
   #{
     << $note \transpose c c \parenthesize $note >>
   #})

但这使用了<< .. >>而不是< .. >,这无法呈现我想要的方式(并带有警告),我也不知道为什么\transpose c c实际上转置任何东西.

but this uses << .. >> instead of < .. >, which does not render the way I want (and with warnings), and I have no idea why the \transpose c c actually transposes anything.

最后,与切向相关,当尝试音乐功能时,我发现甚至不可能创建模仿\repeat unfold 2的音乐功能.下面的代码在第三个c和第四个c之间跳了一个八度:

Finally, tangentially related, when experimenting with music functions I found it even impossible just to create a music function that mimicks \repeat unfold 2; the following jumps down an octave between the third and fourth c:

\version "2.14.2"

double = #(define-music-function
     (parser location note)
     (ly:music?)
   #{
     $note $note
   #})

\relative c, {
  \clef bass 
  \double c \double e \double g2 \double c,4 \double d \double e2
}

推荐答案

好的,这是我为您创建的一个功能,可让您重复单个音高.唯一的问题是它不会使用\relative表示法.这是因为,以相对符号表示,后面的音符c' c' c'序列显然比前一个音符高八度.不幸的是,我仍然找不到能够输出c' c c的函数,例如\function #3 c'的方法.也就是说,这是我的功能和一些示例:

Ok, so here is a function I created for you, which will allow you to repeat single pitches. The only catch is that it won't use the \relative notation. This is because, in relative notation, the following sequence of notes c' c' c' will obviously be one octave higher than the preceding one. Unfortunately I still could not find a way to have a function such as \function #3 c' that would output c' c c. That said, here is my function and some examples:

\version "2.17.28"

times = #(define-music-function
     (parser location N note)
     (integer? ly:music?)
     (cond 
       ((>= N 2)
         #{ \repeat unfold $N { \absolute $note } #}
       )
       ((= N 1) 
         #{ \absolute $note #}
       )
     )
)

{
 a4 \times #3 b4
 R1
 \times #4 { c'8 d' }
 R1
 \times #1 { c''1 }
}

因此语法仅为\times #"number of repetition" { ...music... }.如果只重复一个音符,则可以省略{}:\times #"number of repetition" "single note".

So the syntax is simply \times #"number of repetition" { ...music... }. If only one note is to be repeated, you can omit both { and }: \times #"number of repetition" "single note".

您可以在\relative段落的中间使用此功能,但随后应输入该功能的音高作为绝对音高.看看:

You can use this function in the middle of a \relative passage, but then you should enter the pitches for the function as absolute pitches. Have a look:

\version "2.17.28"

times = #(define-music-function
     (parser location N note)
     (integer? ly:music?)
     (cond 
       ((>= N 2)
         #{ \repeat unfold $N { \absolute $note } #}
       )
       ((= N 1) 
         #{ \absolute $note #}
       )
     )
)

\relative c'' {
  c4 d \times #4 e'' f g
}

请注意,以上所有音符都在相同的八度中.音符f的八度位置也不受此功能的影响,它受该功能之前的音符即d的影响.

Note that all notes above are in the same octave. The octave position the note f is also NOT influenced by this function, it is influenced by the note preceding the function, i.e., the d.

可以肯定的是,有一种方法可以为此编写更好的代码,但是我无法使用任何\relative\transpose命令都无法做到这一点.

For sure there is a way to write a better code for this, but I wasn't able to do the trick with neither any \relative nor \transpose commands.

这是尝试用括号括起来的八度的尝试(上面的功能相同,但有一些小的改动):

And here is some attempt to help you with your parenthesized octave (same function above but with some small alterations):

\version "2.17.28"

timesP = #(define-music-function
     (parser location N note)
     (integer? ly:music?)
     (cond 
       ((>= N 2)
         #{ 
           << 
             \repeat unfold $N { \absolute $note } 
             \transpose c c' \repeat unfold $N { \absolute \parenthesize $note } 
           >>
         #}
       )
       ((= N 1) 
         #{ 
           << 
             \absolute $note 
             { \transpose c c' \parenthesize $note }
           >>
         #}
       )
     )
)

{
 a4 \timesP #3 b4
 \timesP #8 c'16
 \timesP #2 g4
 \timesP #4 { c'8 d' } % no parenthesis here because there are two notes as arguments...
 \timesP #1 { c''1 } % no parenthesis here because of the { }
}

\relative c'' {
  c4 d \timesP #4 e'' f g
}

这里仍然有一些问题:仅当参数是不带{ }编写的单个音符时,此函数才会用括号括起来.上面的代码对此进行了很好的评论.

There are still some catches here: this function will only parenthesize when the argument is a single note written without { }. This is well commented on the code above.

我希望这会对您有所帮助.如果我在这里遇到了八度音调换位问题的解决方案,我将更新此答案.

I hope this will help you somehow. If I come across the solution for the octave transposition problem here, I will update this answer.

这篇关于如何在Lilypond中缩写“具有相同音符的高八度,带括号的音符"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆