lilypond-user
[Top][All Lists]
Advanced

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

Re: splitting chords entered as <<c e g>>


From: chip
Subject: Re: splitting chords entered as <<c e g>>
Date: Wed, 14 Jan 2009 20:57:57 -0700
User-agent: Thunderbird 2.0.0.17 (X11/20080925)

David Raleigh Arnold wrote:
On Wednesday 14 January 2009, chip wrote:
I have a piece with three voices where all the notes where entered in this format -
<< c e g>> << d f a> etc for the entire piece.
Is there a way to have Lily split out the 3 voices into separate
parts,
or do I have to rewrite the entire .ly file?
Thanks,
Chip


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


It could be done with an editing tool, such as sed. "s" is for
substitute.

Substitute << followed by any number of spaces followed by
\(  at least one nonspace \) . Replace that with
a space followed by \1, which retrieves what was between the escaped parentheses. followed by another space. That gets the first pitch in each chord.
s/<< *\([^ ]+\)/ \1 /g

Now add whatever is after >> in a similar way, except the *
means any number of, while the plus meant at least one
nonspace [^ ]:

s/<< *\([^ ]+\).*>>\([^ ]*\)/ \1\2 /g

Cat or type your chords through sed with that command, and
you have the first part.

To get the next part, add to it.

s/<< *[^ ]+ +\([^ ]+\).*>>\([^ ]*\)/ \1\2 /g

and the next:

s/<< *[^ ]+ +\([^ ]+[^ ]+ +\([^ ]+\).*>>\([^ ]*\)/ \1\2 /g

Don't do sed in place ($ sed -i).  If I haven't messed up,
you've got it. GNU sed is gnarly but powerful. ;-) Regards, daveA

Gnarly is an understatement. Those lines of hieroglyphics actually do something? That's crazy!
--
Chip




reply via email to

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