5

I'm on Lilypond 2.20 and trying to write a passage where I have several 8th notes tremolo'd to 16ths, and I'm trying to get them to change staves—but whenever I do, the beams glitch out and can't be placed correctly.

As an example, try running the following code: \autochange { c8:16 c'':16 c:16 c'':16 }

Any idea what I can do about this? Thank you!

1
  • The tremolo is happening at the same time that the beaming is happening. The solution is to create a custom stem with the tremolo symbol (I don't know how to do that.) But it would happen same time stem created. Maybe someone on here maybe able to help, or try User mailing list: [email protected] see lilypond.org/contact.html
    – user70304
    Commented Sep 27, 2020 at 4:55

1 Answer 1

1

Best I can come up with is creating two voices in top staff. First voice has 8th notes, second voice has 1/4 notes in space of 8th notes and they "hold the tremolo sign" Created variables for up and down staff. Two functions for: beam adjustment, and tremolo height. Might need. Very hacky but works.

\version "2.20.0"
beamPos =
#(define-music-function
     (parser location beg-end)
     (pair?)
   #{
     \once \override Beam.positions = #beg-end
   #})

tremPosition =
#(define-music-function
     (parser location y-offset)
     (number?)
   #{
     \once \override StemTremolo.Y-offset = #y-offset
   #})

csu = { \change Staff = "up" \stemDown }
csd = { \change Staff = "down" \stemUp }

up = \relative c {
  %\csd c8 \csu c'' \csd c \csu c''
  << 
    \relative c {
      \csd \beamPos #'(4 . 4) c8 \csu c'' \csd c,, \csu c''
      \csd \beamPos #'(4 . 4) c,,8 \csu c'' \csd c,, \csu c''
    }
    \\
     \relative c {
       \csd  c4 * 1/2:8 \csu c'':8 \csd c,,:8 \csu c'':8
       \csd \tremPosition #3 c,,4 * 1/2:8 \csu \tremPosition #-2 c'':8 \csd \tremPosition #1 c,,:8 \csu \tremPosition #-1 c'':8
     }
  >>
}

down = \relative c' {
  s1 | s1 |
}

\score {
   <<
    \new Staff = "up" \with {
      midiInstrument = "acoustic grand"
    } \up
    \new Staff = "down" \with {
      midiInstrument = "acoustic grand"
    } { \clef bass \down }
  >>
  \layout { }
  \midi { }
}

First shows default output. Second shows altering tremolo signs. Both have beam adjusted. Don't forget spacer rests in down staff to:

keep the staff alive!

enter image description here

3
  • This definitely looks like it works (if it looks like a duck, then it is a duck), but I have like 24 measures of this stuff to work through. Any ideas on how to make it scale faster?
    – DWW256
    Commented Sep 28, 2020 at 6:34
  • If it's all the same then it's the \repeat unfold 24 { stuff to repeat }. Or if some things are the same put in variables mymusicA = { c d e f g} place \mymusicA in main body and mymusicB = { g f e d c} place \mymusicB. Might not be helpful! The code I provide is not ideal from a scalability point of view. Just thought give some solution. May you might find putting variables in as above. Otherwise copy and paste line by line and change as you go. That's what I often do with structures the same and only change by the notes
    – user70304
    Commented Sep 28, 2020 at 9:57
  • Also if using frescobaldi (most do), use the snippets, where you create custom lines of code and double-click or assign to a keyboard shortcut. Can even run python scripts in it (though think it's python 2.x not 3.x)
    – user70304
    Commented Sep 29, 2020 at 2:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.