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: David Raleigh Arnold
Subject: Re: splitting chords entered as <<c e g>>
Date: Wed, 14 Jan 2009 21:37:25 -0500
User-agent: KMail/1.9.9

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

-- 
Free download of technical exercises worth a lifetime of practice:
http://www.openguitar.com/dynamic.html :::: You can play the cards
you're dealt, or improve your hand with DGT.  Very easy guitar
music, solos, duets, exercises.., To contact, visit openguitar.com




reply via email to

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