chord_transposer 0.0.2 copy "chord_transposer: ^0.0.2" to clipboard
chord_transposer: ^0.0.2 copied to clipboard

A Dart package for transposing chords into any given key.

A Dart package for transposing chords into any given key.

Features #

  • Transpose chords from one key to another
  • Transpose chords up or down semitones
  • Find chords in lyrics and transpose them into another key
  • Find chords in lyrics and transpose up or down semitones

Usage #

First initialize the ChordTransposer:

final transposer = ChordTransposer();
copied to clipboard

Transpose chords #

Transpose a single chord from one key to another:

transposer.chordToKey(chord: 'D/F#', fromKey: 'A', toKey: 'G'); // => C/E
copied to clipboard

Transpose multiple chords from one key to another. If fromKey is not given, it will use the first chord in the list:

transposer.chordsToKey(chords: ['C', 'F', 'Am', 'G7', 'Bdim'], toKey: 'E'); // => [E, A, C#m, B7, D#dim]
copied to clipboard

Transpose a single chord up or down semitones:

transposer.chordUp(chord: 'D', semitones: 5); // => G
transposer.chordDown(chord: 'Bb', semitones: 2); // => Ab
copied to clipboard

Transpose multiple chords up or down semitones:

transposer.chordsUp(chords: ['D','Aadd9'], semitones: 4); // => [Gb, Dbadd9]
transposer.chordsDown(chords: ['Bb7/D', 'Eb'], semitones: 6); // => [E7/G#, A]
copied to clipboard

Transpose lyrics #

final lyrics = '''
[C]Twinkle, twinkle [F]little [C]star.
[F]How I [C]wonder [G7]what you [C]are.
''';
copied to clipboard

Tranpose lyrics from one key to another. If fromKey is not given, it will use the first chord in the lyrics. When ignoreInvalids is set to true (default), it will ignore all invalid chords. When it is set to false, it will throw an error if there is an invalid chord:

transposer.lyricsToKey(lyrics: lyrics, fromKey: 'C', toKey: 'G'); // =>
// [G]Twinkle, twinkle [C]little [G]star.
// [C]How I [G]wonder [D7]what you [G]are.
copied to clipboard

Transpose lyrics up or down semitones:

transposer.lyricsUp(lyrics: lyrics, semitones: 5); // =>
// [F]Twinkle, twinkle [A]little [F]star.
// [Bb]How I [F]wonder [C7]what you [F]are.

transposer.lyricsDown(lyrics: lyrics, semitones: 3); // =>
// [A]Twinkle, twinkle [D]little [A]star.
// [D]How I [A]wonder [E7]what you [A]are.
copied to clipboard

Additional information #

This package built to work with paurakhsharma's flutter_chord package and was inpsired by ddycai's chord-transposer npm package.

5
likes
140
points
23
downloads

Publisher

verified publisherjakesmd.dev

Weekly Downloads

2024.07.09 - 2025.01.21

A Dart package for transposing chords into any given key.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

More

Packages that depend on chord_transposer