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: Jonathan Kulp
Subject: Re: convert from absolute to relative
Date: Thu, 21 Aug 2008 23:02:18 -0500
User-agent: Thunderbird 2.0.0.16 (X11/20080724)

Hi Neil,

I tried setting it to Nederlands just now but the output didn't change. It was still Italiano. Did I use the option correctly? Here's the format I tried:

cat file.ly | python lilymusic.py --out_style="nederlands" > file-new.ly

When I looked at the script that's what it looked like it ought to be.

Best,

Jon

Neil Thornock wrote:
Yota,
I will definitely have to have a close look at this, since I've attempted
the same thing in Python.  But like the comment above, I gave up after
trying to deal with all the various syntactical rules.  This might encourage
me to keep working at the effort, seeing you've gotten this far.

Jonathan - according to the script source, you can set the output style to
either Netherlands or Italian - but, as you noticed, the output default is
italian.

Thanks for this contribution Yota.

Neil

On Thu, Aug 21, 2008 at 8:44 PM, Jonathan Kulp <address@hidden>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


--
Jonathan Kulp
http://www.jonathankulp.com



_______________________________________________
lilypond-user mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-user





--
Jonathan Kulp
http://www.jonathankulp.com




reply via email to

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