API / MusicTheory
ChordTransposer static class
String-in, string-out chord transposition for lyric sheets and tools. Input that is not a chord symbol (
N.C., %, lyrics) is returned unchanged.Methods
static string Transpose(string chordSymbol, int semitones, KeySignature? targetKey = null, ChordSymbolStyle? style = null, SuffixHandling suffix = SuffixHandling.Canonical)Transposes a chord symbol by semitones. With a
targetKey the result is spelled in that key. Without one, the new root keeps the side of the old one (a sharp root keeps sharps, a flat root flats, a natural root uses Db Eb F# Ab Bb, so a plain Bb is never written A#), and the slash bass is spelled in the major key of the new root: D/F# up two semitones is E/G#.chordSymbol- The chord, e.g.
D/F#. semitones- Semitones up (positive) or down (negative).
targetKey- The key of the result, if known.
style- Output style; defaults to the input's own: Unicode accidentals if it uses ♭/♯, jazz glyphs if it uses ° ø Δ +.
suffix- With
SuffixHandling.KeepUnparsed, text that is not a chord but starts with a root (Cfoo/E) still moves its root and bass and keeps the rest as written. WithSuffixHandling.Verbatim, every chord keeps its suffix as written (C-7becomesD-7).
static string Transpose(string chordSymbol, KeySignature from, KeySignature to, ChordSymbolStyle? style = null, SuffixHandling suffix = SuffixHandling.Canonical)Transposes a chord symbol from one key to another, spelled in
to.