lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Swing tempo equivalence


From: Menu Jacques
Subject: Swing tempo equivalence
Date: Wed, 14 Mar 2018 07:14:43 +0100

Hello folks,

Using http://lsr.di.unimi.it/LSR/Item?id=204 as a starting point, I obtained the code below, that produces:



Is there a simpler way to obtain the same score?

Thanks for your help!

JM

%%%%%%%%%%%%%%%%%%%

\version "2.19.80"

%% http://lsr.di.unimi.it/LSR/Item?id=204
%% see also http://lilypond.org/doc/v2.18/Documentation/internals/metronome_005fmark_005fengraver
%% see also http://lilypond.org/doc/v2.18/Documentation/snippets/rhythms

%%% Function: tempoEquivalence
%%% ============================================================
%%%  Purpose: print a sophisticated rehearsal mark e.g
%%%           for rhythm directives
%%%    Usage: \tempoEquivalence label music1 music2
%%% ------------------------------------------------------------
%%% Variable: label (string)
%%% ------------------------------------------------------------
%%% Variable: music1 (ly:music)
%%% ------------------------------------------------------------
%%% Variable: music2 (ly:music)
%%% ------------------------------------------------------------
%%%  Example: \tempoEquivalence #"Swing" \rhyMarkIIEighths
%%%                 \rhyMarkSlurredTriplets
%%% ------------------------------------------------------------
%%% Constants:
%%%           tempoEquivalenceStaffReduce = #-3
%%% ============================================================

tempoEquivalenceStaffReduce = #-3

tempoEquivalence =
#(define-music-function (parser location label musicI musicII )
   (string? ly:music? ly:music?)
   #{
     \tempo \markup {
       \line \general-align #Y #DOWN {
         % 1st column in line
         $label

         % 2nd column in line
         \score {
           \new Staff \with {
             % reduce the font size a la cue
             fontSize = #tempoEquivalenceStaffReduce
             \override StaffSymbol.staff-space = #(magstep tempoEquivalenceStaffReduce)
             % hide the staff lines
             \override StaffSymbol.line-count = #0
             % align horizontally
             \override VerticalAxisGroup.Y-extent = #'(-0.85 . 0)
           }

           {
             % \override Score.SpacingSpanner.common-shortest-duration = #(ly:make-moment 1/2) % super-tight
             % \override Score.SpacingSpanner.common-shortest-duration = #(ly:make-moment 1/4) % tight
             % \override Score.SpacingSpanner.common-shortest-duration = #(ly:make-moment 3/16) % even
             \override Score.SpacingSpanner.common-shortest-duration = #(ly:make-moment 5/32) % even

             % the left music
             \relative c' { \stemUp $musicI }

             % the equivalence sign
             \once \override Score.TextScript.Y-offset = #-0.4
             s4.^\markup{
               \halign #-1 "="
             }

             % the right music
             \relative c' { \stemUp $musicII }
           }

           \layout {
             indent = 0
             \context {
               \Staff
               \remove "Clef_engraver"
               \remove "Time_signature_engraver"
             }
           } % layout end
         } % score end
       } % line end
     } % markup end
   #})

%%% Begin Example
%%% ============================================================

\relative {
  {
    \tempoEquivalence #"Swing"
    \fixed b' {
      b8 [ b8 ]
    }
    \fixed b' {
      \tuplet 3/2 { b4 b8 }
    }

    a'8 b c4. d4 e8 |
    f1 |

    \tempo #"As written"

    a8 b c4. d4 e8 |
    f1 |

    \bar "|."
  }
}


%%%%%%%%%%%%%%

reply via email to

[Prev in Thread] Current Thread [Next in Thread]