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>>^"with stuff" \etc


From: David Raleigh Arnold
Subject: Re: splitting chords entered as <<c e g>>^"with stuff" \etc
Date: Fri, 16 Jan 2009 10:59:31 -0500

On Thursday 15 January 2009, you wrote:
> 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
> 

The octaves are not changed as long as there's no \relative.

If you update the chords:
s/<</</g
s/>>/>/g

perhaps you could use a newer version of lilypond to change from
\relative to absolute pitches. I'm not sure whether that can be done
by having lilypond print out your code but it was requested
as a feature quite a bit. 

^"additions with spaces" should be no problem.  Change
this: [0-9]* to this: [^<]* in all 3 lines and use a single
< in the beginning because otherwise you will skip every
even chord. The << won't be found because the first < will
have been already read. The new line is to delete the other <.
I was just thinking time values.

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

I enjoyed this. I needed the review. 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]