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