NWC2 Scripts - Transpose_Chords


Author: Andrew Purdam.

Comments to NoteWorthy Composer Forum

Download: v1.0.2 2/12/04

(Rightclick and Save Target As... to your NWC2 Scripts folder as transpose_chords.php)

Briefly: Auto transpose chords written as text.
Usage: php transpose_chords.php <range> [<hint>] ["strict"] ["font="<fontname>]
Parameters:
range
is a required integer, -11 to +11, and is the transposition in semitones
hint
optional, is the key of the tune, of the form [A-G]([#b])(m|M|min|maj)
strict
optional keyword. Uses a stricter policy on what is a chord
font=<fontname>
optional, means only transpose chords displayed in font
Additional Help :
Invocation Instructions   This is a pdf document
Comments: eg php transpose_chords.php -4 C# font=StaffBold
If range is 0, and no hint is given, convert all enharmonic spellings
If range is not 0, and no hint is given, transpose according to "C"
A "text chord" is a piece of text of the regular-expression form
\s*[A-G][#b]? (leading space, uppercase A-G, optional # or b)
Trying to match the dim, dom, maj, aug, sus4, +9, add11, etc was considered fruitless but a keyword "strict" is available to try and limit what we call a chord
\s*[A-G][#b]? ?(M|maj|m|min|dim|dom|sus|aug|add|7|9|11|13|b5|b11|b13)?
(as above, but with optional trailing space followed by optional chord modifiers).
History: 1.0.2 Added message for empty input