Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can we included a chord database here ? #40

Open
imiskolee opened this issue Nov 15, 2020 · 18 comments
Open

can we included a chord database here ? #40

imiskolee opened this issue Nov 15, 2020 · 18 comments

Comments

@imiskolee
Copy link

imiskolee commented Nov 15, 2020

hi,team:
can we have a chrod database here, then we can use human friendly chord name like C7 / Gsus4.

@Aduffy
Copy link

Aduffy commented Nov 15, 2020

there is a good looking database @ https://github.com/tombatossals/chords-db/blob/master/lib/guitar.json that i am thinking of integrating in my project.

@omnibrain
Copy link
Owner

That's a good idea but I'm a bit hesitant to integrate a complete chord database in this library as it would considerably increase the size of the library and might not be needed for all use cases.

What would be really cool is a plugin system so that a chord db can be loaded optionally. I'll think about how to best implement that.

@imiskolee
Copy link
Author

@omnibrain sure, we don't need directly including any database inside the project.

@Aduffy
Copy link

Aduffy commented Nov 26, 2020

What would be RELAY great would be if there was a more standardized format for defining a chord.

https://github.com/tombatossals/chords-db has a large database, but it seems to have a week structure definition for barres (unless I missed something )

https://github.com/moonwave99/fretboard.js although more of a full fretboard for scales etc, does support chords

and of coarse this project...

omnibrain pushed a commit that referenced this issue Nov 27, 2020
@omnibrain
Copy link
Owner

I'm working on a simple plugin system that should allow extending SVGuitar with any functionality. After that I will create a plugin that includes some kind of chart database.

And yes I agree a standard format would be great!

omnibrain pushed a commit that referenced this issue Nov 28, 2020
@omnibrain
Copy link
Owner

I have started writing a transformer that takes data from https://github.com/tombatossals/chords-db and transforms it to a format svguitar can understand and render, but I don't really understand the way the barre chords are defined in tombatossals/chords-db... How can I from a single number determine on which fret and from which string to which string the barre chord should be drawn? I have tried to understand the logic but failed, so I'm afraid I have hit a dead end until someone can explain this to me.

@Aduffy
Copy link

Aduffy commented Nov 29, 2020

I opened a issue on tombatossals about the structure of barres and he said that when he built it he had not considered multiple bars in a single chord.. He is open to recommendations..

tombatossals/chords-db#18

@Aduffy
Copy link

Aduffy commented Nov 30, 2020

Looking over some of the chords on https://github.com/tombatossals/chords-db , it seems that the bar only indicates the fret, and the notes to play are shown on top of the full barre.. Or maybe the high and low not on that fret define the barre length ..

Clearly a problem for Chords like

image

that his tool draws as
image

So based on that.. perhaps the logic is

If there are no notes behind the bar, draw bar from lowest to highest string using data from notes (fingers) on same fret as barre..

If there are notes behind bar as per this example then need to create one or more bars based on notes on consecutive strings.

@imiskolee
Copy link
Author

@Aduffy

great idea! i think we can using MusicXML / MNX format to describe chord and make it's a generic library.

@imiskolee
Copy link
Author

@omnibrain looks barre of chords-db doesn't work. I am thinking to use a rule to decide how to render barre:

  1. chord must be barre if a finger used on multi strings.

@omnibrain
Copy link
Owner

@imiskolee Unfortunately I don't think it's that easy, eg this chord:

image

.. would be rendered like this:

image

@imiskolee
Copy link
Author

@omnibrain you can see string 2 and 4 gt others. it's meaning fret 1 can cross it.

@Aduffy
Copy link

Aduffy commented Dec 8, 2020

@omnibrain that was why i commented
"If there are no notes behind the bar, draw bar from lowest to highest string using data from notes (fingers) on same fret as barre.."

your example fits that case.

@TormodKv
Copy link

TormodKv commented Sep 20, 2021

I made a pretty big chord database: https://github.com/TormodKv/SVGuitar-ChordCollection
It's based on https://github.com/T-vK/chord-collection
I haven't done a lot of quality testing, but i think it's pretty accurate, but it doesn't include numbers for each finger

@omnibrain
Copy link
Owner

@TormodKv I think I started writing a SVGuitar plugin a while a go based on your chords db but then I started a new job and didn‘t have time to finish it… When I have some time I‘ll check if I can get it to a state where I could release it… as far as I remeber I was pretty much done with the plugin (and the plugin system for SVGuitar)

@Haschtl
Copy link

Haschtl commented May 24, 2024

I've created an example page based on @TormodKv's database, where you can quickly see and download lots of different chords - might be helpful for someone: https://haschtl.github.io/guitar-chord-library/

Note: I've made some small modifications in the database and the converter-script, because some fingerings were not ideal and I wanted the fingerings to be displayed in the SVGs. I also added the tuning to the SVGs

@Kernix13
Copy link

That's nice. I need to learn how to use JS to make SVG guitar chords

@parent-tobias
Copy link

That's nice. I need to learn how to use JS to make SVG guitar chords

I built a lit.js web component wrapper for svguitar that does exactly that. There were a series of steps involved.

First, I've defined six string presets: Standard Guitar, Drop-D Guitar, Standard Mandolin, Standard Ukulele, Baritone Ukulele, and 5ths tuned Ukulele. The presets define how many strings and the tuning of each one.

Second, given a chord name (C7, EbDim), I break it into a key and a variant. Each chord is defined as steps from the base of the chord - so a min is [0, 3, 7] from the given base.

Third, given the base and intervals for a given chord, I can map out the note names of that chord (given C and [0 3, 7], I can find the Cmin notes: ["C", "Eb", "G"]).

The instrument object tells me the open tone pitch of each string - so in an extremely lazy test, I find the first fret on each string yielding a note in that chord. In most cases it works quite well, but as it is lazy searching it isn't checking that all now in a given chord are in, and it isn't using barres.

For cases like that, I'm setting up a cascading preference system. In order, it will eventually look for:

  • user defined song chord; then
  • song defined chord, then
  • user defined default, then
  • system defined default, and finally
  • system generated dynamic.

The override definitions are pretty much exactly what svguitar expects. Here's a uke override system default:

    "C#maj": {
      "barres": [{
        "fromString": 4,
        "toString": 1,
        "fret": 1,
      }],
      "fingers": [
        [1,4]
      ]
    },

And the dynamically generated object is exactly the same, only no barres. With that, and my instrument object, I can

const chart = new SVGuitarChord(divEl);
chart
		.configure({
					strings: instrumentObject?.strings.length,
					frets: maxFrets,
					position: 1,
					tuning: [...instrumentObject?.strings]
		})
		.chord(chartSettings)
		.draw();

chartSettings is either the override or the dynamic. Then I drop that in my component as I like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants