-
Notifications
You must be signed in to change notification settings - Fork 104
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
Is the first C major correct? #2
Comments
Yess, you're right. It's more standard the Cmajor that you say, I have seen it in multiple sources, some muted the 6th string and others prefers the G note in the 6th chord. Some others represented it as a variation of the same chord. So you think it would be a C/G variation, very interesting. I'm going to change it like you say. Do you know any source where I could query the "slash" chords so I can add them? I'm finishing a web visualization tool of all the chords so it would be easier to browse them and detect all the typos that I could make in them. Thanks |
I couldn't find a good source that includes slash chords and finger positions, unfortunately...
I saved the data in a simple format like this:
Keep in mind that there is a lot of redundancy in that file because every chord is present in its sharp and flat form (Ab == G#, E# == F, ....). |
@szaza Hi, I'm still very much interested. I just haven't had the time to work on it. I did find a pretty complete "database": https://jguitar.com/chordsearch?chordsearch=&labels=finger Edit: We could then simply have three nested loops. The first one iterating over the root note, the second one iterating over the chord variant and the third one iterating over the bass note. This would result in about 10000 HTTP requests. For some chords we need to send multiple requests as there are so many possible shapes that there are multiple pages. |
Hi @T-vK,
@tombatossals how did you generate the current database? Did you put down all the chords by your hand? |
Processing the images wouldn't be that hard actually and would only be necessary to obtain the finger positions. The rest can be extracted from the URL to each image. |
Hi, "Processing the images wouldn't be that hard actually and would only be necessary to obtain the finger positions." - Can we try it out first on a single image? What approach would you use for it? Have you done similar tasks? "I'm pretty sure they have an algorithm to generate all these chords rather than a database" - yes, I'm also fully sure about it, however it is enough to generate the database only once, because guitar chords won't change by passing the time. "I mean if you make something publicly available on the Internet then everybody can use it." - Yes, it is free to use, however I'm not sure that it is allowed to make a copy. Just consider using YouTube, it is free to use, but it is not permitted to download the content and put it available on another site. In my opinion the right approach would be to write an algorithm that generates chords instead of spending time with writing image processing and site parsing algorithms. |
Well testing it on one image first would be the first step for sure. I have done similar things. For instance I have written a proof of concept showing how easy it is to decipher a simple captcha. The only difference for the chord diagrams would be that I'd have to find the positions of every number found in the image. https://github.com/T-vK/crack-captcha-poc
I fully agree, but I know way too little about music theory to do something like that.
You can't really compare the two because you can't have a copyright on a chord. A fair comparison would be if someone uploaded a video that is in the public domain. In that case there are no laws that would disallow making copies of it. |
Yesss, all by hand. I started it as a proof of concept and finished coding the chords by hand I found in some old books I have. |
@tombatossals what do you think about @T-vK's approach? |
I haven't had much time to get this to work. But here is what I ended up with on the weekend:
Output:
So yeah, it basically works, but something is still wrong. It seems to detect a "1" when there is a "2". |
It looks pretty good, maybe I'll have some time during this week to refine a little bit your implementation. We also have to calculate the position of the fingers on the frets, so in this case it would be: frets [1,3,3,2,1,1] and also barres: 11 is important. |
Yes, I kinda forgot about that. But the information is already being extracted. Edit: I just remembered, it is not really necessary, because that information can be extracted fromt he HTML code:
We can simply extract the So yeah, the main problem right now is that the "2" is being detected as a "1". Once that is solved, I could parse all the data. Edit2: |
Wow, cool! Nice and interesting work! Probably, for simplified suffixes we could use what we have in the chords-db here: https://github.com/tombatossals/chords-db/blob/master/src/db/guitar/suffixes.js For generating slash chords we could reuse the array of rootNotes ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'] as base notes, so we would have a three level deep for loop, e.g.: rootNote + suffix + base note => C + m + '/' + A => Cm/A. Can we parse also barres chords? |
Look closely, I'm already doing the three level deep loop to really get all chords ;)
The script can indeed also parse barre chords. Sure, I'll create the repo later today. |
All right, many thanks! |
@szaza https://github.com/T-vK/jguitar-parser There are a few TODOs in the file: and in addition to that I need to figure out what order the shapes of each chord should be sorted. I guess the subsets should probably be added to the very end as there is no fingering information for those. The way I'm currently parsing the chord diagrams is not very efficient. All in all it takes about 1 second for each chord diagram. So extracting and parsing all the chords would take about 30 hours. But, I think I'm not gonna bother with making it more efficient. |
Hi @T-vK, many thanks for your effort, great work! |
That's fantastic job @T-vK. We could parse the chords and make some validations using chords-db and manually as @szaza says. I'm working too on the gh-pages of react-chords, the idea is accomplish a basic raw visualizator of all the chords that can help us to detect problems with the news imported chords. Just tell me if you need help with the parsing |
It seems like some chords are too crazy to be played on the guitar. Edit: Edit2: The fingering seems very unrealistic. At least I don't think that I could play it this way. I would probably use my thumb on the low E and A instead of my index finger. What do you think? Edit3: It might be worth it to reverse engineer. It seems to be responsible for calculating the subsets and might be able to do even more. |
"The fingering seems very unrealistic. At least I don't think that I could play it this way. I would probably use my thumb on the low E and A instead of my index finger. What do you think?" - I also observed that sometimes fingering seems unrealistic. @T-vK I would like to convert the output of your application according to chords-db format in order to be able to compare with the validation set and later to extend chords-db. Are you still working on the jguitar-parser? If it is ok with you then I'm going to create a new development branch and implement the needed changes there. Please let me know if you are already working on similar feature. |
@szaza Feel free to go for it. I just pushed what I got so far. I'm currently running the parser to download all the raw data from jguitar into the cache. I think I'm not gonna add the subsets to the output for now because too many of them seem to be useless. I already have 40% of the raw jguitar data downloaded and I expect the final output json to be ~10MB in size. But that's with the long chord names. One we have a function to generate the shorter more common chord names it will probably be a little bit smaller. |
Ok, then I'm going to implement a converter that converts the output of your application to chords-db format and probably I can solve the chord names problem too. If you think I can parse a part of the jguitar chords with your tool and we could merge the output at the end, however I could do it only tomorrow afternoon. Please let me know if I can help anything else. |
That would be great!
Thanks, but it'll be easier for me when I have all the raw html and png data on one computer. I'll probably have to parse all that data again anyway at some point. |
Hi,
I cannot find any information regarding to the barres and capo in the output of the jguitar-parser tool. |
Awesome, I will!
I don't really see the value of the barre/capo information. But I would say if the same finger has to be positioned on multiple strings on the same fret, then you have a barre. And if the index finger makes a barre, then you could alternatively use a capo instead of the index finger and play it as an open chord. In that case, however, the fingering would most likely be very different. But I guess that's when you would want to set the I'm almost done scraping the data btw. It crashed a couple of times, but I'm at 95% now. |
Hi, I have finished a basic chord visualization tool that can help us to review the new chords imported from a parser: https://tombatossals.github.io/react-chords Maybe some capo/barre info can be added to the imported set manually. The test could detect basic typos, and we can review the import and improve the queality of the chord in the JSON with more properties. Great job guys! |
Okay, it's done. The final json file ist about 13.5MB in size. I also created a smaller version that only contains one shape per chord which is about 1.2MB in size. I've uploaded the files into this repo: https://github.com/T-vK/chord-collection Now we need to verify that the data really is good enough. |
That's great @T-vK. I'm going to work in an import tool based on your 13.5MB JSON which will merge the new chords with the actual chords-db structure. My idea is to mantain the already existing chords in the DB, and add the new chords that does not exists. After that, some basic testing and some visually review of them and the job will be done. What do you think guys? |
@T-vK "I would say if the same finger has to be positioned on multiple strings on the same fret, then you have a barre. And if the index finger makes a barre, then you could alternatively use a capo" - yap, I was thinking the same, I just wanted to make sure that there is no barres and capo info exported. I though before that maybe I forget to set properly some settings in your tool. It should be a peace of cake to make this modification in the converter tool, however today and tomorrow I won't be in front of my laptop. If you have some free time sooner, you can implement the required changes, otherwise I'll implement it when I'm back. @tombatossals good idea. I also would extend the current chords-db format with the possibility to add more variations for fingerings, cause @T-vK tools supports multiple fingerings. After the new structure is done, we could modify the converter accordingly.
So, the fingers attribute would be an array. Maybe, it would be also good to create a REST based webservice that provides chord variations in JSON format. It would work similarly like the jGuitar, however it would return chords in JSON format. What do you think about it? |
Sure! We could extend the structure so more information make chord rendering richer to see. The change you propose in the fingers property could be easily ported to the actual chord database. About the REST service i think it's more related to the custom implementation of the visualization tool. It could be useful for a light web application, but I suppose a developer would prefer to manage their own chord query service (REST, GraphQL) that depend on a 3rd party service. The greatness of this DB is that is open so anyone can use their own solution, because of the easy of parsing of the chords. I have been browsing JGuitar and the database size is huge (in a lot of tunings). But I think they are using a computer-based calculation of the chord positions. Our advantadge to manage manually the database is that we can add fingering, a think not possible to calculate with a computer (I think so). |
I think an (open source) REST service would be a nice addition. Because forcing a user to download 13.5MB is bound to end in a bad user experience. Even the smaller 1.2MB file is way too big considering that in many areas you only get a 2G mobile connection. Not to mention that many people around the world have very small data caps like 100MB/month. But maybe there is a way to work around that by splitting the json data into many small files. Maybe one file per chord. Then we could host all these files on Github and write a JavaScript library that could automatically get the chord files that a website wants to load. |
I think it is possible to host it for free. Currently, I host a web-page on Google Cloud services with low resources and in my case I only have to pay for the Database Management System. In our case we wouldn't need any RDBMS and we could serve chords directly from the JSON files. I could create a free REST based web-service. |
What if a big website with millions of users per day integrates the REST service, causing massive network traffic? Would that still be considered "low resources"? |
"What if a big website with millions of users per day integrates the REST service, causing massive network traffic? Would that still be considered "low resources"?" - no, obviously that wouldn't be feasible for free, however Google Cloud services can be scaled easily. If a big website with millions of users per day would integrate our REST API than most probably it is valuable enough for them to support us in order to scale up our service. Obviously without support we cannot create a robust webservice, but at least we could start it with low resources and make it accessible. "I also wonder about the domain name, is Google offering that for free as well?" - no, that also wouldn't be available for free, however I have a valid domain the guitar-chords.org and this service could run from a subdomain like api.guitar-chords.org. |
I've just added the barres support for the converter, however I found some particular cases e.g.: Dm/G#
If I understand well it means that index finger is used both for the 4th and 6th frets. |
I mean.. it wouldn't hurt to have a REST service, but I think it would be a little naiive to assume that a big site using the service would support it financially (and that for every month). I think I'm more leaning torwards the pure GitHub solution with one json file per chord and potentially a JS library to make the access as easy as possible. There is most likely a bug in the image recognition. I'll try to find some time tomorrow to check. I assume the problem is the barre bow that is inside the diagram rather than on top of it: Maybe I should move away from the ocr approach and just straight up check if the image contains specific pixels at specific positions instead. |
"it would be a little naiive to assume that a big site using the service would support it financially" - :-)) believe me if it is important enough for them, they would support our service. "I think I'm more leaning torwards the pure GitHub solution with one json file per chord and potentially a JS library to make the access as easy as possible." - that is also a good solution. Just check my converter, it splits up the generated json file into smaller parts by base notes and suffixes as it is in the chords-db structure. You can modify it very easily to split the generated json file and keep your format. So, creating JS library on Github is totally fine for me, actually by extending chords-db we do the same. "Maybe I should move away from the our approach and just straight up check if the image contains specific pixels at specific positions instead." - I agree, comparing detected image parts with raw images is a good idea. |
Hi guys, I think that a website where people could review and add new chords, and maybe compose them into songs could be of interest of the community, but only a service to obtain the chord (when the full database is freely accesible) I think will get no intereset. BUT, providing the JSON file of the chord maybe needs no REST service. Take a look at this page, it's generating the SVG version of the chord when you click in a chord: https://tombatossals.github.io/react-chords/guitar/C/alt Generating the JSON file, a PNG file, etc. could be as easy as that. It could be hosted in Github (free and high availability) and anyone could get the version of the chord by simple traversing an URL (the URL is statically composed based in the key and suffix). Do you think it's useful for your idea? Instead of querying a REST service, it only needs to access a URL path and you get the chord in SVG, PNG, JSON format. In any case, I'm importing the chords into our dataset, I have created a "newdb" branch and good news, it's almost working. I have passed some tests into it and some chords fail to pass because: "The 1 position frets array should have at most 4 fingers of distance" I considered when was coding the tests that no chord should have 4 fingers of distance from one finger to another. For example the "Cmmaj9/G#" has this problem. The JGuitar.com site says that this chord is impossible. Maybe it has been bad imported? |
Yes, that's what I meant and having images would of course be a nice addition. If you adjust the settings on jguitar it will give you quite a few possibilities: https://jguitar.com/chord?root=C&chord=Minor+Major+9th&bass=G%23&labels=finger&gaps=2&fingers=4¬es=sharps If you google for |
Hi guys, |
Hi @szaza good work, I have been working too on that but with the smaller version in the "newdb" branch of this repository. Finally I was able to join the visualizator to this branch here: https://tombatossals.github.io/chords-db/ It misses the "barres" and "capo" information. |
Really impressive the chord fingering algorithm. Maybe an algorithm can be written that could create any chord without any previous declaration like we're doing, including the fingering. That would be really efficient. |
@tombatossals I'm sure this is possible. Generating the chords itself would probably be relatively simple. But filtering out the impossible ones is very difficult. Although I think using some machine learning it could actually be pretty easy. I have no experience with that though... Edit: Edit2: |
feat: added many minor 9 slash chords
I'm not an expert, but the first C major chord looks a bit strange to me:
I usually play it like this:
Your variant looks more like a 'C/G' to me. What do you think?
The text was updated successfully, but these errors were encountered: