In lilypond I would create a custom note head by doing this:
myGNote = {
\once \override NoteHead #'stencil = #ly:text-interface::print
\once \override NoteHead #'text =
\markup {
\general-align #Y #CENTER {
\epsfile #X #2 #"./g.eps"
}
}
}
{ e'4 f' \myGNote g' }
If I had to do multiple lines it would look something like this
{ e'4 f' \myGNote g' \myGNote g4' \myGNote g8'} etc.
My question is how can I make a global note head that would apply to all g4s etc. This global variable would be for all gs for example and then I could create another one for all c's etc.
Related
I have this basic three-voices snippet.
\score {
<<
\new Staff {
\key a \major \time 3/8
\clef "G_8"
{
<<
{ e'4 r16 cis'' }
\\
{ a,4. }
\\
{ r8 <a cis'> <a cis'> }
>>
}
}
>>
}
The problem that i encounter is that the rest of the third voice (at the 13th line), is rendered on top of all the other notes, which makes unclear what voice it should be part of.
screenshot of the result with the rest on top
What I want to achieve is to get the rest to render between the two notes at the beginning (the A and the E), and I couldn't manage to do it with any of the \stemUp, \stemDown and \stemNeutral commands.
An approach you can take is to use the command \rest, which allows you to specify a 'note position' for the rest. E.g., if you type a'4\rest, you will create a quarter-note rest at the staff position of an A4. In your case, I think a g8\rest works well. I believe this solution is a bit more solid than using offset tweaks, since those are relative to where your rest is and changing the music can change the rest position, while the command \rest creates an absolute position.
\score {
<<
\new Staff {
\key a \major \time 3/8
\clef "G_8"
{
<<
{ e'4 r16 cis'' }
\\
{ a,4. }
\\
{ g8\rest <a cis'> <a cis'> }
>>
}
}
>>
}
Well, I don't have a global answer, but for one rest you could use \tweak:
\version "2.22.2"
\score {
<<
\new Staff {
\key a \major \time 3/8
\clef "G_8"
{
<<
{ e'4 r16 cis'' }
\\
{ a,4. }
\\
{ \tweak Y-offset -1 r8 <a cis'> <a cis'> }
>>
}
}
>>
}
I need several analysis bracket combinations which are rather unusual (at least I didn't find a lot help in the net). First of all I wanted overlapping analysis brackets, which I managed to achieve already. Now, what I also need is "adjacent brackets", meaning that one bracket ends on a note while on the same note another one starts. So in theory I would need this: "g4\stopGroup\startGroup". However, this results in simply one big bracket. Here is my example code, which currently has the problem that the g4 is in both voices and therefore visible twice, while it should only be there once, but both brackets should include it.
\version "2.19.61"
adjtwo = \relative c'' {
s2 g4\startGroup a b c\stopGroup d e
}
adjone = \relative c' {
\once \override HorizontalBracket #'direction = #UP
e\startGroup f g\stopGroup
}
\score {
\new Staff {
<<
\voiceOne \adjone
\voiceThree \adjtwo
>>
}
}
\layout {
\context {
\Voice
\consists "Horizontal_bracket_engraver"
}
}
Thanks for any help
Best regards
Is this what you're looking for?
\version "2.19.61"
\score {
\relative {
\override HorizontalBracket #'direction = #UP
e'\startGroup f g\stopGroup <>\startGroup a
b c\stopGroup d e
}
}
\layout {
\context {
\Voice
\consists "Horizontal_bracket_engraver"
}
}
A work around to make this, is the following:
put \starGroup and \stopGroup where you need. The unique condition is that you can not put a \stopGroup following a \startGroup. You have to put at least 1 note among their. You can put the \stopGroup after the following note, don't worry
fix the position and length of the bracket that are wrong drawn with \once \override HorizontalBracket.shorten-pair = #'(-3.0 . 1.5).
For your example, you can do the following:
adjone = \relative c' {
\once \override HorizontalBracket #'direction = #UP
e \startGroup f g \stopGroup
\once \override HorizontalBracket.shorten-pair = #'(-3.0 . 1.5)
a \startGroup b c \stopGroup d e
}
\score {
\new Staff {
<<
\voiceOne \adjone
>>
}
}
\layout {
\context {
\Voice
\consists "Horizontal_bracket_engraver"
}
}
And you get this score:
(I can not put images embed yet) Here is the link of the image: https://imgur.com/a/H1gN0wE
I'm trying to typeset a short piano piece, 'Nocturne n°5' by John Field. My main problem occurs on bars 14, 17 and 38 where a gruppetto is rendered as a delayed turn with a natural sign.
This is how it looks like in one of the editions you can find on the Internet:
This what I can achieve myself:
This is the code that I have tried:
\version "2.8.12"
upper = \relative c'' {
\key bes \major
\time 12/8
%bar 14
d4.-> c2.
<<
{
c4.( f4. ees4 c8 bes4. c4.
des2.~\sf des4.)
}
\\
{
% we create the following sequence: { r8 d16 c16 b16 c16 }
s8
\single \hideNotes d16
\single \hideNotes c16
\single \hideNotes \once \set suggestAccidentals = ##t
\single \hideNotes \once \override AccidentalSuggestion #'outside-staff-priority = ##f
\single \hideNotes \once \override AccidentalSuggestion #'avoid-slur = #'inside
\single \hideNotes \once \override AccidentalSuggestion #'font-size = #-3
\single \hideNotes \once \override AccidentalSuggestion #'script-priority = #-1
\single \hideNotes b16-\turn
\single \hideNotes c16
% those spaces are to align with the second voice
% kept in the for the duration of the phrasing slur
s2. s2.
s2. s4.
}
>>
}
lower = \relative c {
\key bes \major
\time 12/8
%bar14
e8[( \sustainOn c'8 bes8 g'8 c,8 bes8]
e,8[ g'8 bes,8]
ees,8[ \sustainOn f'8 a,8])
d,8[( \sustainOn f'8 bes,8]
ees,8[ \sustainOff c'8 g8]
f8[ d'8 bes8]
f8[ ees'8 a,8])
}
\score {
\new PianoStaff
<<
\new Staff = "upper" { \clef treble \upper }
\new Staff = "lower" { \clef bass \lower }
>>
\layout { }
}
You'll notice that I chose to create a temporary polyphonic passage and I have a choice to hide either the upper or the lower voice. I have experimented with both but it seems more logical to keep the rendered voice on the upper side and keep the lower voice hidden. However, this make the turn appear on the lower part of the staff.
Edit
I have updated the question with a snippet that should now compile for others to try. My main problem is that the delayed turn happens during a passage that must span a phrasing slur. Since I could not find a way to have a slur span across single-voice and multi-voice passages, I need to keep the polyphonic passage for longer than just the delayed turn part.
How can I improve on the placement of the turn and the accidental.
In your updated example, the problem is different so I'm adding a new answer.
You are using the double backslash construct in the temporary polyphonic passage and the turn displays below the staff. This happens because you never define the voices explicitely. In the Notation Reference 1.5.2:
The << {…} \ {…} >> construct, where the two (or more) expressions
are separated by double backslashes, behaves differently to the
similar construct without the double backslashes: all the expressions
within this construct are assigned to new Voice contexts. These new
Voice contexts are created implicitly..
So LilyPond will assign \voiceOne to the first voice and \voiceTwo to the second voice. In \voiceTwo the \turn and other similar objects are displayed below the staff. I recommend reading Explicitly instantiating voices.
Solution: either remove the \\ or add \voiceThree in the second voice of the temporary polyphonic passage (\voiceOne is implicitely used in the first voice of the passage and if you use it in the second you'll have a collision with the slur; that's why you need \voiceThree).
You shouldn't use the \turn within a \markup block; instead, attach it immediately to the note:
\once \hideNotes b16-\turn
By the way, this is the example in the lilypond documentation.
I could not compile your snippet so I recreated it from scratch (disclaimer: I don't play piano and my musical knowledge is limited) but it looks fine to me:
\version "2.19.40"
global = {
\key bes \major
\numericTimeSignature
\time 12/8
}
right = \relative c'' {
\global
% bar 14
<<
{ d4.-> c2. c4.-2( | }
{
s1 s4
\once \set suggestAccidentals = ##t
\once \override AccidentalSuggestion.outside-staff-priority = ##f
\once \override AccidentalSuggestion.avoid-slur = #'inside
\once \override AccidentalSuggestion.font-size = -3
\once \override AccidentalSuggestion.script-priority = -1
\single \hideNotes
b4-\turn
}
>>
f'4.-5) ees4-3
}
left = \relative c {
\global
% bar 14
e8\sustainOn([ c' bes g' c, bes] e, g' bes, ees,\sustainOn f' a,) |
ees8\sustainOn f' bes,-2 f-5\sustainOff
}
\score {
\new PianoStaff
<<
\new Staff = "right" \right
\new Staff = "left" { \clef bass \left }
>>
\layout { }
}
I often have a string of harmonics, so I decided to use a music function (the function is a tangent; if I place the override directly with the notes I get the same problem. The issue is the override itself):
harmonics =
#(define-music-function
(parser location notes)
(ly:music?)
#{
%\harmonicsOn
\override Staff.NoteHead #'style = #'harmonic-mixed
$notes
\revert Staff.NoteHead #'style
%\harmonicsOff
#}
)
\harmonicsOn and \harmonicsOff works, but they're always hollow notes so I don't want to use them. Overriding the notehead allows me to have solid heads on quarter notes.
My problem is that the note heads are overridden for all notes in the duration, not only the notes supplied to the function (see m. 2, 3 in the image below the following code):
melody = \relative c' { \stemUp
\repeat unfold 4 { r8 b g b e' b, | }
\bar "|."
}
harmony = \relative c' { \stemDown
e,2. |
\harmonics { e } |
\harmonics { e4 e } s |
e2. |
}
\score {
\new Staff {
\time 3/4 \clef "treble_8"
\key g \major
<<
\new Voice { \melody} \new Voice { \harmony}
>>
}
}
I'm looking for a way to modify only the notes I want (in this case, in \harmony), leaving the other notes within that duration untouched.
Edit: I tried with lilypond 2.17 using the new \temporary command, but I get the same result.
Full code | NoteHead Internals Documentation
Your problem is that your function uses the \override command, which affects all simultaneous grobs in a given context, and thus it is changing all noteheads in the Staff context (which contains both melody and harmony music). If you change the noteheads only in the Voice context, then your problem is solved:
harmonics =
#(define-music-function
(parser location notes)
(ly:music?)
#{
%\harmonicsOn
\override Voice.NoteHead #'style = #'harmonic-mixed
$notes
\revert Voice.NoteHead #'style
%\harmonicsOff
#}
)
Why does the last chord in both of the following \score blocks not display the correct note in the bass? In the dyad, the last chord should have D in the bass. In the triad, the last chord should have F in the bass. Instead, both chords are displaying the same as the first chord in their respective \score blocks.
\version "2.14.2"
\book {
\header {
title = \markup \center-column {"Dyad, Triad Permutations"}
arranger = \markup \center-column { "Sean O'Donnell" }
}
\score {
\relative {
<bes d>1
<d bes>
}
}
\score {
\relative {
<bes d f>1
<bes f d>
<d bes f>
<d f bes>
<f bes d>
<f d bes>
}
}
}
You have to specify the octave relative to current notes. You can do so by using the comma (,) (to go lower) and an apostrophe (') (to go higher). So, in the first example, relative to the chord before you need to drop the D down an octave (and then bring the Bb back up). Likewise in the other chord, drop the F and bring the D back up. See the follow code to achieve what you want...
\version "2.14.2"
\book {
\header {
title = \markup \center-column {"Dyad, Triad Permutations"}
arranger = \markup \center-column { "Sean O'Donnell" }
}
\score {
\relative {
<bes d>1
<d, bes'>
}
}
\score {
\relative {
<bes d f>1
<bes f d>
<d bes f>
<d f bes>
<f bes d>
<f, d' bes>
}
}
}
To fully understand how note positioning works in \relative mode, please see the Pitches section of the manual here:
http://lilypond.org/doc/v2.12/Documentation/user/lilypond-learning/Simple-notation#Simple-notation
which states:
The easiest way to enter notes is by using \relative mode. In this
mode, the octave is chosen automatically by assuming the following
note is always to be placed closest to the previous note, i.e., it is
to be placed in the octave which is within three staff spaces of the
previous note.
[...]
By adding (or removing) quotes ' or commas , from the \relative c' {
command, we can change the starting octave
[...]
Relative mode can be confusing initially, but is the easiest way to
enter most melodies.
The manual page also shows code examples of working in \relative mode.