2

I divided the notes of my score into 6 variables respectively called: \partOne, \partTwo, \partThree, \partFour, \partFive and \partSix. Each variable contains 20 measures of music. Then I call the variables in the score block. Whenever I call just one of the variables it works fine. If I call more than one, the output is completely messed up. Any ideas what’s going on?


Edit: responding to a few kind suggestions here.

  1. I used the word “part” as it’s used in books and movies, not how it’s used in music, so I probably should have said “sections.” The point is they’re successive and not simultaneous.

  2. I’m using hacklily.org web editor on an iPad because that’s all I have (no laptop or desktop).

  3. Here is the full code I have so far:

\header {
  title = "Six Choose Four"
  composer = "Niall Mac Giolla Rua"
}

partOne = {
    c16^[ d] e_[ g] c,^[ d^] e_[ b'] c,^[ d] e_[ c']
    c,^[ d] g_[ e] c^[ d] g_[ b] c,^[ d] g_[ c]
    c,^[ d] b'_[ e,] c^[ d] b'_[ g] c,^[ d] b'_[ c]
    c,^[ d] c'_[ e,] c^[ d] c'_[ g] c,^[ d] c'_[ b] \break
    %5
    c,^[ e] d_[ g] c,^[ e] d_[ b'] c,^[ e] d_[ c']
    c,^[ e] g_[ d] c^[ e] g_[ b] c,^[ e] g_[ c]
    c,^[ e] b'_[ d,] c^[ e] b'_[ g] c,^[ e] b'_[ c]
    c,^[ e] c'_[ d,] c^[ e] c'_[ g] c,^[ e] c'_[ b] \break
    %9
    c,^[ g'] d_[ e] c^[ g'] d_[ b'] c,^[ g'] d_[ c']
    c,^[ g'] e_[ d] c^[ g'] e_[ b'] c,^[ g'] e_[ c']
    c,^[ g'] b_[ d,] c^[ g'] b_[ e,] c^[ g'] b_[ c]
    c,^[ g'] b_[ d,] c^[ g'] b_[ e,] c^[ g'] b_[ c] \break
    %13
    c,^[ b'] d,_[ e] c^[ b'] d,_[ g] c,^[ b'] d,_[ c']
    c,^[ b'] e,_[ d] c^[ b'] e,_[ g] c,^[ b'] e,_[ c']
    c,^[ b'] g_[ d] c^[ b'] g_[ e] c^[ b'] g_[ c]
    c,^[ b'] c_[ d,] c^[ b'] c_[ e,] c^[ b'] c_[ g] \break
    %17
    c,^[ c'] d,_[ e] c^[ c'] d,_[ g] c,^[ c'] d,_[ b']
    c,^[ c'] e,_[ d] c^[ c'] e,_[ g] c,^[ c'] e,_[ b']
    c,^[ c'] g_[ d] c^[ c'] g_[ e] c^[ c'] g_[ b]
    c,^[ c'] b_[ d,] c^[ c'] b_[ e,] c^[ c'] b_[ g] \break
    }

    partTwo = {
    %21
    d16^[ c] e_[ g] d^[ c^] e_[ b'] d,^[ c] e_[ c']
    d,^[ c] g'_[ e] d^[ c^] g'_[ b] d,^[ c] g'_[ c]
    d,^[ c] b'_[ e,] d^[ c^] b'_[ g] d^[ c] b'_[ c]
    d,^[ c] c'_[ e,] d^[ c^] c'_[ g] d^[ c] c'_[ b]  \break
    %25
    d,^[ e] c_[ g'] d^[ e^] c_[ b'] d,^[ e] c_[ c']
    d,^[ e] g_[ c,] d^[ e^] g_[ b] d,^[ e] g_[ c]
    d,^[ e] b'_[ c,] d^[ e^] b'_[ g] d^[ e] b'_[ c]
    d,^[ e] c'_[ c,] d^[ e^] c'_[ g] d^[ e] c'_[ b]  \break
    %29
    d,^[ g] c,_[ e] d^[ g] c,_[ b'] d,^[ g] c,_[ c']
    d,^[ g] e_[ c] d^[ g] e_[ b']  d,^[ g] e_[ c']
    d,^[ g] b_[ c,] d^[ g] b_[ e,] d^[ g] b_[ c]
    d,^[ g] c_[ c,] d^[ g] c_[ e,] d^[ g] c_[ b] \break
    %33
    d,^[ b'] c,_[ e] d^[ b'] c,_[ g'] d^[ b'] c,_[ c']
    d,^[ b'] e,_[ c] d^[ b'] e,_[ g]  d^[ b'] e,_[ c']
    d,^[ b'] g_[ c,] d^[ b'] g_[ e] d^[ b'] g_[ c]
    d,^[ b'] c_[ c,] d^[ b'] c_[ e,] d^[ b'] c_[ g] \break
    %37
    d^[ c'] c,_[ e] d^[ c'] c,_[ g'] d^[ c']c,_[ b']
    d,^[ c'] e,_[ c] d^[ c'] e,_[ g] d^[ c'] e,_[ b']
    d,^[ c'] g_[ c,] d^[ c'] g_[ e] d^[ c']  g_[ b]
    d,^[ c'] b_[ c,] d^[ c'] b_[ e,] d^[ c'] b_[ g] \break
    }

  partThree = {
    %41
    e16^[ c] d_[ g] e^[ c^] d_[ b'] e,^[ c] d_[ c']
    e,^[ c] g'_[ d] e^[ c^] g'_[ b] e,^[ c] g'_[ c]
    e,^[ c] b'_[ d,] e^[ c^] b'_[ g] e^[ c] b'_[ c]
    e,^[ c] c'_[ d,] e^[ c^] c'_[ g] e^[ c] c'_[ b]  \break
    %45
    e,^[ d] c_[ g'] e^[ d] c_[ b'] e,^[ d] c_[ c']
    e,^[ d] g_[ c,] e^[ d] g_[ b] e,^[ d] g_[ c]
    e,^[ d] b'_[ c,] d^[ e^] b'_[ g] e^[ d] b'_[ c]
    e,^[ d] c'_[ c,] e^[ d^] c'_[ g] e^[ d] c'_[ b]  \break
    %49
    e,^[ g] c,_[ d] e^[ g] c,_[ b'] e,^[ g] c,_[ c']
    e,^[ g] d_[ c] e^[ g] d_[ b']  e,^[ g] d_[ c']
    e,^[ g] b_[ c,] e^[ g] b_[ d,] e^[ g] b_[ c]
    e,^[ g] c_[ c,] e^[ g] c_[ d,] e^[ g] c_[ b] \break
    %53
    e,^[ b'] c,_[ d] e^[ b'] c,_[ g'] e^[ b'] c,_[ c']
    e,^[ b'] d,_[ c] e^[ b'] d,_[ g]  e^[ b'] d,_[ c']
    e,^[ b'] g_[ c,] e^[ b'] g_[ d] e^[ b'] g_[ c]
    e,^[ b'] c_[ c,] e^[ b'] c_[ d,] e^[ b'] c_[ g] \break
    %57
    e^[ c'] c,_[ d] e^[ c'] c,_[ g'] e^[ c']c,_[ b']
    e,^[ c'] d,_[ c] e^[ c'] d,_[ g] e^[ c'] d,_[ b']
    e,^[ c'] g_[ c,] e^[ c'] g_[ d] e^[ c']  g_[ b]
    e,^[ c'] b_[ c,] e^[ c'] b_[ d,] e^[ c'] b_[ g] \break
    }

    partFour = {
    %61
    g'16^[ c,] d_[ e] g^[ c,^] d_[ b'] g^[ c,] d_[ c']
    g^[ c,] e_[ d] g^[ c,^] e_[ b'] g^[ c,] e_[ c']
    g^[ c,] b'_[ d,] g^[ c,^] b'_[ e,] g^[ c,] b'_[ c]
    g^[ c,] c'_[ d,] g^[ c,^] c'_[ e,] g^[ c,] c'_[ b]  \break    
    %65
    g^[ d] c_[ e] g^[ d] c_[ b'] g^[ d] c_[ c']
    g^[ d] e_[ c] g'^[ d] e_[ b'] g^[ d] e_[ c']
    g^[ d] b'_[ c,] g'^[ d^] b'_[ e,] g^[ d] b'_[ c]
    g^[ d] c'_[ c,] g^[ d^] c'_[ e] g^[ d] c'_[ b]  \break
    %69
    g^[ e] c_[ d] g^[ e] c_[ b'] g^[ e] c_[ c']
    g^[ e] d_[ c] g'^[ e] d_[ b']  g^[ e] d_[ c']
    g^[ e] b'_[ c,] g'^[ e] b'_[ d,] g^[ e] b'_[ c]
    g^[ e] c'_[ c,] g'^[ e] c'_[ d,] g^[ e] c'_[ b] \break
    %73
    g^[ b] c,_[ d] g^[ b] c,_[ e] g^[ b] c,_[ c']
    g^[ b] d,_[ c] g'^[ b] d,_[ e] g^[ b] d,_[ c']
    g^[ b] e,_[ c] g'^[ b] e,_[ d] g^[ b] e,_[ c']
    g^[ b] c_[ c,] g'^[ b] c_[ d,] g^[ b] c_[ e,] \break 
    %77
    g^[ c] c,_[ d] g^[ c] c,_[ e] g^[ c] c,_[ b']
    g^[ c] d,_[ c] g'^[ c] d,_[ e] g^[ c] d,_[ b']
    g^[ c] e,_[ c] g'^[ c] e,_[ d] g^[ c]  e,_[ b']
    g^[ c] b_[ c,] g'^[ c] b_[ d,] g^[ c] b_[ e,] \break
    }

    partFive = {
    %81
    b'16^[ c,] d_[ e] b'^[ c,^] d_[ g] b^[ c,] d_[ c']
    b^[ c,] e_[ d] b'^[ c,^] e_[ g] b^[ c,] e_[ c']
    b^[ c,] g'_[ d] b'^[ c,^] g'_[ e] b'^[ c,] g'_[ c]
    b^[ c,] c'_[ d,] b'^[ c,^] c'_[ e,] b'^[ c,] c'_[ g]  \break
    %85
    b^[ d,] c_[ e] b'^[ d,] c_[ g'] b^[ d,] c_[ c']
    b^[ d,] e_[ c] b'^[ d,] e_[ g] b^[ d,] e_[ c']
    b^[ d,] g_[ c,] b'^[ d,^] g_[ e] b'^[ d,] g_[ c]
    b^[ d,] c'_[ c,] b'^[ d,^] c'_[ e,] b'^[ d,] c'_[ g]  \break
    %89
    b^[ e,] c_[ d] b'^[ e,] c_[ g'] b^[ e,] c_[ c']
    b^[ e,] d_[ c] b'^[ e,] d_[ g]  b^[ e,] d_[ c']
    b^[ e,] g_[ c,] b'^[ e,] g_[ d] b'^[ e,] g_[ c]
    b^[ e,] c'_[ c,] b'^[ e,] c'_[ d,] b'^[ e,] c'_[ b] \break
    %93
    b^[ g] c,_[ d] b'^[ g] c,_[ e] b'^[ g] c,_[ c']
    b^[ g] d_[ c] b'^[ g] d_[ e] b'^[ g] d_[ c']
    b^[ g] e_[ c] b'^[ g] e_[ d] b'^[ g] e_[ c']
    b^[ g] c_[ c,] b'^[ g] c_[ d,] b'^[ g] c_[ e,] \break 
    %97
    b'^[ c] c,_[ d] b'^[ c] c,_[ e] b'^[ c] c,_[ g']
    b^[ c] d,_[ c] b'^[ c] d,_[ e] b'^[ c] d,_[ g]
    b^[ c] e,_[ c] b'^[ c] e,_[ d] b'^[ c]  e,_[ g]
    b^[ c] g_[ c,] b'^[ c] g_[ d] b'^[ c] g_[ e] \break
    }

    partSix = {
    %101
    c'16^[ c,] d_[ e] c'^[ c,^] d_[ g] c^[ c,] d_[ b']
    c^[ c,] e_[ d] c'^[ c,^] e_[ g] b^[ c,] e_[ b']
    c^[ c,] g'_[ d] c'^[ c,^] g'_[ e] c'^[ c,] g'_[ b]
    c^[ c,] b'_[ d,] c'^[ c,^] b'_[ e,] c'^[ c,] b'_[ g]  \break
    %105
    c^[ d,] c_[ e] c'^[ d,] c_[ g'] c^[ d,] c_[ b']
    c^[ d,] e_[ c] c'^[ d,] e_[ g] c^[ d,] e_[ b']
    c^[ d,] g_[ c,] c'^[ d,^] g_[ e] c'^[ d,] g_[ b]
    c^[ d,] b'_[ c,] c'^[ d,^] b'_[ e,] c'^[ d,] b'_[ g]  \break
    %109
    c^[ e,] c_[ d] c'^[ e,] c_[ g'] c^[ e,] c_[ b']
    c^[ e,] d_[ c] c'^[ e,] d_[ g]  c^[ e,] d_[ b']
    c^[ e,] g_[ c,] c'^[ e,] g_[ d] c'^[ e,] g_[ b]
    c^[ e,] b'_[ c,] c'^[ e,] b'_[ d,] c'^[ e,] b'_[ g] \break
    %113
    c^[ g] c,_[ d] c'^[ g] c,_[ e] c'^[ g] c,_[ b']
    c^[ g] d_[ c] c'^[ g] d_[ e] c'^[ g] d_[ b']
    c^[ g] e_[ c] c'^[ g] e_[ d] c'^[ g] e_[ b']
    c^[ g] b_[ c,] c'^[ g] b_[ d,] c'^[ g] b_[ e,] \break 
    %117
    c'^[ b] c,_[ d] c'^[ b] c,_[ e] c'^[ b] c,_[ g']
    c^[ b] d,_[ c] c'^[ b] d,_[ e] c'^[ b] d,_[ g]
    c^[ b] e,_[ c] c'^[ b] e,_[ d] c'^[ b]  e,_[ g]
    c^[ b] g_[ c,] c'^[ b] g_[ d] c'^[ b] g_[ e] \break
    }

\score {
    
    \relative c' {
    \time 3/4

    \partOne
    % \partTwo %these calls all commented out
    % \partThree
    % \partFour
    % \partFive
    % \partSix
  
    }
}
    
  \layout { indent = 0.0 }
  \midi {}

This is what it looks like when I try calling more then one of the 6 variables:

Garbled Output: Two line of music, on the second line note heads and stems are missing but beams are still visible

6
  • 1
    Would you please edit the question and add the code you are compiling?
    – Neal
    Aug 28, 2023 at 18:51
  • 1
    (or perhaps a version of the code that is greatly simplified, yet still exhibits the same bug) Aug 28, 2023 at 20:37
  • Thanks for the second update. When I un-comment parts two–six, it seem to work just fine — but I'm not using Hacklily; I suspect this bug has something to do with the complier. Aug 30, 2023 at 14:11
  • @ElementsinSpace I hadn’t tried that particular combination (2-6). Just tried now, and it doesn’t work in hacklily, so the problem may be their compiler or some other back end process.
    – Niall
    Aug 30, 2023 at 14:25
  • By "parts two–six", I mean "two through six" i.e. all of them; I couldn't get the bug to appear at all using an offline complier. Aug 30, 2023 at 14:31

4 Answers 4

1

Using the code from https://music.stackexchange.com/a/38118 this can be abbreviated to

\version "2.20.0"

\header {
  title = "Six Choose Four"
  composer = "Niall Mac Giolla Rua"
}

#(define (perm lst r)
  (if (zero? r) '(())
   (append-map
    (lambda (x)
     (append-map
      (lambda (old) (if (member x old) '() (list (cons x old))))
      (perm lst (1- r))))
    lst)))

showperm =
#(define-music-function (parser location r notes) (index? ly:music?)
  (make-sequential-music
   (map (lambda (x) (music-clone notes 'elements (ly:music-deep-copy x)))
        (perm (ly:music-property notes 'elements) r))))


\score {
  {
    \time 3/4
    \set beamExceptions = \beamExceptions { \repeat unfold 6 { 16[ 16] } }
    <<
      \showperm 4 { c'16 d' e' g' b' c'' }
      \repeat unfold 30 { \skip 2.*4 \break }
    >>
    \bar "|."
  }
}

\layout { short-indent = 0.0 indent = 0.0 }
\midi {}

and works fine in current LilyPond. Maybe the problem is with hacklily.org and/or the version of LilyPond it is running? There have been LilyPond versions that had problems with forced line breaks; this abbreviated input makes it easy to take out the forced breaks and see what happens.

1
  • This is amazing. Thank you. I knew there had to way of automating things with functions and loops, just didn’t know how! Unfortunately the website Hacklily.org doesn’t seem able for your code, but I’m trying create a set up on my iPad starting with a linux shell emulator I downloaded. This is all new for me but, I’ll look forward to trying your example out when I figure this set up. (I don’t have a computer!)
    – Niall
    Aug 30, 2023 at 15:49
1

I copied and pasted exactly what you entered in the question. I uncommented \partTwo and here's what it spat out. With this kind of inconsistency, it's probably best to find a different online LilyPond editor.

An absolutely baffling output from Hacklily.

Addendum: hovering over some of the notes that were not included references lines that are outside the scope of your code. In other words: "Find this note on line 410!" There were only 200 lines in your code. Something, somewhere, is colliding. It's like it's accidentally mixing up your piece with some piece somewhere else. Accordingly, it wouldn't surprise me if buggy code is getting silently inserted unbeknownst to you.

0
0

Anybody's guess without example code, but if you mix six parts via plain <<…>> into a single Voice context, "messed up" might describe the results pretty well since you get only one beaming, one stemming, one tie/fingering mechanism. Even tnough the noteheads will be at the right point of time but without proper collision avoidance.

0
0

If we stipulate that your other parts are similar to the first part (your example does not show the problem, so one has to fantasize about it), then it starts with an unqualified pitch c and ends with g a fifth above. If you put two of those parts in \relative, the second one will end up an octave higher than the first one.

The sanest solution is to put \relative c' in the definition of every "part" variable so that it won't bounce around in its octaves depending on what precedes it.

1
  • Hi I added the full code as per your suggestion, however, as I had said, the other variables are identical in length and structure (only the pitches change). Calling any one of the variables alone works. Calling more than one results in garbles. Thank you.
    – Niall
    Aug 30, 2023 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.