lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: convert from absolute to relative


From: Steve Dunlop
Subject: RE: convert from absolute to relative
Date: Fri, 22 Aug 2008 07:46:05 -0700
User-agent: Web-Based Email 4.14.2

I shall eagerly await the development of a script that will work in the
reverse direction.  When I edit scores prepared by others (often in
relative mode) from the Mutopia Project, I often make changes that
disturb the octavation, and it's time consuming to go back and fix. 
Typically this happens when rearranging notes among voices, or changing
polyphonic notation to chord notation; less frequently when correcting
pitch errors.

I've come to the conclusion that, for me, it's faster to enter absolute
pitches when entering music because the time required to correct the
inevitable octavation errors is so much greater when working in relative
mode.

Steve

> -------- Original Message --------
> Subject: Re: convert from absolute to relative
> From: Jonathan Kulp <address@hidden>
> Date: Fri, August 22, 2008 7:27 am
> To: address@hidden
> Cc: address@hidden, address@hidden
> 
> 
> Ok I tried it after changing italiano to nederlands in the python script 
> (btw, you also have to change it on line 85 of lilymusic.py), and I 
> removed the head, layout, and paper blocks.  This all helps considerably.
> 
> Remaining problems:
> 
> 1. did not handle \clef indication--it changed "bass" to "b,ass", 
> causing errors in compiling
> 2. It put the "\relative g" (why G instead of C?) in the wrong place 
> causing file not to compile.  One of the problems is that instead of 
> simply adding "\relative do" or "\relative g", it also adds a bracket 
> (i.e. "\relative do {") that causes a bunch of "unexpected string" 
> errors.  I tried changing line 132 to keep it from inserting the brace, 
> but I did it wrong and it aborted the conversion.  I don't know Python 
> so I have no idea how to handle this.
> 
> Thanks again, Yota!  If you or the community get this working well it 
> could be a big help.  :)
> 
> Jon
> 
> 
> 
> Yota wrote:
> > Jonathan > thank you for the remarks and for the samples too.
> > 
> > Neil > I corrected this small bug, indeed the script didn't care of the 
> > options you fed it with. And if you prefer nederlands default output, 
> > just change in lilymusic.py line 38
> > lily_out_style = "italiano"
> > into
> > lily_out_style = "nederlands"
> > 
> > For today, I give up finding an easy way to parse a complex .ly file... 
> > i'll try later :D
> > 
> > Nevertheless, the script should run better. To launch it, you may copy 
> > the part containing only the notes into a separate file
> > 
> > ex : from
> > clarinet = { ... } or \new Staff {... }
> > extract { ... } (with the braces) and copy into a new file
> > 
> > 
> > to use it :
> > python lilymusic.py --out_style="nederlands" < test.ly > new.ly (thx carl)
> > 
> > to download it (new version) :
> > http://dl.free.fr/pXHJyTc5P
> > 
> > + handle comments and multiline comments
> > + put a \include "italiano.ly" on top according to the chosen style
> > ! corrected bug : you can now use --out_style
> > 
> > TODO
> > - handle properly \key indications
> > 
> > Yota
> > 
> > Jonathan Kulp wrote:
> >> This is a good idea, Yota.  I was going through some of my first 
> >> Lilypond files today and found that I had written them in absolute 
> >> mode and wished I'd had a script to convert them to relative.  I did 
> >> them by hand since they were very short, but for anything longer, a 
> >> script like yours would be very helpful.
> >>
> >> I ran your script on the test file "in.ly" included in your archive 
> >> and it seemed to work fine (the absolute pitches were changed to 
> >> relative) but then I couldn't get the resulting file to compile in 
> >> lilypond.  I worked on it for a few minutes but couldn't find the 
> >> problem and gave up.
> >>
> >> I also ran the python script on one of my own files and had problems 
> >> with it.  First of all, it doesn't seem to recognize comments 
> >> properly, as it goes through my comments changing them as if they were 
> >> pitch indications.  It did the same thing to the title in my Header 
> >> block and even added a stray { that caused errors when trying to 
> >> compile.  Also, I use the default Dutch pitch names, and while it read 
> >> them correctly, it also changed them to the Italian pitch names in the 
> >> conversion process.
> >>
> >> I wish I could help tweaking the code, but I have no idea how to write 
> >> in Python.  I'll be glad to test the script out when you make changes 
> >> to it, though.  Hope it helps to see these samples.
> >>
> >> Best,
> >>
> >> Jonathan
> >>
> >> %%%%%%%%%%%%%%%%%
> >>
> >> % My original file in absolute mode:
> >>
> >> \version "2.10.25"
> >> \header {
> >>   title = "1:1 Exercise 2"
> >>   composer = "Jonathan Kulp"
> >> }
> >>
> >> \paper {
> >> ragged-right = ##f
> >> }
> >>
> >> \layout {
> >> indent = 0.5\cm
> >> }
> >>
> >> \new PianoStaff <<
> >>   \new Staff {        \time 3/4
> >>     \key f \major
> >>     #(set-global-staff-size 24)
> >>
> >> % begin inserting notes for treble staff here
> >>
> >>     f'4 g' a'
> >>     e' f' d'
> >>     bes' a' g'
> >>     f'2 r4
> >>     \bar "||"
> >>   }
> >>
> >>   \new Staff {        \clef bass
> >>     \key f \major
> >>
> >> % begin inserting notes for bass staff here
> >>
> >>     s2.*4
> >>   }
> >> >>
> >>
> >> %%%%%%%%%%%%%%%%%%%%%%
> >>
> >> % Resulting file after running it through lilymusic.py
> >> % This file does not compile at all. See next example for
> >> % my adjustments to make it compile but it still has problems
> >> % after that...
> >>
> >> \version "2.10.25"
> >> \header {
> >>   title = "1:1 Exercise 2"\relative do { doomposer = "Jonathan Kulp"
> >> }
> >>
> >> \paper {
> >> ragged-right = ##fa
> >> }
> >>
> >> \layout {
> >> indent = 0.5\cm
> >> }
> >>
> >> \new PianoStaff <<
> >>   \new Staff {        \time 3/4
> >>     \key f \major
> >>     #(set-sollobal-staff-size 24)
> >>
> >> % sigin inserting notes faor treble staff here
> >>
> >>     fa'4 sol la
> >>     mi fa re
> >>     sib' la sol
> >>     fa2 r4
> >>     \bar "||"
> >>   }
> >>
> >>   \new Staff {        \clef si,ass
> >>     \key f \major
> >>
> >> % sigin inserting notes faor siass staff here
> >>
> >>     s2.*4
> >>   }
> >> >>
> >>
> >>
> >>
> >> %%%%%%%%%%%%%%%%%%%%%
> >>
> >> % same file after fixing the clef line and key indication, and removing
> >> % the extra { that was inserted in the title causing errors
> >> % This file compiles but the notes are in wrong octaves--
> >> % The absolute-to-relative didn't work right
> >> % Also you can see that it changes "composer" to "doomposer"
> >> % and I had to use \include "italiano.ly"
> >> % it changes ragged-right value to "##fa" instead of ##f
> >> % I also had to fix the #(set-global-staff-size line
> >>
> >>
> >> \version "2.10.25"
> >> \include "italiano.ly"
> >> \header {
> >>   title = "1:1 Exercise 2"
> >>   doomposer = "Jonathan Kulp"
> >> }
> >>
> >> \paper {
> >> ragged-right = ##fa
> >> }
> >>
> >> \layout {
> >> indent = 0.5\cm
> >> }
> >>
> >> \new PianoStaff <<
> >>   \new Staff {        \time 3/4
> >>     \key fa \major
> >>     #(set-global-staff-size 24)
> >>
> >> % sigin inserting notes faor treble staff here
> >>
> >>     fa'4 sol la
> >>     mi fa re
> >>     sib' la sol
> >>     fa2 r4
> >>     \bar "||"
> >>   }
> >>
> >>   \new Staff {        \clef bass
> >>     \key fa \major
> >>
> >> % sigin inserting notes faor siass staff here
> >>
> >>     s2.*4
> >>   }
> >> >>
> >>
> >>
> >> Yota wrote:
> >>> Good evening everybody,
> >>>
> >>> Being unable to find a nice tool to handle lilypond sources, I 
> >>> designed mine.
> >>>
> >>> I worked on this little script which (even if its buggy) should 
> >>> perform some essential tasks:
> >>>
> >>> - convert absolute music to relative music
> >>> - transpose the source (from bes to c for example)
> >>> - change the naming scheme
> >>>
> >>> in the future I hope it will also
> >>>
> >>> - shrink R1 R1 R1 R1 R1 R1 R1 R1 R1 R1 R1 stuffs into R1 * 11
> >>>
> >>> the parser is very naive and need to be improved, but the code should 
> >>> be flexible enough to let some room for improvements.
> >>>
> >>> if you wanna play with it, download it from 
> >>> http://dl.free.fr/mQx7nFhQQ , expand it and use python. The main 
> >>> script is lilymusic.py ; to be feeded from the stdin.
> >>>
> >>> ex : cat in.ly | python lilymusic.py
> >>>
> >>>
> >>>
> >>> feedback appreciated
> >>>
> >>> ... now goin' to bed
> >>>
> >>>
> >>> _______________________________________________
> >>> lilypond-user mailing list
> >>> address@hidden
> >>> http://lists.gnu.org/mailman/listinfo/lilypond-user
> >>>
> >>
> > 
> > 
> > 
> > _______________________________________________
> > lilypond-user mailing list
> > address@hidden
> > http://lists.gnu.org/mailman/listinfo/lilypond-user
> > 
> 
> -- 
> Jonathan Kulp
> http://www.jonathankulp.com
> 
> 
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/lilypond-user





reply via email to

[Prev in Thread] Current Thread [Next in Thread]