ssb22 / jianpu-ly

Jianpu in Lilypond
http://ssb22.user.srcf.net/mwrhome/jianpu-ly.html
Apache License 2.0
68 stars 15 forks source link

Is it possible to have separated lyrics section #54

Closed suntong closed 4 months ago

suntong commented 5 months ago

Is it possible to have separated lyrics section, like this:

WechatIMG16

ssb22 commented 5 months ago

Sure, the Lilypond documentation has examples (search that page for "Printing stanzas at the end" and "Printing stanzas at the end in multiple columns"), it involves adding Lilypond markup after the end of the score block, and you'll have to know where you want the line and column breaks (which is not currently specified in jianpu-ly's lyrics). You can literally just append this extra markup code after the Lilypond that jianpu-ly generates.

suntong commented 5 months ago

Gotcha. Thanks!

suntong commented 4 months ago

what's wrong with the following @ssb22 ?

KeepLength

% tempo: 4=120
4/4

% Print many verses in multiple columns
% https://lilypond.org/doc/v2.24/Documentation/notation/stanzas#printing-stanzas-at-the-end-in-multiple-columns

c3 2 1 2  |  3 3 3 3   |  2 2 3 2  |  1 - - -

L: Ma- ry had a lit- tle lamb, its fleece was white as snow.

LP: 

\markup {
  \fill-line {
    % moves the column off the left margin;
    % can be removed if space on the page is tight
    \hspace #0.1
    \column {
      \line { \bold "2."
        \column {
          "This is verse two."
          "It has two lines."
        }
      }
      % adds vertical spacing between verses
      \combine \null \vspace #0.1
      \line { \bold "3."
        \column {
          "This is verse three."
          "It has two lines."
        }
      }
    }
    % adds horizontal spacing between columns
    \hspace #0.1
    \column {
      \line { \bold "4."
        \column {
          "This is verse four."
          "It has two lines."
        }
      }
      % adds vertical spacing between verses
      \combine \null \vspace #0.1
      \line { \bold "5."
        \column {
          "This is verse five."
          "It has two lines."
        }
      }
    }
    % gives some extra space on the right margin;
    % can be removed if page space is tight
    \hspace #0.1
  }
}

:LP

It errors only after adding the LP: block, and the errors are:

Parsing...
demo-stanzas2.ly:168:1: error: markup outside of text script or \lyricmode

\markup {
demo-stanzas2.ly:227:1: error: markup outside of text script or \lyricmode

\markup {

Note: compilation failed and \version outdated, did you
update input syntax with convert-ly?

. . .

thx

suntong commented 4 months ago

And BTW, what's the simplest form to have many verses in multiple columns? OK that I use

\column \string-lines ?

ssb22 commented 4 months ago

I'm afraid you have to append the extra markup code after the Lilypond that jianpu-ly generates. Which is not the same thing as putting it inside an LP: block. An LP: block will be inserted inside the score, but we want to put it after the score. There's no current way to do this in jianpu-ly yet: you have to run jianpu-ly without the extra verses, take the resulting lilypond file, and add the extra, something like this in Mac or Linux:

( python jianpu-ly.py <<EOF
KeepLength

% tempo: 4=120
4/4

% Print many verses in multiple columns
% https://lilypond.org/doc/v2.24/Documentation/notation/stanzas#printing-stanzas-at-the-end-in-multiple-columns

c3 2 1 2  |  3 3 3 3   |  2 2 3 2  |  1 - - -

L: Ma- ry had a lit- tle lamb, its fleece was white as snow.
EOF

cat <<"EOF"
\markup {
  \fill-line {
    % moves the column off the left margin;
    % can be removed if space on the page is tight
    \hspace #0.1
    \column {
      \line { \bold "2."
        \column {
          "This is verse two."
          "It has two lines."
        }
      }
      % adds vertical spacing between verses
      \combine \null \vspace #0.1
      \line { \bold "3."
        \column {
          "This is verse three."
          "It has two lines."
        }
      }
    }
    % adds horizontal spacing between columns
    \hspace #0.1
    \column {
      \line { \bold "4."
        \column {
          "This is verse four."
          "It has two lines."
        }
      }
      % adds vertical spacing between verses
      \combine \null \vspace #0.1
      \line { \bold "5."
        \column {
          "This is verse five."
          "It has two lines."
        }
      }
    }
    % gives some extra space on the right margin;
    % can be removed if page space is tight
    \hspace #0.1
  }
}
EOF

) > test.ly && lilypond test.ly

and on Windows you save it as 2 files, concatenate them together and run Lilypond on the result.

I suppose we could add a new command to jianpu-ly to add Lilypond code after the end of the score, but I'm not sure how often it would be used and it should be easy enough just to provide a separate file of the code that goes after the score.

suntong commented 4 months ago

Ok. thx!

suntong commented 4 months ago

I suppose we could add a new command to jianpu-ly to add Lilypond code after the end of the score, but I'm not sure how often it would be used and it should be easy enough just to provide a separate file of the code that goes after the score.

Yeah, I guess I might be the only one using this feature, so, don't bother.

To anyone that also might to, take a look at https://github.com/jianpu-ly/jianpu-st/blob/master/SeparatedL/Makefile

I had always been thinking wether I should add a Makefile, but it hadn't been really necessary until now.

And now, I can just use make to do auto music sheet building now, ✌️Yeih✌️~~~