> When my score becomes bigger i have to wait long to see my
> result and this slows me down in my working proces.
>
> So i was wondering if lilypond could work faster
>


Here is an alternative approach to achieving faster compilation for large
scores.

Well, it is a workaround, since this approach is to to compile small parts
of the score.  This doesn't actually affect the speed of compiling the
entire score.


So, the approach is to segment your piece using \tag and then work on it
one segment at a time.  (Of course, depending on what types of issues you
are working on like page breaks or line breaks,  you may need to compile
the preceding or following segment.)


\version "2.19.15"

% This approach combines two techniques, tags and global definitions.
% If you have large scores, they are both necessary, in my opinion.

% First, put all your global items (the things that are common to all
parts) in a music expression.
% Include tags to separate each distinct section.

structureSong = \relative c {
    \time 4/4
    \key f \major
    \tempo 4=108
    \tag #'SegmentA {
        s1*4 \bar "||"
    }
    \tag #'SegmentB {
        \mark B
        s1*4 \bar "||"
    }
    \tag #'SegmentC {
        \mark C
        s1*4 \bar "|."
    }
}

% Then define a function that combines this structure with supplied music.

globalSong = #(define-music-function (parser location mus) (ly:music?) #{
<< \structureSong \relative { $mus } >> #})


% Then for each part, include the same tags as in the song structure.
% I've also wrapped each part in a tag for the instrumental section (in
this case Brass or Strings)

hornISong = \relative c' {
    \tag #'Brass {
        \tag #'SegmentA { R1*4 }
        \tag #'SegmentB { a1 1 1 1 }
        \tag #'SegmentC { R1*4 }
    }
}

hornIISong = \relative c' {
    \tag #'Brass {
        \tag #'SegmentA { R1*4 }
        \tag #'SegmentB { c1 1 1 1 }
        \tag #'SegmentC { R1*4 }
    }
}

violinISong = \relative c' {
    \tag #'Strings {
        \tag #'SegmentA { c1 1 1 1 }
        \tag #'SegmentB { R1*4 }
        \tag #'SegmentC { e1 1 1 1 }
    }
}

violinIISong = \relative c' {
    \tag #'Strings {
        \tag #'SegmentA { a1 1 1 1 }
        \tag #'SegmentB { R1*4 }
        \tag #'SegmentC { c1 1 1 1 }
    }
}

violaSong = \relative c' {
    \tag #'Strings {
        \tag #'SegmentA { c1 1 1 1 }
        \tag #'SegmentB { a1 1 1 1 }
        \tag #'SegmentC { R1*4 }
    }
}

celloSong = \relative c' {
    \tag #'Strings {
        \tag #'SegmentA { e1 1 1 1 }
        \tag #'SegmentB { c1 1 1 1 }
        \tag #'SegmentC { R1*4 }
    }
}


%  Then create the merged music expressions

hornIGlobalSong = \globalSong { \hornIISong }
hornIIGlobalSong = \globalSong { \hornIISong }

violinIGlobalSong = \globalSong { \violinISong }
violinIIGlobalSong = \globalSong { \violinIISong }
violaGlobalSong = \globalSong { \violaSong }
celloGlobalSong = \globalSong { \celloSong }


% Put them together in the score

\score {
    <<

        \new StaffGroup = "Brass" <<
            \new Staff  {
                \set Staff.instrumentName = #"Horn I"
                \keepWithTag #'(
                    Brass
                    SegmentA
                    SegmentB
                    SegmentC
                ) \hornIGlobalSong
            }
            \new Staff  {
                \set Staff.instrumentName = #"Horn II"
                \keepWithTag #'(
                    Brass
                    SegmentA
                    SegmentB
                    SegmentC
                ) \hornIIGlobalSong
            }
        >>

        \new StaffGroup = "Strings" <<
            \new Staff  {
                \set Staff.instrumentName = #"Violin I"
                \keepWithTag #'(
                    Strings
                    SegmentA
                    SegmentB
                    SegmentC
                ) \violinIGlobalSong
            }
            \new Staff  {
                \set Staff.instrumentName = #"Violin II"
                \keepWithTag #'(
                    Strings
                    SegmentA
                    SegmentB
                    SegmentC
                ) \violinIIGlobalSong
            }
            \new Staff  {
                \set Staff.instrumentName = #"Viola"
                \keepWithTag #'(
                    Strings
                    SegmentA
                    SegmentB
                    SegmentC
                ) \violaGlobalSong
            }
            \new Staff  {
                \set Staff.instrumentName = #"'Cello"
                \keepWithTag #'(
                    Strings
                    SegmentA
                    SegmentB
                    SegmentC
                ) \celloGlobalSong
            }
        >>
    >>
}

% That's the whole score.
% To compile, say only segment B, you would comment-out the other segment
names

\score {
    <<

        \new StaffGroup = "Brass" <<
            \new Staff  {
                \set Staff.instrumentName = #"Horn I"
                \keepWithTag #'(
                    Brass
                    %SegmentA
                    SegmentB
                    %SegmentC
                ) \hornIGlobalSong
            }
            \new Staff  {
                \set Staff.instrumentName = #"Horn II"
                \keepWithTag #'(
                    Brass
                    %SegmentA
                    SegmentB
                    %SegmentC
                ) \hornIIGlobalSong
            }
        >>

        \new StaffGroup = "Strings" <<
            \new Staff  {
                \set Staff.instrumentName = #"Violin I"
                \keepWithTag #'(
                    Strings
                    %SegmentA
                    SegmentB
                    %SegmentC
                ) \violinIGlobalSong
            }
            \new Staff  {
                \set Staff.instrumentName = #"Violin II"
                \keepWithTag #'(
                    Strings
                    %SegmentA
                    SegmentB
                    %SegmentC
                ) \violinIIGlobalSong
            }
            \new Staff  {
                \set Staff.instrumentName = #"Viola"
                \keepWithTag #'(
                    Strings
                    %SegmentA
                    SegmentB
                    %SegmentC
                ) \violaGlobalSong
            }
            \new Staff  {
                \set Staff.instrumentName = #"'Cello"
                \keepWithTag #'(
                    Strings
                    %SegmentA
                    SegmentB
                    %SegmentC
                ) \celloGlobalSong
            }
        >>
    >>
}


% Another use case is if you want to compile only some staff groups.
% Here we omit the music from the Brass parts by commenting out the "Brass"
tag
% and only show segment C by commenting out the SegmentA and SegmentB tags.

\score {
    <<
        \new StaffGroup = "Brass" <<
            \new Staff  {
                \set Staff.instrumentName = #"Horn I"
                \keepWithTag #'(
                    %Brass
                    %SegmentA
                    %SegmentB
                    SegmentC
                ) \hornIGlobalSong
            }
            \new Staff  {
                \set Staff.instrumentName = #"Horn II"
                \keepWithTag #'(
                    %Brass
                    %SegmentA
                    %SegmentB
                    SegmentC
                ) \hornIIGlobalSong
            }
        >>


        \new StaffGroup = "Strings" <<
            \new Staff  {
                \set Staff.instrumentName = #"Violin I"
                \keepWithTag #'(
                    Strings
                    %SegmentA
                    %SegmentB
                    SegmentC
                ) \violinIGlobalSong
            }
            \new Staff  {
                \set Staff.instrumentName = #"Violin II"
                \keepWithTag #'(
                    Strings
                    %SegmentA
                    %SegmentB
                    SegmentC
                ) \violinIIGlobalSong
            }
            \new Staff  {
                \set Staff.instrumentName = #"Viola"
                \keepWithTag #'(
                    Strings
                    %SegmentA
                    %SegmentB
                    SegmentC
                ) \violaGlobalSong
            }
            \new Staff  {
                \set Staff.instrumentName = #"'Cello"
                \keepWithTag #'(
                    Strings
                    %SegmentA
                    %SegmentB
                    SegmentC
                ) \celloGlobalSong
            }
        >>
    >>
}


In order to iterate compiling these segments, you can use search/replace.

For example, to go from the full score to just segment A:
    change "Segment" to "%Segment"
    change "%SegmentA" to "SegmentA"

To go from just segment A to just segment B:
    change "SegmentA" to "%SegmentA"
    change "%SegmentB" to "SegmentB"

To  make this search/replace even simpler,
move your structure and music definitions to other files.
Then import these files into your score file.

That way, when you do global search/replace on the score file to update
which tags you want to show/hide, you don't have to worry about modifying
the names of the segments in the structure and music definitions.



HTH,

David Elaine Alt
415 . 341 .4954                                           "*Confusion is
highly underrated*"
ela...@flaminghakama.com
self-immolation.info
skype: flaming_hakama
Producer ~ Composer ~ Instrumentalist
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to