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 Jacques Menu Muzhic
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 
> <mailto: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/7b6b373bd4a16aac92eae68f7534113e>
> https://gist.github.com/devonlepage/6c92575e38f3e6e2bd78d07b35c6059c 
> <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 
> <mailto: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 

Fw: Lilypond document reformatting script?

2017-03-30 Thread m.tarensk...@zonnet.nl
Verzonden vanaf mijn Huawei mobiele telefoon Oorspronkelijk bericht Onderwerp: Re: Lilypond document reformatting script?Van: m.tarensk...@zonnet.nlAan: Devon LePage <devonlep...@gmail.com>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 <devonlep...@gmail.com>Aan: Urs Liska <u...@openlilylib.org>,lilypond-user@gnu.orgCc: 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/7b6b373bd4a16aac92eae68f7534113ehttps://gist.github.com/devonlepage/6c92575e38f3e6e2bd78d07b35c6059cThese 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 list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user



-- 
u...@openlilylib.org
https://openlilylib.org
http://lilypondblog.org
  

___
l

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  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  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  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 Urs Liska


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 list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user

-- 
u...@openlilylib.org
https://openlilylib.org
http://lilypondblog.org

___
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 Remy CLAVERIE
Hi Devon,

 

As a Python programmer I could help you, but I did not understand what is the 
job to do...

Could you send me some files and explain with a example what you'ld like ?

 

Thanks a lot

 

Rémy

 

 

 

 

 

> Message du 30/03/17 10:45
> De : "Devon LePage" 
> A : "Lilypond-User Mailing List" 

> Copie à : 
> Objet : Lilypond document reformatting script?
> 
>
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

___
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