Moving dynamics horizontally: Difference between revisions
Appearance
m Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series |
m New category |
||
| (One intermediate revision by the same user not shown) | |||
| Line 28: | Line 28: | ||
[[Category:Tweaks and overrides]] | [[Category:Tweaks and overrides]] | ||
[[Category:Workaround]] | [[Category:Workaround]] | ||
[[Category:Snippet]] | |||
Latest revision as of 23:31, 21 November 2025
Here are two functions to move dynamics easily. The first one moves the dynamics horizontally and drops / raises it closer to the staff if there's room. With the second one you can move the dynamics also vertically.
\version "2.24"
%% http://lsr.di.unimi.it/LSR/Item?id=469
%LSR This snippet was contributed by Risto Vääräniemi
dynamicsX =
#(define-music-function (offset)(number?)
#{
\once \override DynamicText.X-offset = $offset
\once \override DynamicLineSpanner.Y-offset = #0
#})
dynamicsXY =
#(define-music-function (offsetX offsetY)(number? number?)
#{
\once \override DynamicText.X-offset = $offsetX
\once \override DynamicLineSpanner.Y-offset = $offsetY
#})
{
b'2\f \dynamicsX #-3 b'2\f \dynamicsXY #-3 #-6 b'2\f
}