lilypond-user
[Top][All Lists]
Advanced

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

Re: Creating score with unfolded repeats in scheme


From: Morten Lemvigh
Subject: Re: Creating score with unfolded repeats in scheme
Date: Tue, 10 Sep 2024 17:59:14 +0200

Hi Hans,

Thank you for the pointer - that sounds a lot like what I am trying to achieve. I will certainly take a closer look at that. 

Best regards,
Morten

On Mon, Sep 9, 2024 at 11:49 PM Hans Aikema <hans.aikema@aikebah.net> wrote:


On 9 Sep 2024, at 23:10, Morten Lemvigh <morten.lemvigh@gmail.com> wrote:

Hi,

I am experimenting with a system to create choir rehearsal midi files. A part of that is to unfold repeats. I have a function that accepts a score and creates a new score. The steps are:
1. Extract the music from the score
2. Unfold the repeats
3. Make a new score 

For some reason only the first note of the score is repeated and I get a
"programming error: Moment is not increasing. Aborting interpretation."

When I try to display-scheme-music of the unfolded music it looks like everything is there, but it is not included in the final score.
I have tried to create a minimal example that reproduces the issue. It is pasted below.

So the question is: what have I misunderstood? :-)

Best regards,
Morten

\version "2.24.2"

choirScore = \score {
    \new Staff {
        \relative c' {
            \repeat volta 2 {
                c d e f
            }
        }
    }
}

make-rehearsal =
#(define-scheme-function
  (the-score)
  (ly:score?)
  (ly:make-score (unfold-repeats-fully (ly:score-music the-score))))

new-score = #(make-rehearsal choirScore)
\new-score

What I found very useful in my case for the rehearsal tracks is the rehearsalMidi function from the openlilylib gridly grit-templates include, which I’ve been using stand-alone in my own (historically grown and improved) choir arrangements.
https://github.com/openlilylib/snippets/blob/master/ly/gridly/grid-templates.ily

As an inspiration here’s how I’ve organised things in my system (which no doubt could be improved):

A folder <songname> per song
Variables for each of the voices’ notes (sopMusic, altMusic etc) and each of the voices lyrics (sopWords, altWords etc) each defined in a file named after the voice (soprano.ily, alto.ily etc)

The main composition file bringing it all together <songname>.ly
```
\version "2.19.3"

\header {
    …
}

\paper {
    first-page-number = 1
}

global = {
    % defines tempo, initial key, time signature
}

\include "soprano.ily"
\include "alto.ily"
\include "tenor.ily"
\include "basso.ily"
\include "../temlates/SATB.ily"
```

Include-files to setup a staff per voice in a templates folder
e.g. for Soprano (soprano.ily):
```
\version "2.22.0"
soprano_Staff = {
    \new Staff = soprano \with {
        instrumentName = "Soprano"
        shortInstrumentName = "S"
    }<<
        \new Voice = "soprano" { \clef "treble"  \global \sopMusic }
        \tag #'lyrics {\new Lyrics \with {alignBelowContext=sopStaff} \lyricsto soprano \sopWords}
    >>
}
```

Include-file for an entire arrangement layout that includes the relevant per-voice templates and then goes on to defined the overall music as the allMusic variable
```
allMusic = {
    <<
        \metronome
        \new ChoirStaff <<
                    \soprano_Staff
                    \alto_Staff
                    \tenor_Staff
                    \basso_Staff
        >> % end of ChoirStaff
>> % end of full system
}
```

Which is then used both to create a full SATB-score sheet music as per
```
\book {
    \bookOutputSuffix "lilypond"
    \score {
        \removeWithTag #'metronome
        \allMusic

        \layout {}
    }
}
```

A tutti-track with all music at regular volume:
```
\book {
    \bookOutputSuffix "tutti"
    \score {
        \unfoldRepeats { \removeWithTag #'lyrics \allMusic }
        \midi {
            \context {
                \Score 
                dynamicAbsoluteVolumeFunction = #hatikwaDynamics
            }
        }
    }
}
```

And per-voice highlighted tracks (using the rehearsal-midi function, which, among others, unfolds the music and lowers the volume of all voices except the voice given as its argument)  e.g. for the soprano group:
```
\rehearsalMidi { \removeWithTag #'lyrics \allMusic } "soprano"
```




reply via email to

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