Hello -
I have a collection of about 70 songs, containing lyrics and chords --
many of which I need to transpose. They're all in separate Microsoft
Word files. I need an intelligent "search and replace" macro written
that I can run within Word that will transpose a file.
The program should do the following:
Prompts the user for two inputs: 1) the existing key and 2) the
desired new key to the song. It will then traverse the document and
transpose every chord to the new key. There is a chart containing the
1-7 chords in all the keys at this link:
http://www.guitarforbeginners.com/capo.html
Some of these songs have more complicated chords, with adjacent
superscripts such as 9th's, 11th's, etc. However, this shouldn't be a
problem, as the program could simply identify the fundamental chord
and leave everything to the immediate right of it the same (with the
exception of encountering a "/"
character). For example:
Cm(Add9b5)/Bb
In this case, the program would identify the first character (C) and
change it to the appropriate new root chord letter; it would then scan
for a "/" character; if found, it would advance to the next, immediate
alpha character (B), changing that to the appropriate new root chord
letter. The "(Add9b5)" would remain intact, as would any accidentals
or additional characters. It would then advance to the next chord (or
chord combo). The end of the line I believe could be a hard return
character. I don't know the optimum way for the program to determine
a "chord line" vs. a "lyric line." There's no consistency in regards
to the use of tab characters and space characters. However, as the
first criterion, any line containing am, bm, cm, dm, em, fm, or gm
(even with any characters in between the chord letter and the "m",
case insensitive) should be considered a "chord line" immediately.
Perhaps the next criterion could be to see if there are any uppercase
characters, A through G, either prepended or appended by a tab, a
numerical character, or more than 2 spaces? There may be a better
way.
The program would make its way through to the end of the document,
processing all chord lines and be finished when there are no more
chord lines to process.
An example of a few lines of one of the files:
C D F G Dm Cm7
This is a sample lyric line with chords above it
E Fm7/G A B9 B11
This is a sample lyric line with chords above it
E G B Em Am G7sus
Chorus: This is a sample lyric line with chords above it
F Gm B9 Bb9
This is a sample lyric line with chords above it
Please feel free to ask for any clarification.
barryf |