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

💡 RFC: Chord Diagrams #820

Closed
11 tasks done
isaiahdahl opened this issue Oct 22, 2024 · 8 comments · Fixed by #826
Closed
11 tasks done

💡 RFC: Chord Diagrams #820

isaiahdahl opened this issue Oct 22, 2024 · 8 comments · Fixed by #826

Comments

@isaiahdahl
Copy link

isaiahdahl commented Oct 22, 2024

  • song to be able to build a list of chords used in the song
  • some way to get the chords used in a song, those chords have a parsed object
  • parse the define: directive and use it as an override for whatever the chords object looks like.
  • bring in the chord diagram rendering codepen with some kind of abstraction to allow svg output, and jsPDF direct rendering
    • change chord diagram rendering to void functions instead of returning strings
    • extract renderer bit
    • add jsPDF renderer for chord diagrams
    • move chord diagram rendering into codebase
  • get chord definitions from a json key value database, with overrides from the actual chordpro
    • convert the CSV file to a nested JSON with correctly formatted definitions
    • optional: choose the correct directive based on the chosen instrument/tuning
@martijnversluis
Copy link
Collaborator

@isaiahdahl I implemented ChordDiagram.parse() to get the definitions from a JSON file to work. Do you have default definitions somewhere in a file?

@isaiahdahl
Copy link
Author

Yes we have a database table called guitar_chords that looks like this:

http://data.praisecharts.com:3000/public/question/00ac27e7-093f-42bb-8eaf-45846643b9bb

You can export into a csv from here. and we may need to run a script to turn it into proper definitions.

It's got chord fingerings for multiple tunings

@isaiahdahl
Copy link
Author

These are the Tunings we have

	private static $_tuning_names = array(
		"E A G D B E" => "Standard",
		"E A D G B E" => "Cut Capo",
		"D A D G B E" => "Drop D",
		"D A D G A D" => "Modal D",
		"D A D F# A D" => "Open D",
		"D A D F A D" => "Open Dm",
		"C G C G C E" => "Open C",
		"E A C# E A E" => "Open A",
		"D G D G B D" => "Open G",
		"D G D G C D" => "Modal G",
		"D G D G Bb D" => "Open Gm",
		"G C E A"	=> "Ukulele",
		"G D A E"	=> "Mandolin",
		"E A D G"	=> "4 String Bass",
		"B E A D G"	=> "5 String Bass"
		//"C E G Bb C D" => "Overtone"
	);
	
	/**
	 * The key needed for each tuning
	 * @var array
	 */
	private static $_tuning_keys = array(
		"Cut Capo" => "D",
		"Drop D" => "D",
		"Modal D" => "D",
		"Open D" => "D",
		"Open Dm" => "Dm",
		"Open C" => "C",
		"Open A" => "A",
		"Open G" => "G",
		"Modal G" => "G",
		"Open Gm" => "Gm"
	);
	
	private static $_tuningGrids = array(
		"Mandolin"	=> array(4,6),
		"Ukulele"	=> array(4,4),
		"5 String Bass" => array(5,4),
		"4 String Bass" => array(4,4)
	);
	
	/**
	 * 
	 * @var array
	 */
	private static $_tuningsByType = array(
		"mayor"	=> array( "Standard", "Cut Capo","Drop D","Modal D", "Open D", "Open C", "Open A", "Open G", "Modal G","Ukulele","Mandolin","4 String Bass","5 String Bass"),
		"minor"	=> array( "Standard", "Open Dm", "Open Gm","Ukulele","Mandolin","4 String Bass","5 String Bass")
	);	

@martijnversluis
Copy link
Collaborator

Wow, that is quite extensive!

Would that mean we would ideally have a config setting on the song for tuning? So far I could not find a official directive for that. We could use {x_tuning}?

Or should conditional directives be used for this,? In that case the tuning/instrument could either be configured in the config or set with a directive, like {drop_d}.

The question then is, can any chord be expressed in a definition in any tuning?

@isaiahdahl
Copy link
Author

Yea honestly I never really thought about that so deeply. Looks like the chordpro define syntax doesn't really care about the tuning because it's kinda inherently making an assumption that all the chord definitions for that chordpro will be in that chart.

So I'd say yea, we probably want to store the chord diagrams key'd by tuning and then have a default, and then some directive that can say this is the tuning for this song and then it'll grab those chord diagrams instead.

@isaiahdahl
Copy link
Author

Same with instrument I guess too.

@isaiahdahl
Copy link
Author

You know maybe after a closer look at that Conditional Directives
we'd be fine to leverage that. It doesn't explicitly state that the feature must be an instrument....

Like maybe something like this doesn't break standard?

{define-guitar-standard:  Am base-fret 1 frets 0 2 2 1 0 0}
{define-guitar-drop-D:  Am base-fret 1 frets 0 2 2 1 0 0}

Then we could also have the defaults just life as default guitar standard?

@isaiahdahl
Copy link
Author

Yes! actually that's confirmed here: https://www.chordpro.org/chordpro/chordpro-configuration-generic/#instrument-description

An instrument in the config can have a tuning.

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

Successfully merging a pull request may close this issue.

2 participants