Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
i vomit kittens
Apr 25, 2019


MJP posted:

Humble Request
Problem: I don't know the quickest way to shift from one guitar chord fingering to another.
Description and requirements: There's a JSON DB of guitar chords at https://github.com/tombatossals/chords-db. I'd like to be able to select a chord and fingering, and then select a destination chord. The app should then query the DB and tell me the closest-proximity fingering.
Nice to have features: Specify minimal travel between strings (e.g. keep finger 1 on string 3 if possible), specify minimal travel up or down the neck (e.g. only show chords between frets 1 and 5), actually playing the chord if tapped

Windows or Android, or just regular old web app. I honestly don't know if this is more than tiny, so please do correct me if so.

There are two different ways I'm thinking of to calculate this (the base ask, at least) and I'm not sure which is actually correct when it comes to being the closest. Maybe you or someone else can help me out. I've got:

code:
For each possible destination fingering:
  For each string, calculate the distance from the starting fret to the destination fret (provided neither of them are not played).
  Calculate the average of the distances.
The destination fingering with the lowest average distance is the closest.
or

code:
For each possible destination fingering:
  Find the minimum fret number out of both the starting fingering and destination fingering.
  Subtract this minimum from every fret in both the starting fingering and destination fingering.
  Calculate the average of the above values.
The destination fingering with the lowest average is the closest.
I implemented both of these in a quick script that just accepts input from the command line. In this screenshot below the first method is "distance" and the second is "variance" (these probably aren't the right terms but it's late and I just threw this together). Note that they give different results.



If you want to have a go at messing around with it this zip file has both the script and the JSON file containing all of the chords. I'll work on making something more presentable (i.e. not a Python script) once I know which direction to go.

i vomit kittens fucked around with this message at 10:34 on Jan 4, 2023

Adbot
ADBOT LOVES YOU

i vomit kittens
Apr 25, 2019


MJP posted:

Distance and variance are actually pretty good terms for the two separate functions.

Distance = how far from the fret we need to travel. e.g. going from fret 1 to fret 2 is quicker than going from fret 1 to fret 3.

Variance = how many string changes are required. e.g. going from string 1 to string 2 counts as one instance of variance.

For now, the distance method seems to be the most realistic for my needs. If there's some way to incorporate both the distance and variance as above, that's even better.

One other ask: is it possible to specify a maximum range of frets? Going from 1 to 4 is quite a stretch for a newbie, 1 to 3 is a little more realistic. Maybe include the range as a ranking, e.g. the shorter distance of frets the easier it is, thus prioritize shorter ranges over longer.

Other than that, this is huge and good and I'm going to see about futzing more with it. A big wish for future refinement: a GUI with dropdowns for the chord types. Major and minor are great starts but sus7delta4whateverthatroundcircleis is gonna get weird fast.

I realized while working on a simple GUI that there was an error in how I was calculating things, I didn't realize the data doesn't account for the "baseFret" that the fret positions all start from. I fixed that and got this working:



I packaged it as an Electron app so here's the build folder for that. You can either run the installer or just open the "unpacked" folder and run the .exe in there. I haven't looked for ways to break it, the styling is kind of lazy, and I didn't bother to change the package name/icon from the defaults for the template I used, but it works. Right now it's just the same as the "distance" function in the script I posted last night (with the fix I mentioned above added in) but I'll take a look at other improvements later.

i vomit kittens fucked around with this message at 23:59 on Jan 4, 2023

i vomit kittens
Apr 25, 2019


MJP posted:

It's good stuff, thanks so much!

Would you want to do more work on it if further questions/feature requests come up? I don't want to abuse the thread and turn a tiny app into a big thing, especially for the price of free.

Sure, I took a bit of a pause on getting to some of the things you've already pointed out as the water cooling system on my desktop is dying and even just having my editor open to a small project is liable to cause chugging/crashes. I have parts to build a new PC getting delivered later this week so I'll continue poking around then. If you want to go ahead and switch to PMs for anything else that comes up feel free.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply