@tombatossals/chords-db

repository·master·Indexed 20 days ago

https://github.com/tombatossals/chords-db

A JavaScript-based database of chords for string instruments, providing structured JSON data for piano and guitar. It includes chord definitions, fingerings, and positions (frets, fingers, barres, and capos) across various keys and qualities, including basic, seventh, extended, and add variations. The library is designed to be consumed by applications that render chord diagrams.

Tokens
10.1K
Snippets
47
Records
51
Agent score
68%

What's inside @tombatossals/chords-db

  1. Understand the chord data schema

    master

    The database stores chords as JavaScript objects where each chord contains a key, a suffix, and an array of positions. Each position represents a specific way to play the chord (a variation).

    Key fields within a position include:

    • frets: A string representing the fret number for each string (e.g., '0320xx').
    • fingers: A string representing the finger used for each string (e.g., '031000').
    • barres: An optional integer indicating if a barre is required.
    • capo: An optional boolean to indicate if the barre should be represented as a capo.
    export default {
      key: 'D',
      suffix: 'sus2',
      positions: [{
        frets: '0320xx',
        fingers: '031000'
      },
      {
        frets: '55775x',
        fingers: '114310',
        barres: 5,
        capo: true
      }]
    }
  2. Build and test the library

    master

    This project uses yarn as the package manager. Use the following commands to manage the library lifecycle:

    • yarn build: Generates a new version of the library (required when adding new chords).
    • yarn test: Runs tests on the added chords to detect basic mistakes.
    yarn build
    yarn test
  3. List of available piano chord types

    master

    The @tombatossals/chords-db package contains data for various piano chord types. When querying or working with the database, you can expect the following chord suffixes/qualities to be supported:

    • Basic/Standard: major, m (minor), dim, dim7, sus2, sus4, 7sus4, aug, aug7, aug9, 5, 6, 69, 7
    • Seventh/Extended Variations: 7b5, 7b9, 7sharp9, 7b5b9, 7sharp5b9, 7b5sharp9, 7sharp5sharp9, 9, 9b5, 9sharp11, 11, 13
    • Major Seventh/Add Variations: add9, maj7, maj7b5, maj7sharp5, maj9, maj11, maj13
    • Minor Seventh/Add Variations: m6, m69, m7, m7b5, m9, m11, mmaj7, mmaj7b5, mmaj7b9, mmaj7maj9, mmaj7maj11, madd9
    major, m, dim, dim7, sus2, sus4, 7sus4, aug, aug7, aug9, 5, 6, 69, 7, 7b5, 7b9, 7sharp9, 7b5b9, 7sharp5b9, 7b5sharp9, 7sharp5sharp9, 9, 9b5, 9sharp11, 11, 13, add9, maj7, maj7b5, maj7sharp5, maj9, maj11, maj13, m6, m69, m7, m7b5, m9, m11, mmaj7, mmaj7b5, mmaj7b9, mmaj7maj9, mmaj7maj11, madd9
  4. Access guitar chord data for key F

    master

    The src/db/guitar/chords/F/index.js file exports a default array containing all available guitar chord variations for the key of F. This includes major, minor, diminished, suspended, augmented, and various extended chord types (7ths, 9ths, 11ths, 13ths), as well as specific minor variations and other chord qualities.

    To use this data, you can import the default export from this path to get a collection of chord objects representing the key of F.

    import fChords from '@tombatossals/chords-db/src/db/guitar/chords/F/index.js';
    
    // fChords is an array containing all chord variations for the key of F
    console.log(fChords);
  5. Access guitar chord data for key C

    master

    The src/db/guitar/chords/C/index.js module exports a default array containing various guitar chord objects specifically for the key of C. This array includes major, minor, diminished, suspended, and various extended chord types (7ths, 9ths, 11ths, 13ths), as well as relative minor and altered chords.

    Each element in the exported array represents a specific chord configuration available in the key of C.

    import cChords from '@tombatossals/chords-db/src/db/guitar/chords/C/index.js';
    
    // cChords is an array of chord objects for the key of C
    console.log(cChords);
  6. Access piano chord data for the key of D

    master

    The src/db/piano/chords/D/index.js module exports a default array containing various piano chord definitions specifically for the key of D. This array includes a wide range of chord types such as major, minor, diminished, augmented, suspended, and various seventh, ninth, eleventh, and thirteenth chords. Each element in the array represents a specific chord configuration for the key of D.

    import dChords from '@tombatossals/chords-db/src/db/piano/chords/D/index.js';
    
    // dChords is an array of chord objects for the key of D
    console.log(dChords);
  7. Access guitar chord data for the key of E

    master

    The src/db/guitar/chords/E/index.js module exports a default array containing various guitar chord variations specifically for the key of E. This array includes major, minor, diminished, suspended, augmented, and various extended chord types (7ths, 9ths, 11ths, 13ths), as well as specific minor variations and altered chords.

    When importing this module, you receive a collection of chord objects that can be used to retrieve fingerings or chord properties for the key of E.

    import eChords from '@tombatossals/chords-db/src/db/guitar/chords/E/index.js';
    
    // eChords is an array containing all chord variations for the key of E
    console.log(eChords);
  8. Access piano chord data for the key of G

    master

    The src/db/piano/chords/G/index.js module exports a default array containing various piano chord definitions specifically for the key of G. Each element in the array represents a different chord type (e.g., major, minor, diminished, etc.) available in that key. This array can be imported and iterated over to access the specific note structures for each chord type in G.

    import gChords from './src/db/piano/chords/G/index.js';
    
    // gChords is an array of chord objects for the key of G
    console.log(gChords);
  9. Access guitar chord data for the key of Bb

    master

    The src/db/guitar/chords/Bb/index.js module exports a default array containing all available guitar chord data specifically for the key of Bb. This array includes various chord qualities such as major, minor, diminished, suspended, augmented, and extended chords (7ths, 9ths, 11ths, 13ths), as well as relative minor and other variations.

    When using this module, you receive an array of chord objects that can be iterated over to retrieve fingerings and structures for chords in the Bb key.

    import BbChords from './src/db/guitar/chords/Bb/index.js';
    
    // BbChords is an array of chord objects
    BbChords.forEach(chord => {
      console.log(chord);
    });
  10. Access piano chord data for the key of Bb

    master

    The src/db/piano/chords/Bb/index.js module exports a default array containing various piano chord definitions specifically for the key of Bb. This array includes a wide range of chord types such as major, minor, diminished, augmented, dominant 7th, suspended, and extended chords (9ths, 11ths, 13ths). Each element in the array represents a specific chord configuration available in the Bb key.

    import BbChords from '@tombatossals/chords-db/src/db/piano/chords/Bb/index.js';
    
    // BbChords is an array of chord objects for the key of Bb
    console.log(BbChords);
  11. Access piano chord data for Eb

    master

    The src/db/piano/chords/Eb/index.js module exports a default array containing various piano chord variations for the key of Eb. Each element in the array represents a specific chord type (e.g., major, minor, diminished, etc.) available for that key. This data is intended to be consumed by applications providing piano chord information.

    import ebChords from '@tombatossals/chords-db/src/db/piano/chords/Eb/index.js';
    
    // ebChords is an array of chord objects for the Eb key
    console.log(ebChords);