Issues getting started with LilyPond

68 views
Skip to first unread message

stuar...@gmail.com

unread,
Feb 23, 2022, 5:55:28 PM2/23/22
to The Music Notation Project | Forum

Being new to LilyPond, I am following the instructions on the MNP Wiki page: http://musicnotation.org/wiki/software-wiki/lilypond/

I first downloaded the latest version of LilyPond (v 2.22.1-1) to my Windows 10 PC.  I successfully generated the PDF file from its test.ly sample file.  Next, I downloaded the MNP-music-demo.ly and MNP-scripts.ly files.  The generate PDF fails for the demo file.  No PDF is generated but there is a “tmp” file that is an incomplete PDF file.  And at the end of the log there is this line:

warning: unknown line-cap-style: (quote round)

By selectively disabling individual AN scripts (via comments) in the MNP-music-demo.ly file, I determined that all of the Twinline AN scripts have this problem.  The others generate PDFs without problem.

 

Next I tried the four “older demo files” on the wiki page.  Three of the four generated PDF files correctly:

Chromatic-staves.ly

Custom-notehead-styles.ly

Twinline-demo.ly

However, TwinNote-demo.ly did not generate a PDF (or a “tmp” file either).  The last line in the log file is “Drawing systems…”.

 

So to net this out, there appear to be two issues:

1.       Warnings are being generated for the quote round parameter.  If I disable them in the MNP-scripts.ly file, then there are no warnings.  But this does not fix the next issue.

2.       None of the Twinline AN scripts complete the PDF.  A partial “tmp” file (without a file extension) is created but apparently there is what I used to call a “hang” in the processing wherein the PDF is not completed (and there are no error messages in the log file).

 

I’m interested in resolving these MNP-music-demo.ly issues since I would like to use the triangle noteheads defined in the Twinline AN scripts in my own.

Perhaps this is a version issue?  Or am I doing something wrong?  I would appreciate any advice on how to proceed.

Stuart

Paul Morris

unread,
Feb 24, 2022, 9:17:59 AM2/24/22
to musicn...@googlegroups.com

Hi Stuart,

Thanks for testing these out and for the thorough report on what you found.  Full disclosure, I originally wrote those LilyPond files, but have not used or looked at them in years.  (I've focused on Clairnote and extending LilyPond to work with it, see https://clairnote.org

It sounds like it's probably a matter of needing to update the files to work with the newest version of LilyPond.  I'll try to take a look into doing that when I have some time.

Cheers,
Paul

--
You received this message because you are subscribed to the forum of the Music Notation Project (hosted by Google Groups).
To post to this group, send email to musicn...@googlegroups.com
To unsubscribe from this group, send email to musicnotatio...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/musicnotation?hl=en
---
You received this message because you are subscribed to the Google Groups "The Music Notation Project | Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to musicnotatio...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/musicnotation/ae6c4502-83e1-4d0d-b195-241d61945305n%40googlegroups.com.

Paul Morris

unread,
Mar 10, 2022, 10:15:23 PM3/10/22
to musicn...@googlegroups.com
Hi Stuart,
Tonight I got around to debugging these files (sorry for the delay) and the new versions are attached.  I'll upload them to the MNP wiki soon.

The first thing I did was to automatically update them to the newest LilyPond version I have installed (2.22).  I used Frescobaldi > tools menu > update with convert-ly.

The main issue was with the ly:make-stencil function calls the `unknown line-cap-style: (quote round)`.  The newer LilyPond version has a better function to use to create path stencils called `make-path-stencil` so I converted to using that new function.  That solved that problem.  (I actually added that make-path-stencil function to LilyPond years ago. I think it was probably my first open source contribution.)

There was also an out of bounds error with a `list-ref` call.  I added some defensive code to guard against that.  I think that was all it took to get the main demo file to succeed.

That older TwinNote demo file had one too many arguments being passed to one function.  Once that was fixed, it worked.

I also used Frescobaldi's auto-formatting on the files for more consistent formatting.

Looking at this code again after all these years... well... it could be a lot better.  For one thing it's using an imperative approach when idiomatic scheme is more functional.  I eventually learned how to write more idiomatic scheme but never went back and applied those lessons to this code.  So, anyone reading this has been warned. 

That said, it does demonstrate how to extend LilyPond, where those hooks are and how to use them.  The code I've written more recently for Clairnote is much better, although it handles more edge cases and supports more features, so is more complex overall to understand  (https://clairnote.org/software/).

Hope that helps.  Feel free to ask any questions about LilyPond here and I'll be happy to try and answer them.

Cheers,
Paul
MNP-music-demo.ly
MNP-scripts.ly
TwinNote-demo.ly

stuar...@gmail.com

unread,
Mar 11, 2022, 9:20:29 AM3/11/22
to The Music Notation Project | Forum
While I don't understand much of anything regarding your description of the issues, I hope others on this forum will.  I did download the files and verified that they work in my environment.  

So thanks so much for your time on this.  I will soon try to create my own .ly file for my notation using these files as a guide.  I appreciate your offer to answer questions.  I may have to take you up on it if I get stuck.  

Regards, Stuart

stuar...@gmail.com

unread,
Mar 14, 2022, 7:31:23 AM3/14/22
to The Music Notation Project | Forum

As stated in my earlier post, I can run all the demo files without problem.  Now I want to have a general procedure for converting any score.  So I’m trying to follow the instructions on the LilyPond page of the Wiki (http://musicnotation.org/wiki/software-wiki/lilypond/).  So here’s what I’ve done.

1.       I entered a score into MuseScore and exported the MusicXML file

2.       Using Frescobaldi, I converted the MusicXML file to a LilyPond file (.ly).

3.       Using LilyPond, I generated a PDF from the .ly file and the TN sheet music looked correct.

4.       Following the wiki LilyPond web page procedure (step #2), I edited the .ly to add the include for MNP-scripts.ly

5.       Then according to step #3, I changed “staff” to one of the AN’s defined in the include file.

6.       I generated a PDF for this edit file but it is incorrect.

Here is what the first Grandstaff looks like with a simple file (the other Grandstaves have the same situation):

PDF image.jpg

Net: there is a TwinlineBlackOval treble staff without any notes, and TN treble and Bass staves with TN notes.

First of all, I am not sure this is what the wiki step 3 meant, but I changed “PianoStaff” to “StaffTwinlineBlackOval” as follows.  Here are the original unchanged lines of the 1st of 2 /score definitions in the .ly file:

% The score definition
\score {
  <<

    \new PianoStaff
    <<
      \set PianoStaff.instrumentName = "Part 1"

      \context Staff = "1" <<
        \mergeDifferentlyDottedOn\mergeDifferentlyHeadedOn
        \context Voice = "PartPOneVoiceOne" {  \PartPOneVoiceOne }
      >> \context Staff = "2" <<
        \mergeDifferentlyDottedOn\mergeDifferentlyHeadedOn
        \context Voice = "PartPOneVoiceTwo" {  \PartPOneVoiceTwo }
      >>
    >>

  >>
  \layout {}
}


And here are my changes:

% The score definition
\score {
  <<

    \new StaffTwinlineBlackOval
    <<
      \set StaffTwinlineBlackOval.instrumentName = "Part 1"

      \context Staff = "1" <<
        \mergeDifferentlyDottedOn\mergeDifferentlyHeadedOn
        \context Voice = "PartPOneVoiceOne" {  \PartPOneVoiceOne }
      >> \context Staff = "2" <<
        \mergeDifferentlyDottedOn\mergeDifferentlyHeadedOn
        \context Voice = "PartPOneVoiceTwo" {  \PartPOneVoiceTwo }
      >>
    >>

  >>
  \layout {}
}

The 2nd /score definition was changed accordingly.

I get the same results with MusicXML scores downloaded from MuseScore.  Sometimes the empty TwinlineBlackOval staff is not included in the PDFs but I can’t see a pattern for this.  I have done a lot of experimenting but have not figured out what I am doing wrong

I do notice that the MNP-music-demo.ly file has a reference to “theMusic” in curly brackets, while the generated .ly code I have does not have any curly brackets, although it does reference the two staves with the /context Voice lines.  Maybe this is relevant.

If anyone has a sample .ly file that was built according this procedure, then I would love to see it (That is to say, using one of the ANs in the MNP-scripts.ly file in a .ly file converted from MusicXML).

I’ve attached a simple score’s .ly file.

Thanks for any guidance on this.  Stuart

What a Wonderful World p1.ly

Paul Morris

unread,
Mar 14, 2022, 8:39:23 AM3/14/22
to musicn...@googlegroups.com
Hi Stuart,
Sounds like you're almost there.  More below

On Mon, Mar 14, 2022, at 7:31 AM, stuar...@gmail.com wrote:

First of all, I am not sure this is what the wiki step 3 meant, but I changed “PianoStaff” to “StaffTwinlineBlackOval” as follows. 

I think this is the problem.  A `PianoStaff` is a way of grouping `Staff` contexts.  So try leaving the PianoStaff part as-is and instead replace the two `\context Staff` with `\context StaffTwinlineBlackOval`. 

I do notice that the MNP-music-demo.ly file has a reference to “theMusic” in curly brackets, while the generated .ly code I have does not have any curly brackets, although it does reference the two staves with the /context Voice lines.  Maybe this is relevant.
I don't think the curly brackets are causing any trouble here.

Cheers,
Paul




Attachments:
  • What a Wonderful World p1.ly

stuar...@gmail.com

unread,
Mar 14, 2022, 10:06:05 AM3/14/22
to The Music Notation Project | Forum
OK.  Thanks for quick reply !  The PDF output now looks correct (in a quick look), but at least it has the TwinlineBlackOval staff format and notes.  It's odd that the log file shows this though:
Interpreting music...
F:/$savethis/WYSIWYP/LilyPond/What a Wonderful World p1.ly:86:7: warning: cannot find or create context: StaffTwinlineBlackOval = 1
    
      \context StaffTwinlineBlackOval = "1"  <<

F:/$savethis/WYSIWYP/LilyPond/What a Wonderful World p1.ly:89:10: warning: cannot find or create context: StaffTwinlineBlackOval = 2
      >>
         \context StaffTwinlineBlackOval = "2" <<

F:/$savethis/WYSIWYP/LilyPond/What a Wonderful World p1.ly:26:10: warning: barcheck failed at: 1/4
  d>4 r4
         | % 8

MIDI output to `/$savethis/WYSIWYP/LilyPond/What a Wonderful World p1.mid'...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...
Converting to `/$savethis/WYSIWYP/LilyPond/What a Wonderful World p1.pdf'...
Success: compilation successfully completed


So in spite of the warnings, it completed successfully.  And I also don't know what to think of the warning on line 26 which is:
d>4 r4 | % 8

which is embedded in this definition of PartPOneVoiceTwo:

PartPOneVoiceTwo =  \relative g {
  \clef "treble" \numericTimeSignature\time 4/4 \key c \major | % 1
  \clef "bass" \numericTimeSignature\time 4/4 \stemDown g8 -\f
  \stemDown b8 s2. | % 2
  \stemDown c4 r4 r2 | % 3
  \stemDown c2 \stemDown b2 | % 4
  \stemDown a2 \stemDown g2 | % 5
  \stemDown b2 \stemDown <a c>4 \stemDown c8 \stemDown c8 | % 6
  \stemDown <as c>4 \stemDown c8 -! \stemDown c8 \stemDown <as c>2 | % 7
  r4 \stemDown c8 \stemDown c8 \stemDown b8 \stemDown c8 \stemDown <b
  d>4 r4 | % 8
  \stemDown g2 \stemDown gis2 | % 9
  \stemDown <a c>4 \stemDown b4 \stemDown g8 \stemDown b8 |
  \barNumberCheck #10
  \stemDown c4 r4 r2 | % 11
  r4 \stemDown c4 -! \stemDown b2 | % 12
  r4 \stemDown a4 \stemDown g2 | % 13
  r4 \stemDown b4 \stemDown <a c>4 \stemDown c8 \stemDown c8 | % 14
  \stemDown <as c>4 \stemDown c8 \stemDown c8 \stemDown <as c>2 | % 15
  r4 \stemDown c8 \stemDown c8 \stemDown b8 \stemDown c8 \stemDown <b
  d>4 -! | % 16
  c1 ~ | % 17
  \stemDown c2. \stemDown c4
}

And for the record, here is what the modified .ly code segment for the (1st) /score now looks like after your advice:
% The score definition
\score {
  <<
    \new PianoStaff
    <<
      \set PianoStaff.instrumentName = "Part 1"

       \context StaffTwinlineBlackOval = "1"  <<

        \mergeDifferentlyDottedOn\mergeDifferentlyHeadedOn
       \context Voice = "PartPOneVoiceOne" {  \PartPOneVoiceOne }
       >> \context StaffTwinlineBlackOval = "2" <<

        \mergeDifferentlyDottedOn\mergeDifferentlyHeadedOn
        \context Voice = "PartPOneVoiceTwo" {  \PartPOneVoiceTwo }
      >>
    >>

  >>
  \layout {}
}

Thanks again for your help with this.  My next step is to try to create my own AN definition (I'm sure you're not looking forward to this attempt!).
Stuart
Reply all
Reply to author
Forward
0 new messages