openlilylib / scholarly

ScholarLY, a library for annotating LilyPond scores
GNU General Public License v3.0
24 stars 6 forks source link

Multiple scores in the same file #68

Closed dliessi closed 5 years ago

dliessi commented 5 years ago

Compiling the following file

\version "2.19.80"
\include "oll-core/package.ily"
\loadModule scholarly.editorial-markup
\loadModule scholarly.annotate
\setOption scholarly.annotate.export-targets #'(plaintext)
\book {
  \score {
    \new Staff {
      \editorialMarkup correction \with {
        message = "test1"
        ann-type = critical-remark
        type = substitution
      } {
        a'1
      }
    }
  }
  \score {
    \new Staff {
      \editorialMarkup unclear \with {
        message = "test2a"
        ann-type = critical-remark
      } {
        c'1
      }
      \editorialMarkup correction \with {
        message = "test2b"
        ann-type = critical-remark
        type = substitution
      } {
        b'1
      }
    }
  }
  \score {
    \new Staff {
      \editorialMarkup regularization \with {
        message = "test3"
        ann-type = critical-remark
      } {
        f'1
      }
    }
  }
}

results in the following annotation file

Measure 1, beat 1
    [...]
    Message: test3
    [...]

Measure 1, beat 1
    [...]
    Message: test2a
    [...]

Measure 1, beat 1
    [...]
    Message: test1
    [...]

Measure 2, beat 1
    [...]
    Message: test2b
    [...]

Apparently annotations are not kept separated by score, but are sorted together by moment. I would like the annotation file to look like

Score 1
=======

Measure 1, beat 1
    [...]
    Message: test1
    [...]

Score 2
=======

Measure 1, beat 1
    [...]
    Message: test2a
    [...]

Measure 2, beat 1
    [...]
    Message: test2b
    [...]

Score 3
=======

Measure 1, beat 1
    [...]
    Message: test3
    [...]

or

Score 1, measure 1, beat 1
    [...]
    Message: test1
    [...]

Score 2, measure 1, beat 1
    [...]
    Message: test2a
    [...]

Score 2, measure 2, beat 1
    [...]
    Message: test2b
    [...]

Score 3, measure 1, beat 1
    [...]
    Message: test3
    [...]

or maybe it would be even better to output one file per score.

dliessi commented 5 years ago

Reading again the documentation, I think that the following code should do what I want (I overlooked the "Score" line in the annotation because it was always empty...), but I cannot compile it.

file:

\version "2.19.80"
\include "oll-core/package.ily"
\loadModule scholarly.editorial-markup
\loadModule scholarly.annotate
\setOption scholarly.annotate.export-targets #'(plaintext)
\setOption scholarly.annotate.sort-by #'(score rhythmic-location)
\book {
  \score {
    \new Score = "scoreA" {
      \new Staff {
        \editorialMarkup correction \with {
          message = "test1"
          ann-type = critical-remark
          type = substitution
        } {
          a'1
        }
      }
    }
  }
  \score {
    \new Score = "scoreB" {
      \new Staff {
        \editorialMarkup unclear \with {
          message = "test2a"
          ann-type = critical-remark
        } {
          c'1
        }
        \editorialMarkup correction \with {
          message = "test2b"
          ann-type = critical-remark
          type = substitution
        } {
          b'1
        }
      }
    }
  }
  \score {
    \new Score = "scoreC" {
      \new Staff {
        \editorialMarkup regularization \with {
          message = "test3"
          ann-type = critical-remark
        } {
          f'1
        }
      }
    }
  }
}

error:

GNU LilyPond 2.19.83
Processing `test.ly'
Parsing...
Interpreting music...
writing 'test.annotations.log' ...
Preprocessing graphical objects...
Interpreting music.../usr/share/lilypond/2.19.83/scm/lily-library.scm:948:13: In procedure symbol->string in expression (symbol->string lst):
/usr/share/lilypond/2.19.83/scm/lily-library.scm:948:13: Wrong type argument in position 1 (expecting symbol): "scoreA"
uliska commented 5 years ago

Should be fixed, thank you for reporting