Add user-definable ottavation markups (issue 568970043 by lilypond@maltemeyn.de)

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Add user-definable ottavation markups (issue 568970043 by lilypond@maltemeyn.de)

Malte Meyn-3
Reviewers: ,


https://codereview.appspot.com/568970043/diff/551000043/scm/define-music-callbacks.scm
File scm/define-music-callbacks.scm (right):

https://codereview.appspot.com/568970043/diff/551000043/scm/define-music-callbacks.scm#newcode87
scm/define-music-callbacks.scm:87: (ly:warning "Could not find
ottavation markup for ~a octaves up." octavation))
Has this to be made translatable? If so, how? I didn’t really understand
the CG here. IIUC, I just could write (ly:warning (_ "Could not find …
~a octaves up") octavation) but that might be wrong. Would I have to add
translations or translation placeholders?

Description:
Add user-definable ottavation markups

The context property ottavationMarkups is an alist containing markups
for different octaves. Entries 22ma, 29ma, 22mb, and 29mb were added.

There is a warning when \ottava uses a number of octaves that has no
corresponding markup (alist entry).

Contains regtest

Please review this at https://codereview.appspot.com/568970043/

Affected files (+49, -7 lines):
   A input/regression/ottavation-markups.ly
   M ly/engraver-init.ly
   M scm/define-context-properties.scm
   M scm/define-music-callbacks.scm


Index: input/regression/ottavation-markups.ly
diff --git a/input/regression/ottavation-markups.ly  
b/input/regression/ottavation-markups.ly
new file mode 100644
index  
0000000000000000000000000000000000000000..ae7e60710e3ee5ed9eaf343e237d0da3dac72a12
--- /dev/null
+++ b/input/regression/ottavation-markups.ly
@@ -0,0 +1,30 @@
+\version "2.21.0"
+
+\header {
+  texidoc = "Ottavation markups can be changed by the user.
+LilyPond warns about missing markups (in this example for
++3 and -3 octaves)."
+}
+
+{
+  \set Staff.ottavationMarkups =
+  #`(( 2 . ,#{ \markup \concat \general-align #Y #UP { "16" \teeny "ma" }  
#})
+     ( 1 . ,#{ \markup \concat \general-align #Y #UP { "8" \teeny "va" }  
#})
+     (-1 . ,#{ \markup \concat { "8" \teeny "va bassa" } #})
+     (-2 . ,#{ \markup \concat { "16" \teeny "ma bassa" } #}))
+  c''4 4 4 4
+  \ottava 1
+  c'''4 4 4 4
+  \ottava 2
+  c''''4 4 4 4
+  \ottava 3
+  c'''''4 4 4 4
+  \ottava -1
+  c'4 4 4 4
+  \ottava -2
+  c4 4 4 4
+  \ottava -3
+  c,4 4 4 4
+  \ottava 0
+  c''4 4 4 4
+}
Index: ly/engraver-init.ly
diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly
index  
52bf183bbc2a48e24d43961f9a8f803285f6879a..a6c50d703e9bc881687366c4d52ec66e012d5fc3  
100644
--- a/ly/engraver-init.ly
+++ b/ly/engraver-init.ly
@@ -104,6 +104,15 @@
    \description "Handles clefs, bar lines, keys, accidentals.  It can  
contain
  @code{Voice} contexts."

+  ottavationMarkups =
+  #'((4 . "29ma")
+     (3 . "22ma")
+     (2 . "15ma")
+     (1 . "8va")
+     (-1 . "8vb")
+     (-2 . "15mb")
+     (-3 . "22mb")
+     (-4 . "29mb"))
  }

  \context {
Index: scm/define-context-properties.scm
diff --git a/scm/define-context-properties.scm  
b/scm/define-context-properties.scm
index  
a5fe725a4136f2f70dcf71b2bf9ca92cfd7cd8b7..120e260e9fbeced8f1a1a07778b15efb5dac5c58  
100644
--- a/scm/define-context-properties.scm
+++ b/scm/define-context-properties.scm
@@ -498,6 +498,9 @@ any effect the note would have had on accidentals in  
other voices.")

       (ottavation ,markup? "If set, the text for an ottava spanner.
  Changing this creates a new text spanner.")
+     (ottavationMarkups ,list? "An alist defining the markups used
+for ottava brackets. It contains entrys of the form
+@code{(@var{number of octaves} . @var{markup})}.")
       (output ,ly:music-output? "The output produced by a score-level
  translator during music interpretation.")

Index: scm/define-music-callbacks.scm
diff --git a/scm/define-music-callbacks.scm b/scm/define-music-callbacks.scm
index  
459cb2cdf34bd1725a67b702875ceb0c74c03a0f..be0810ae50473006d072d2be4de063019d8d8582  
100644
--- a/scm/define-music-callbacks.scm
+++ b/scm/define-music-callbacks.scm
@@ -77,14 +77,14 @@ to be used by the sequential-iterator"
      (list (context-spec-music
             (make-apply-context
              (lambda (context)
-              (let ((offset (* -7 octavation))
-                    (string (assoc-get octavation '((2 . "15ma")
-                                                    (1 . "8va")
-                                                    (0 . #f)
-                                                    (-1 . "8vb")
-                                                    (-2 . "15mb")))))
+              (let* ((offset (* -7 octavation))
+                     (markups (ly:context-property  
context 'ottavationMarkups))
+                     (ottavation-markup (assoc-get octavation markups)))
                  (set! (ly:context-property context 'middleCOffset) offset)
-                (set! (ly:context-property context 'ottavation) string)
+                (set! (ly:context-property context 'ottavation)  
ottavation-markup)
+                (if (and (not (zero? octavation))
+                         (not (markup? ottavation-markup)))
+                    (ly:warning "Could not find ottavation markup for ~a  
octaves up." octavation))
                  (ly:set-middle-C! context))))
             'Staff))))



_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Add user-definable ottavation markups (issue 568970043 by lilypond@maltemeyn.de)

Malte Meyn-3

https://codereview.appspot.com/568970043/diff/551000043/ly/engraver-init.ly
File ly/engraver-init.ly (right):

https://codereview.appspot.com/568970043/diff/551000043/ly/engraver-init.ly#newcode107
ly/engraver-init.ly:107: ottavationMarkups =
Should we change the defaults to something more beautiful? I’d vote for
sub/superscript va/vb or numbers only.

https://codereview.appspot.com/568970043/
_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Add user-definable ottavation markups (issue 568970043 by lilypond@maltemeyn.de)

Kieren MacMillan
Hi all,

> https://codereview.appspot.com/568970043/diff/551000043/ly/engraver-init.ly#newcode107
> ly/engraver-init.ly:107: ottavationMarkups =
> Should we change the defaults to something more beautiful? I’d vote for
> sub/superscript va/vb or numbers only.

+1

I’m happy to submit a [regular markup] version for consideration, if OP doesn’t want to do that.

Cheers,
Kieren.
________________________________

Kieren MacMillan, composer (he/him/his)
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Add user-definable ottavation markups (issue 568970043 by lilypond@maltemeyn.de)

Malte Meyn-3
In reply to this post by Malte Meyn-3
On 2019/09/30 20:00:29, kieren_macmillan_sympatico.ca wrote:
> I’m happy to submit a [regular markup] version for consideration, if
OP doesn’t
> want to do that.

After playing a bit with font sizes I think I found a good solution
(sub/superscript aligned with general-align, font-size -2). I’ll upload
it soon but first I have to fix a regression (ambitus-ottava.ly).

https://codereview.appspot.com/568970043/
_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Add user-definable ottavation markups (issue 568970043 by lilypond@maltemeyn.de)

Malte Meyn-3
In reply to this post by Malte Meyn-3
On 2019/10/02 08:23:53, Malte Meyn wrote:
> change default again (to simple numbers, bold series)

There are now three predefined options: #ottava-numbers (default),
#ottava-ordinals (might be wanted as an alternative by many),
#ottava-simple-ordinals (for those who don’t like change).

Documentation of all ottava changes (5559, 5563, and vertical alignment)
will follow with the last of these.

https://codereview.appspot.com/568970043/
_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Add user-definable ottavation markups (issue 568970043 by lilypond@maltemeyn.de)

Malte Meyn-3
In reply to this post by Malte Meyn-3

https://codereview.appspot.com/568970043/diff/547000043/scm/translation-functions.scm
File scm/translation-functions.scm (right):

https://codereview.appspot.com/568970043/diff/547000043/scm/translation-functions.scm#newcode909
scm/translation-functions.scm:909: (3 . "22")
I’ll correct this indentation with the next patch set (if there is none,
before pushing to staging).

https://codereview.appspot.com/568970043/
_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Add user-definable ottavation markups (issue 568970043 by lilypond@maltemeyn.de)

Malte Meyn-3
In reply to this post by Malte Meyn-3
On 2019/10/02 11:11:25, Malte Meyn wrote:
> make bassa ordinals end on va/ma

Not for #ottava-simple-ordinals for compatibility reasons. But who wants
to use that anyway? ;)

https://codereview.appspot.com/568970043/

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel