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: Thu, 15 Jan 2009 16:05:59 -0700
User-agent: Thunderbird 2.0.0.17 (X11/20080925)

David Raleigh Arnold wrote:
On Wednesday 14 January 2009, you wrote:
David Raleigh Arnold wrote:
On Wednesday 14 January 2009, chip wrote:

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

You have a point. I found that it didn't work, possibly because of
changes in sed. You need -r to get extended regular expressions
now. Just run this on your chords. A batch file would be very
similar. Make it a .bat, get rid of the top line, change # to rem. Hopefully you wouldn't need
type %1 | sed
instead of putting the parameter at the ends.
#!/bin/bash
# split-chord
echo "part one"
sed '{
s/<< *\([^ ][^ ]*\)  *[^ ][^ ]*  *[^ ][^ ]* *>>\([0-9]*\)/\1\2 /g
}' $1
echo "part two"
sed '{
s/<< *[^ ][^ ]*  *\([^ ][^ ]*\)  *[^ ][^ ]* *>>\([0-9]*\)/\1\2 /g
}' $1
echo "part three"
sed '{
s/<< *[^ ][^ ]*  *[^ ][^ ]*  *\([^ ][^ ]*\) *>>\([0-9]*\)/\1\2 /g
}' $1

Easy to change << to < and >> to > above for a newer version.
You can put the results in separate files by adding:

}' $1 > yourfile.ly

Usage:
$ ./split-chord file
and copy off the screen, or:
$ ./split-chord file > yourparts.ly

Test:
Contents of file:
<<a b c>> << d e f >>4 <<gb h i>>8

Result:

part one
a  d4  gb8
part two
b  e4  h8
part three
c  f4  i8

Forgot the ,, and ''' but they're ok. I checked. Its done with
spaces and nonspaces. Regards, daveA
Thanks Dave,
Seems the script doesn't like the text in the file - using ^"some words" causes problems. Also, some of the articulations are a problem for it. When I finally got a resulting file the octaves were totally messed up, I had notes with ledger lines halfway up or down the page. Too much time editing the resulting file, I may as well just edit the original by hand.
thanks anyway,
Chip




reply via email to

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