Autor Thema: \Tempo 4 = 57 <- die "57" rot färben  (Gelesen 6077 mal)

Bunneh

  • Member
\Tempo 4 = 57 <- die "57" rot färben
« am: Mittwoch, 4. April 2012, 16:33 »
Hallo allerseits!

Ich versuche seit geraumer Zeit, meine Tempo-Angabe rot einzufärben - und zwar nur die Zahl "57", nicht die Beschreibung "Largo" oder das Viertel-Notensymbol.

Das Original:
\tempo "Largo" 4 = 57.

Versuch 1:
\tempo \markup \with-color #red "Largo" 4 = 57 funktioniert, schreibt aber natürlich das "Largo" rot, das "<Viertel> = 57" bleibt schwarz.

Versuch 2:
\tempo  "Largo" \markup \with-color #red 4 = 57 gibt leider einen Fehler.

Wie muss es richtig heißen?

Danke im Voraus und viele Grüße aus Berlin!
Bunneh
« Letzte Änderung: Mittwoch, 4. April 2012, 16:35 von Bunneh »

ding-dong

  • Member
Re: \Tempo 4 = 57 <- die "57" rot färben
« Antwort #1 am: Mittwoch, 4. April 2012, 16:42 »
geht das ?
\tempo \markup { "Largo" 4 = \with-color #red 57 }

Bunneh

  • Member
Re: \Tempo 4 = 57 <- die "57" rot färben
« Antwort #2 am: Mittwoch, 4. April 2012, 23:29 »
es macht schonmal die 57 rot und gibt keinen Fehler :) Und vielen Dank für die schnelle Antwort!

Leider verwandelt es auch die Viertelnote in eine numerische "4".

Hier mal die ganze Datei:
\header {
title = ""
composer = ""
}
dynamics = {  s1 s1 s1 s1 s1 s1  }
\paper {paper-height = 7.9\in paper-width = 6.2\in indent = #0 }
\score {
\new PianoStaff <<
\new Staff {
\time 4/4
 \key c \major \tempo \markup { "Largo" 4 = \with-color #red 57 } a'4 g'4 f'4e'4d'4e'4f'4g'4 \bar "|." }
\new Dynamics = "Dynamics_pf" \dynamics
\new Staff { \clef treble  \key c \major R1R1 \bar "|." }
>>
\midi { }
\layout { }
}

ding-dong

  • Member
Re: \Tempo 4 = 57 <- die "57" rot färben
« Antwort #3 am: Mittwoch, 4. April 2012, 23:56 »
Zitat
Leider verwandelt es auch die Viertelnote in eine numerische "4".

natürlich, im \markup muss man den speziellen \note modus starten, sonst bleibt alles text:

\note #"4" #1 (#1 hat was mit der länge des halses zu tun)

hdh
ding-dong

Bunneh

  • Member
Re: \Tempo 4 = 57 <- die "57" rot färben
« Antwort #4 am: Donnerstag, 14. Juni 2012, 15:54 »
hey,

so sieht es zwar nicht ganz wie im Original aus, funktioniert aber. Tausend Dank!

ding-dong

  • Member
Re: \Tempo 4 = 57 <- die "57" rot färben
« Antwort #5 am: Donnerstag, 14. Juni 2012, 16:00 »
wie sieht denn das original genau aus?  :D

Bunneh

  • Member
Re: \Tempo 4 = 57 <- die "57" rot färben
« Antwort #6 am: Donnerstag, 14. Juni 2012, 16:12 »
Ich habe mal in GIMP die beiden Ergebnisse gegenübergestellt :)


Arnold

  • Member
Re: \Tempo 4 = 57 <- die "57" rot färben
« Antwort #7 am: Donnerstag, 14. Juni 2012, 16:16 »
Noch ein weiteres Problem(chen):

So ist's nur ein Text, der keine Auswirkung auf die MIDI-Ausgabe hat.

1. Lösung:
Zusätzlich noch einmal 4 = 57 angeben, und zuvor tempoHideNote auf ##t setzen.

2. Lösung (für Scheme-Freaks):
Aus der Installationsdatei .../scm/translation-functions.scm die Routinen format-metronome-markup und metronome-markup unter neuem Namen (auch die Namensreferenz zur Unterroutine anpassen!) in eine eigene Datei übernehmen und so anpassen, daß die Zahl rot dargestellt wird.
Und dann noch metronomeMarkFormatter auf die neue Prozedur einstellen.
Ich habe einmal mit dieser Methode das Gleicheitszeichen mit einem Ungefährzeichen (zwei Wellenlinien übereinander) ersetzt.

Arnold

ding-dong

  • Member
Re: \Tempo 4 = 57 <- die "57" rot färben
« Antwort #8 am: Donnerstag, 14. Juni 2012, 17:13 »
@ Bunneh

\tempo \markup {
  "Largo"
  \raise #.5 \note #"4" #1
  "="
  \with-color #red 57
}

usw. - da gibt es noch viele möglichkeiten!

harm6

  • Member
Re: \Tempo 4 = 57 <- die "57" rot färben
« Antwort #9 am: Donnerstag, 14. Juni 2012, 17:44 »
@Arnold:
Vielen Dank für die Idee!

\version "2.14.2"

#(define-public (custom-format-metronome-markup event context)
  (let ((hide-note (ly:context-property context 'tempoHideNote #f))
        (text (ly:event-property event 'text))
        (dur (ly:event-property event 'tempo-unit))
        (count (ly:event-property event 'metronome-count)))

    (custom-metronome-markup text dur count hide-note)))

#(define-public (custom-metronome-markup text dur count hide-note)
  (let* ((note-mark (if (and (not hide-note) (ly:duration? dur))
      (make-smaller-markup
        (make-note-by-number-markup (ly:duration-log dur)
(ly:duration-dot-count dur)
     1))
      #f))
         (count-markup (cond ((number? count)
                              (if (> count 0)
                                 (make-simple-markup (number->string count))
                                 #f))
                             ((pair? count)
                              (make-concat-markup
                                (list
                                   (make-simple-markup (number->string (car count)))
                                   (make-simple-markup " ")
                                   (make-simple-markup "–")
                                   (make-simple-markup " ")
                                   (make-simple-markup (number->string (cdr count))))))
                             (else #f)))
         (note-markup (if (and (not hide-note) count-markup)
  (make-concat-markup
   (list
    (make-general-align-markup Y DOWN note-mark)
    (make-simple-markup " ")
    (make-simple-markup "=")
    (make-simple-markup " ")
    (make-with-color-markup red
      count-markup)))
   #f))
         (text-markup (if (not (null? text))
                        (make-bold-markup text)
                        #f)))
    (if text-markup
(if (and note-markup (not hide-note))
    (make-line-markup (list text-markup
                          (make-concat-markup
                               (list (make-simple-markup "(")
                                     note-markup
                                     (make-simple-markup ")")))))
    (make-line-markup (list text-markup)))
(if note-markup
    (make-line-markup (list note-markup))
    (make-null-markup)))))
   
%---------- test
   
\layout {
        \context {
        \Score
        metronomeMarkFormatter = #custom-format-metronome-markup
        }
}

\new Staff {
        % statt Angabe im layout geht auch:
        % \set Score.metronomeMarkFormatter = #custom-format-metronome-markup
       
        \tempo "Largo" 4 = 57  a'1
}

Gruß,
  Harm

Arnold

  • Member
Re: \Tempo 4 = 57 <- die "57" rot färben
« Antwort #10 am: Freitag, 15. Juni 2012, 09:45 »
Und jetzt zur Alternative meine Version:

Als Include-Datei vorgesehen:
#(define-public (format-metronome-markup-14VI2012 event context)
  (let ((eq-sym-def (ly:context-property context 'tempoEquationText))             ; new option
        (hide-paren (eq? #t (ly:context-property context 'tempoHideParenthesis))) ; new option
        (num-color (ly:context-property context 'tempoNumberColor #f))            ; new option
        (hide-note (ly:context-property context 'tempoHideNote #f))
(text (ly:event-property event 'text))
(dur (ly:event-property event 'tempo-unit))
(count (ly:event-property event 'metronome-count)))

    (metronome-markup-14VI2012 text dur count hide-note eq-sym-def hide-paren num-color)))

#(define-public (metronome-markup-14VI2012 text dur count hide-note eq-sym-def hide-paren col)
  (let* ((note-mark (if (and (not hide-note) (ly:duration? dur))
(make-smaller-markup
(make-note-by-number-markup (ly:duration-log dur)
     (ly:duration-dot-count dur)
     1))
#f))
(count-markup (cond ((number? count)
      (if (> count 0)
  (make-simple-markup (number->string count))
  #f))
     ((pair? count)
      (make-concat-markup
       (list
(make-simple-markup (number->string (car count)))
(make-simple-markup " ")
(make-simple-markup "–")
(make-simple-markup " ")
(make-simple-markup (number->string (cdr count))))))
     (else #f)))
         (note-markup (if (and (not hide-note) count-markup)
  (make-concat-markup
   (list
    (make-general-align-markup Y DOWN note-mark)
    (make-simple-markup " ")
    (make-simple-markup (if (string? eq-sym-def) eq-sym-def "≈"))
    (make-simple-markup " ")
    (if (eq? col #f)
                             count-markup
                             (make-with-color-markup col count-markup))))
  #f))
         (text-markup (if (not (null? text))
  (make-bold-markup text)
  #f)))
    (if text-markup
(if (and note-markup (not hide-note))
    (make-line-markup (list text-markup
                                   (if hide-paren
                                    note-markup
    (make-concat-markup
     (list (make-simple-markup "(")
   note-markup
   (make-simple-markup ")"))))))
    (make-line-markup (list text-markup)))
(if note-markup
    (make-line-markup (list note-markup))
    (make-null-markup)))))




\layout {
  \context {
    \Score
    metronomeMarkFormatter = #format-metronome-markup-14VI2012
  }
}


#(if (not (defined? 'all-user-translation-properties))
  (define-public all-user-translation-properties '()))

#(define (add-translator-property-description symbol type? description)
  (if (not (and
    (symbol? symbol)
    (procedure? type?)
    (string? description)))
      (throw 'init-format-error))
   
       
  (if (not (equal? #f (object-property symbol 'translation-doc)))
      (ly:error (_ "symbol ~S redefined" symbol)))
 
  (set-object-property! symbol 'translation-type? type?)
  (set-object-property! symbol 'translation-doc description)
  (set! all-user-translation-properties (cons symbol all-user-translation-properties))
 )

#(add-translator-property-description
  'tempoHideParenthesis
  boolean?
  "Hide the parenthesis around the metronome markup with text")

#(add-translator-property-description
  'tempoEquationText
  string?
  "initially ''='' in the metronome markup")

#(add-translator-property-description
  'tempoNumberColor
  list?
  "alternate color, in which the tempo value should be displayed")

und das Anwendungsbeispiel danach:
\header{
  title = "Tempoangabe mit Ungefähr-Zeichen"
  tagline = ""
}

% \displayMusic { \set Score.tempoText = "Allegro di Largo" }

\score {
  \new Staff {
    \tempo 4 = 80
    c'1_"»original nach include«" \break

    % \set Score.tempoText = "Allegro di Largo"
    \tempo "Allegro di Largo" 4 = 84
    c' \break

    \once \set Score.tempoHideParenthesis = ##t
    \tempo "Allegro di Larghetto" 4 = 88
    c'_"\\once \\set Score.tempoHideParenthesis = ##t" \break

    \once \set Score.tempoHideNote = ##t
    \tempo "Allegro di Larghettissimo" 4 = 92
    c'_"\\once \\set Score.tempoHideNote = ##t" \break

    \set Score.tempoEquationText = "= ca."
    \tempo "Allegro lento" 4 = 96
    c'_"\\set Score.tempoEquationText = \"= ca.\"" \break

    \unset Score.tempoHideNote
    \unset Score.tempoHideParenthesis
    \tempo "Allegro monumentale" 4 = 100
    c'_"\\unset Score.tempoHideNote   \\unset Score.tempoHideParenthesis" \break

    \unset Score.tempoEquationText
    \once \set Score.tempoNumberColor = #red
    \tempo 4 = 108
    c'_"\\set Scroe.tempoNumberColor = #red" \break

    \set Score.tempoNumberColor = #red
    \set Score.tempoEquationText = "="
    \tempo "Tempo I" 4 = 80
    c'_"\\set Score.tempoNumberColor = #red \\set Score.tempoEquationText = \"=\""
    \break

    \set Score.metronomeMarkFormatter = #format-metronome-markup
    \tempo "Tempo I" 4 = 80
    c'_"\\set Score.metronomeMarkFormatter = #format-metronome-markup"


    \bar "|."
  }
  \header {
    piece = "Test"
  }
}

Zusammengefaßt:
Durch das include wird diese (auf Version 2.14.2 basierende) Variante des Formatierers geladen und eingestellt.
Mit diesem Formatierer gibt's dann drei neue Optionen, welche man mit \set Score.tempo... einstellen kann.
Natürlich kann man auch explizit wieder auf den 'alten' Formatierer umschalten.

Arnold