Re: Lilypond document reformatting script?

2017-03-30 Thread Devon LePage
Jacques—

Personally, I would prefer to have a line-breaking script that works
directly on the LilyPond code. Although solving the messy XML import
problem is priority right now, my wish is to eventually have a more complex
“reformat” script.

I will send you the file in a private email.

-Devon.

On Thu, Mar 30, 2017 at 1:23 PM Jacques Menu Muzhic <imj-muz...@bluewin.ch>
wrote:

Hello Devon,

Can you send me one those XML files privately? I’d like to perform some
experiments.

Thanks!

Le 30 mars 2017 à 21:48, m.tarensk...@zonnet.nl a écrit :



Verzonden vanaf mijn Huawei mobiele telefoon


 Oorspronkelijk bericht 
Onderwerp: Re: Lilypond document reformatting script?
Van: m.tarensk...@zonnet.nl
Aan: Devon LePage
Cc:


Maybe an alternative option is to write a python script to manipulate the
musicxml code, befóre feeding it to musicxml2ly?

After that such code might be useful to improve musicxml2ly in the future?

Just a thought.

Verzonden vanaf mijn Huawei mobiele telefoon


 Oorspronkelijk bericht 
Onderwerp: Re: Lilypond document reformatting script?
Van: Devon LePage
Aan: Urs Liska ,lilypond-user@gnu.org
Cc:


Rémy—

Whenever I use musicxml2ly on a MusicXML file generated by Smart Score X2,
I get LilyPond code that looks something like this:

{
a4 b4 c4 d4 e4 f4
g2 g8 f8 e8 d8 c8
b8 \times 2/3 {
a8 b8 c8
}
}

I would like to create a Python script that would reformat the code to look
like this:

{
a4 b4 c4 d4 |
e4 f4 g2 |
g8 f8 e8 d8 c8 b8 \times 2/3 { a8 b8 c8 } |
}

Please see my response to Urs for more information and more examples of
“messy” code generated by musicxml2ly.

-Devon.


On Thu, Mar 30, 2017 at 5:20 AM Devon LePage <devonlep...@gmail.com> wrote:

Urs—

Here are 2 gists that contain “messy" excerpts from a MusicXML file:

https://gist.github.com/devonlepage/7b6b373bd4a16aac92eae68f7534113e
https://gist.github.com/devonlepage/6c92575e38f3e6e2bd78d07b35c6059c

These are from a transcription of a John Coltrane performance, unrelated to
my main project. When I use musicxml2ly on any MusicXML files created in
Smart Score X2, I have similar issues. As you can see:

—there is not a bar-check after every measure
—bar-checks occur infrequently and in more-or-less random locations within
the document (in the full document, they occur at bars 62, 65, and 68, but
then not another until bar 105!)
—sometimes bar-checks appear as “\barNumberCheck” followed by the expected
bar number, but these checks also seem to occur at random
—the first notes of a measure do not reliably appear at the beginning of a
line of code
—tuplets are always spaced across 3 lines
—inconsistent whitespace around braces, especially tuplets (look at the
final one in the 2nd gist)

-Devon.

On Thu, Mar 30, 2017 at 3:20 AM Urs Liska <u...@openlilylib.org> wrote:



Am 30.03.2017 um 10:45 schrieb Devon LePage:

I’m currently working on a project that involves importing a lot of music
into LilyPond via MusicXML. (Before this, the music is scanned and OCR-ed
in Smart Score X2, if that is relevant.)

Unfortunately, the resulting LilyPond code is a bit messy and difficult to
read. I'd like to reformat these files so that there’s only one measure on
each indented line.

Doing this by hand takes up a significant amount of time, so I’ve been
trying to create a python script that uses the ly.lex package to do this.
Has anyone already done this? I couldn’t find anything, so I tried to do it
myself. But after four hours of frustration I'm starting to think that I
might be too much of a novice to figure this out. There are just too many
moving parts for me—I’m having a hard time just figuring out how to add a
newline in the middle of a small lilypond document. I’m also unsure how to
incorporate tuplets into the determination of a measure.

I’m wondering if there’s a wizard here on the mailing list who might be
able to help me out? (Another dream would be to have a function that adds a
second newline after every group of N-measures.)

At the very least, maybe someone could point me in the right direction:
what do I need to read/understand to figure this out? How would one go
about doing this?


I've only tested one random MusicXML file, so I can't fully comment.
But it seems that musicxml2ly generates barchecks ("|") for every measure.
So you can simply use *these* to identify possible line breaks, without
actually going down the road of analyzing the content.

But my converted file actually *did* place one measure in a line, so I
don't see your problem. Could you please share some of that "messy"
LilyPond code?

Urs



Thanks,
-Devon.


___
lilypond-user mailing
listlilypond-user@gnu.orghttps://lists.gnu.org/mailman/listinfo/lilypond-user


-- ul@openlilylib.orghttps://openlilylib.orghttp://lilypondblog.org

___
lilypond-user mailing list

Re: Lilypond document reformatting script?

2017-03-30 Thread Devon LePage
Rémy—

Whenever I use musicxml2ly on a MusicXML file generated by Smart Score X2,
I get LilyPond code that looks something like this:

{
a4 b4 c4 d4 e4 f4
g2 g8 f8 e8 d8 c8
b8 \times 2/3 {
a8 b8 c8
}
}

I would like to create a Python script that would reformat the code to look
like this:

{
a4 b4 c4 d4 |
e4 f4 g2 |
g8 f8 e8 d8 c8 b8 \times 2/3 { a8 b8 c8 } |
}

Please see my response to Urs for more information and more examples of
“messy” code generated by musicxml2ly.

-Devon.


On Thu, Mar 30, 2017 at 5:20 AM Devon LePage <devonlep...@gmail.com> wrote:

> Urs—
>
> Here are 2 gists that contain “messy" excerpts from a MusicXML file:
>
> https://gist.github.com/devonlepage/7b6b373bd4a16aac92eae68f7534113e
> https://gist.github.com/devonlepage/6c92575e38f3e6e2bd78d07b35c6059c
>
> These are from a transcription of a John Coltrane performance, unrelated
> to my main project. When I use musicxml2ly on any MusicXML files created in
> Smart Score X2, I have similar issues. As you can see:
>
> —there is not a bar-check after every measure
> —bar-checks occur infrequently and in more-or-less random locations within
> the document (in the full document, they occur at bars 62, 65, and 68, but
> then not another until bar 105!)
> —sometimes bar-checks appear as “\barNumberCheck” followed by the expected
> bar number, but these checks also seem to occur at random
> —the first notes of a measure do not reliably appear at the beginning of a
> line of code
> —tuplets are always spaced across 3 lines
> —inconsistent whitespace around braces, especially tuplets (look at the
> final one in the 2nd gist)
>
> -Devon.
>
> On Thu, Mar 30, 2017 at 3:20 AM Urs Liska <u...@openlilylib.org> wrote:
>
>
>
> Am 30.03.2017 um 10:45 schrieb Devon LePage:
>
> I’m currently working on a project that involves importing a lot of music
> into LilyPond via MusicXML. (Before this, the music is scanned and OCR-ed
> in Smart Score X2, if that is relevant.)
>
> Unfortunately, the resulting LilyPond code is a bit messy and difficult to
> read. I'd like to reformat these files so that there’s only one measure on
> each indented line.
>
> Doing this by hand takes up a significant amount of time, so I’ve been
> trying to create a python script that uses the ly.lex package to do this.
> Has anyone already done this? I couldn’t find anything, so I tried to do it
> myself. But after four hours of frustration I'm starting to think that I
> might be too much of a novice to figure this out. There are just too many
> moving parts for me—I’m having a hard time just figuring out how to add a
> newline in the middle of a small lilypond document. I’m also unsure how to
> incorporate tuplets into the determination of a measure.
>
> I’m wondering if there’s a wizard here on the mailing list who might be
> able to help me out? (Another dream would be to have a function that adds a
> second newline after every group of N-measures.)
>
> At the very least, maybe someone could point me in the right direction:
> what do I need to read/understand to figure this out? How would one go
> about doing this?
>
>
> I've only tested one random MusicXML file, so I can't fully comment.
> But it seems that musicxml2ly generates barchecks ("|") for every measure.
> So you can simply use *these* to identify possible line breaks, without
> actually going down the road of analyzing the content.
>
> But my converted file actually *did* place one measure in a line, so I
> don't see your problem. Could you please share some of that "messy"
> LilyPond code?
>
> Urs
>
>
>
> Thanks,
> -Devon.
>
>
> ___
> lilypond-user mailing 
> listlilypond-user@gnu.orghttps://lists.gnu.org/mailman/listinfo/lilypond-user
>
>
> -- ul@openlilylib.orghttps://openlilylib.orghttp://lilypondblog.org
>
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Lilypond document reformatting script?

2017-03-30 Thread Devon LePage
Urs—

Here are 2 gists that contain “messy" excerpts from a MusicXML file:

https://gist.github.com/devonlepage/7b6b373bd4a16aac92eae68f7534113e
https://gist.github.com/devonlepage/6c92575e38f3e6e2bd78d07b35c6059c

These are from a transcription of a John Coltrane performance, unrelated to
my main project. When I use musicxml2ly on any MusicXML files created in
Smart Score X2, I have similar issues. As you can see:

—there is not a bar-check after every measure
—bar-checks occur infrequently and in more-or-less random locations within
the document (in the full document, they occur at bars 62, 65, and 68, but
then not another until bar 105!)
—sometimes bar-checks appear as “\barNumberCheck” followed by the expected
bar number, but these checks also seem to occur at random
—the first notes of a measure do not reliably appear at the beginning of a
line of code
—tuplets are always spaced across 3 lines
—inconsistent whitespace around braces, especially tuplets (look at the
final one in the 2nd gist)

-Devon.

On Thu, Mar 30, 2017 at 3:20 AM Urs Liska <u...@openlilylib.org> wrote:

>
>
> Am 30.03.2017 um 10:45 schrieb Devon LePage:
>
> I’m currently working on a project that involves importing a lot of music
> into LilyPond via MusicXML. (Before this, the music is scanned and OCR-ed
> in Smart Score X2, if that is relevant.)
>
> Unfortunately, the resulting LilyPond code is a bit messy and difficult to
> read. I'd like to reformat these files so that there’s only one measure on
> each indented line.
>
> Doing this by hand takes up a significant amount of time, so I’ve been
> trying to create a python script that uses the ly.lex package to do this.
> Has anyone already done this? I couldn’t find anything, so I tried to do it
> myself. But after four hours of frustration I'm starting to think that I
> might be too much of a novice to figure this out. There are just too many
> moving parts for me—I’m having a hard time just figuring out how to add a
> newline in the middle of a small lilypond document. I’m also unsure how to
> incorporate tuplets into the determination of a measure.
>
> I’m wondering if there’s a wizard here on the mailing list who might be
> able to help me out? (Another dream would be to have a function that adds a
> second newline after every group of N-measures.)
>
> At the very least, maybe someone could point me in the right direction:
> what do I need to read/understand to figure this out? How would one go
> about doing this?
>
>
> I've only tested one random MusicXML file, so I can't fully comment.
> But it seems that musicxml2ly generates barchecks ("|") for every measure.
> So you can simply use *these* to identify possible line breaks, without
> actually going down the road of analyzing the content.
>
> But my converted file actually *did* place one measure in a line, so I
> don't see your problem. Could you please share some of that "messy"
> LilyPond code?
>
> Urs
>
>
>
> Thanks,
> -Devon.
>
>
> ___
> lilypond-user mailing 
> listlilypond-user@gnu.orghttps://lists.gnu.org/mailman/listinfo/lilypond-user
>
>
> -- ul@openlilylib.orghttps://openlilylib.orghttp://lilypondblog.org
>
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Lilypond document reformatting script?

2017-03-30 Thread Devon LePage
I’m currently working on a project that involves importing a lot of music
into LilyPond via MusicXML. (Before this, the music is scanned and OCR-ed
in Smart Score X2, if that is relevant.)

Unfortunately, the resulting LilyPond code is a bit messy and difficult to
read. I'd like to reformat these files so that there’s only one measure on
each indented line.

Doing this by hand takes up a significant amount of time, so I’ve been
trying to create a python script that uses the ly.lex package to do this.
Has anyone already done this? I couldn’t find anything, so I tried to do it
myself. But after four hours of frustration I'm starting to think that I
might be too much of a novice to figure this out. There are just too many
moving parts for me—I’m having a hard time just figuring out how to add a
newline in the middle of a small lilypond document. I’m also unsure how to
incorporate tuplets into the determination of a measure.

I’m wondering if there’s a wizard here on the mailing list who might be
able to help me out? (Another dream would be to have a function that adds a
second newline after every group of N-measures.)

At the very least, maybe someone could point me in the right direction:
what do I need to read/understand to figure this out? How would one go
about doing this?

Thanks,
-Devon.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Guitar bend error

2016-04-24 Thread Devon LePage
Thanks to everyone who responded! I appreciate it.

I think I might have some followup questions - like, how come the graceBend
slurs are always facing down in the output when it says “up” in the
definitions file? - but I’ll see if I can get the openlilylib files to work
first.

Although I want this score to have a TabStaff, the main reason I was using
Stephen MacNeil’s code library is because in general I need bend slurs
without the TabStaff. Thanks for that, Stephen!

-Devon.

On Sun, Apr 24, 2016 at 3:18 PM Federico Bruni  wrote:

> On Sun, Apr 24, 2016 at 11:38:31PM +0200, Thomas Morley wrote:
> > 2016-04-24 17:13 GMT+02:00 Stephen MacNeil :
> > >
> > > It was written by Marc Hohl I just adapted it to have no tab since I
> don't
> > > use tab
> > >
> > >
> > > see
> > >
> > >
> https://github.com/openlilylib/openlilylib/tree/master/notation-snippets/guitar-string-bending
> > >
>
> For the records, this is the new home:
> https://github.com/openlilylib/snippets/tree/master/ly/tablature
>
> (the file is the same as in the old one, but future updates will be
> pushed to the new location.. unless Urs wants to keep the old
> in sync)
>
> > > Line breaks over bending notes are not supported and they are currently
> > > disabled, because otherwise the file would not compile as soon as page
> > > formatting decisions create such a situation.
> >
> >
> >
> > Manual inserting \noBreak or \break will probably not enough, without
> > \layout { \autoLineBreaksOff }
> >
> > Opposed to what is claimed in the quote from openlilylib above,
> > disabling line-breaks do not work sufficiently.
>
> I can add this to the README on github.
>
> > See the out put from:
> > \include "definitions.ily"
> >
> > \displayLilyMusic
> > \relative c'' {
> > \bendOn
> > c1( d)
> > c1( d)
> > }
> >
> > It returns in terminal:
> >
> > { { \override Voice.Slur.stencil = #slur::draw-pointed-slur
> > \override TabVoice.Slur.stencil = #slur::draw-bend-arrow
> > c''1( \noBreak } d''1) c''1( d''1) }
> >
> > The overrides last until the end, but the \noBreak occurs only once!!
> >
>
> True. Better to avoid these (likely) errors and use manual breaks.
> Minimal example reworked in the new openlilylib style:
>
> \version "2.19.40"
> \include "openlilylib"
>
> \useLibrary Tablature
> % Workaround for issue #136 at
> % https://github.com/openlilylib/snippets/issues/136
> #(display "")
> \useModule tablature.bending
>
> % Hack needed until issue #136 is fixed:
> % https://github.com/openlilylib/openlilylib/issues/136
> #(ly:message "loaded")
>
>
> music = \relative c'' {
>   \displayLilyMusic
>   \bendOn
>   c1( d)
>   c1( d)
>   c1( d)
>   c1( d)
>   c1( d)
>   c1( d)
>   c1( d)
>   c1( d)
>   c1( d)
>   c1( d)
>   c1( d)
>   c1( d)
> }
>
> \new StaffGroup <<
>   \new Voice \music
>   \new TabVoice \music
> >>
> % comment this line and it won't compile
> \layout { \autoLineBreaksOff }
>
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Guitar bend error

2016-04-23 Thread Devon LePage
I’m transcribing a rock guitar solo, and to engrave the many string bends
I’m using Stephen MacNeil’s LilyPond code library, available here:

http://mglessons.com/lilypond/

If I use the “definitions_No-Tab.ly” file, LilyPond engraves the file with
no hiccups. However, if I use the “definitions.ily” for notation and TAB, I
get the following error:

Drawing systems...
/Users/devon/Downloads/lilypond-archive/guitar_functions/definitions.ily:180:14
<0>: In procedure ly:event-property in expression (ly:event-property
(event-cause right-bound) (quote pitch)):

/Users/devon/Downloads/lilypond-archive/guitar_functions/definitions.ily:180:14
<1>: Wrong type argument in position 1 (expecting Prob): #f

Exited with return code 1.


Learning Scheme is still on my to-do list, so I don’t quite understand
what’s going on here. Frustratingly, I can’t seem to localize the error -
I’ve tried compiling the file with different sections commented out, but
the error isn’t consistently generated. A few times it happened at bar 13,
but then it happened at bar 31, and then a few more times at places in
between. It reliably compiles for the first 12 bars, but that’s it.


I’ve put the LilyPond code in a Gist here:


https://gist.github.com/devonlepage/624c66513538ad6b42de0f665857ade7


This is the first third of the transcription. I’m hoping it will be enough
that someone might be able to diagnose the problem. I’ve taken out all
extraneous formatting code, which didn’t seem to effect the error.


I’m using Frescobaldi 2.19 with LilyPond 2.19.40. It also happens in 2.18.
I would prefer to use 2.19 so that I can use an alternative music font in
the final document.


I hope someone can help me figure out what’s going on.


Thanks!


-Devon LePage.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user