ChordPro / chordpro

Reference implementation of the ChordPro standard for musical lead sheets.
Other
324 stars 51 forks source link

Some keyboard diagrams are definitely rendered incorrectly #237

Closed nomike closed 2 years ago

nomike commented 2 years ago

Describe the bug

I'm an absolute beginner with keyboard playing, but there are some diagrams which don't show any keys to be pressed and that can't be right.

To Reproduce

Download example and run Makefile.

Expected behavior

All piano chord diagram should at least show 2 keys to press (or maybe 3?!?, as I said I'm not that experienced yet)

Attachments

piano.tar.gz

System information

Additional context

nomike commented 2 years ago

BTW: How could I define a chord "NC" which doesn't show a diagram anywhere? For string instruments I did it like this so far: { "name": "NC", "base": 1, "frets": [-1, -1, -1, -1, -1, -1] }

sciurius commented 2 years ago

When I run your test, I get correct results. Can you retry and add --nodefaultconfigs to make sure no other configs are getting in the way?

chordpro --nodefaultconfigs --cfg keyboard.json test.cho

test.pdf

nomike commented 2 years ago
chordpro --nodefaultconfig --config keyboard.json test.cho --out=test.pdf --print-final-config
{
   "a2crd" : {
      "classifier" : "pct_chords",
      "infer-titles" : true,
      "tabstop" : 8
   },
   "chordpro" : {
      "chorus" : {
         "recall" : {
            "quote" : false,
            "tag" : "",
            "type" : ""
         }
      }
   },
   "contents" : [
      {
         "fields" : [
            "songindex"
         ],
         "fold" : false,
         "label" : "Table of Contents",
         "line" : "%{title}",
         "omit" : false,
         "pageno" : "%{page}"
      },
      {
         "fields" : [
            "sorttitle",
            "artist"
         ],
         "fold" : false,
         "label" : "Contents by Title",
         "line" : "%{title}%{artist| - %{}}",
         "omit" : false,
         "pageno" : "%{page}"
      },
      {
         "fields" : [
            "artist",
            "sorttitle"
         ],
         "fold" : false,
         "label" : "Contents by Artist",
         "line" : "%{artist|%{} - }%{title}",
         "omit" : true,
         "pageno" : "%{page}"
      }
   ],
   "dates" : {
      "today" : {
         "format" : "%A, %B %e, %Y"
      }
   },
   "debug" : {
      "abc" : 0,
      "chords" : 0,
      "config" : 0,
      "csv" : 0,
      "fonts" : 0,
      "images" : 0,
      "layout" : 0,
      "ly" : 0,
      "meta" : 0,
      "mma" : 0,
      "song" : 0,
      "songfull" : 0,
      "spacing" : 0,
      "x1" : 0,
      "x2" : 0,
      "x3" : 0
   },
   "delegates" : {
      "abc" : {
         "config" : "default",
         "handler" : "abc2image",
         "module" : "ABC",
         "preamble" : [],
         "preprocess" : {
            "abc" : [],
            "svg" : []
         },
         "type" : "image"
      },
      "ly" : {
         "config" : "default",
         "handler" : "ly2image",
         "module" : "Lilypond",
         "preamble" : [],
         "type" : "image"
      }
   },
   "diagnostics" : {
      "format" : "\"%f\", line %n, %m\n\t%l"
   },
   "diagrams" : {
      "auto" : false,
      "show" : "all",
      "sorted" : false
   },
   "html" : {
      "styles" : {
         "display" : "chordpro.css",
         "print" : "chordpro_print.css"
      }
   },
   "include" : [
      "/usr/local/share/perl/5.34.0/App/Music/ChordPro/res/config/keyboard.json",
      "/usr/local/share/perl/5.34.0/App/Music/ChordPro/res/config/modern3.json"
   ],
   "instrument" : {
      "description" : "Keyboard, Piano, ...",
      "type" : "keyboard"
   },
   "latex" : {
      "template_include_path" : [],
      "templates" : {
         "comment" : "comment.tt",
         "image" : "image.tt",
         "songbook" : "songbook.tt"
      }
   },
   "meta" : {},
   "metadata" : {
      "autosplit" : true,
      "keys" : [
         "title",
         "subtitle",
         "artist",
         "composer",
         "lyricist",
         "arranger",
         "album",
         "copyright",
         "year",
         "sorttitle",
         "key",
         "time",
         "tempo",
         "capo",
         "duration"
      ],
      "separator" : "; ",
      "strict" : true
   },
   "notes" : {
      "flat" : [
         "C",
         [
            "Db",
            "Des",
            "D♭"
         ],
         "D",
         [
            "Eb",
            "Es",
            "Ees",
            "E♭"
         ],
         "E",
         "F",
         [
            "Gb",
            "Ges",
            "G♭"
         ],
         "G",
         [
            "Ab",
            "As",
            "Aes",
            "A♭"
         ],
         "A",
         [
            "Bb",
            "Bes",
            "B♭"
         ],
         "B"
      ],
      "movable" : false,
      "sharp" : [
         "C",
         [
            "C#",
            "Cis",
            "C♯"
         ],
         "D",
         [
            "D#",
            "Dis",
            "D♯"
         ],
         "E",
         "F",
         [
            "F#",
            "Fis",
            "F♯"
         ],
         "G",
         [
            "G#",
            "Gis",
            "G♯"
         ],
         "A",
         [
            "A#",
            "Ais",
            "A♯"
         ],
         "B"
      ],
      "system" : "common"
   },
   "parser" : {
      "preprocess" : {
         "all" : [],
         "directive" : [],
         "songline" : []
      }
   },
   "pdf" : {
      "capoheading" : "%{capo|Capo: %{}}",
      "chordscolumn" : 0,
      "chorus" : {
         "bar" : {
            "color" : "foreground",
            "offset" : 8,
            "width" : 0.5
         },
         "indent" : 12,
         "recall" : {
            "choruslike" : false,
            "quote" : false,
            "tag" : "Chorus",
            "type" : "comment"
         },
         "tag" : "Chorus"
      },
      "columnspace" : 20,
      "csv" : {
         "fields" : [
            {
               "meta" : "title",
               "name" : "title"
            },
            {
               "meta" : "pagerange",
               "name" : "pages"
            },
            {
               "meta" : "sorttitle",
               "name" : "sort title"
            },
            {
               "meta" : "artist",
               "name" : "artists"
            },
            {
               "meta" : "composer",
               "name" : "composers"
            },
            {
               "meta" : "collection",
               "name" : "collections"
            },
            {
               "meta" : "key_actual",
               "name" : "keys"
            },
            {
               "meta" : "year",
               "name" : "years"
            },
            {
               "name" : "my_field",
               "omit" : true,
               "value" : "text"
            }
         ],
         "separator" : ";",
         "songsonly" : true,
         "vseparator" : "|"
      },
      "diagrams" : {
         "height" : 8,
         "hspace" : 3.95,
         "linewidth" : 0.1,
         "show" : "right",
         "vcells" : 4,
         "vspace" : 3,
         "width" : 8
      },
      "even-odd-pages" : 1,
      "fontconfig" : {
         "courier" : {
            "" : "Courier",
            "bold" : "Courier-Bold",
            "bolditalic" : "Courier-BoldItalic",
            "italic" : "Courier-Italic"
         },
         "dingbats" : {
            "" : "ZapfDingbats"
         },
         "helvetica" : {
            "" : "Helvetica",
            "bold" : "Helvetica-Bold",
            "boldoblique" : "Helvetica-BoldOblique",
            "oblique" : "Helvetica-Oblique"
         },
         "times" : {
            "" : "Times-Roman",
            "bold" : "Times-Bold",
            "bolditalic" : "Times-BoldItalic",
            "italic" : "Times-Italic"
         }
      },
      "fontdir" : [],
      "fonts" : {
         "chord" : {
            "background" : "background",
            "color" : "foreground",
            "name" : "Helvetica-Bold",
            "size" : 12
         },
         "chordfingers" : {
            "background" : "background",
            "color" : "foreground",
            "file" : "ChordProSymbols.ttf",
            "numbercolor" : "background"
         },
         "comment" : {
            "background" : "foreground-light",
            "color" : "foreground",
            "name" : "Helvetica",
            "size" : 12
         },
         "comment_box" : {
            "background" : "background",
            "color" : "foreground",
            "frame" : 1,
            "name" : "Helvetica",
            "size" : 12
         },
         "comment_italic" : {
            "background" : "background",
            "color" : "foreground",
            "name" : "Helvetica-Oblique",
            "size" : 12
         },
         "grid" : {
            "background" : "background",
            "color" : "foreground",
            "name" : "Helvetica",
            "size" : 10
         },
         "tab" : {
            "background" : "background",
            "color" : "foreground",
            "name" : "Courier",
            "size" : 10
         },
         "text" : {
            "background" : "background",
            "color" : "foreground",
            "name" : "Helvetica",
            "size" : 12
         },
         "title" : {
            "background" : "background",
            "color" : "foreground",
            "name" : "Helvetica-Bold",
            "size" : 14
         },
         "toc" : {
            "background" : "background",
            "color" : "foreground",
            "name" : "Helvetica",
            "size" : 11
         }
      },
      "footspace" : 20,
      "formats" : {
         "default" : {
            "background" : "",
            "footer" : [
               "%{title}",
               "",
               "%{page}"
            ],
            "subtitle" : [
               "",
               "",
               ""
            ],
            "title" : [
               "",
               "",
               ""
            ]
         },
         "first" : {
            "background" : "",
            "footer" : [
               "",
               "",
               ""
            ]
         },
         "title" : {
            "background" : "",
            "footer" : [
               "",
               "",
               "%{page}"
            ],
            "subtitle" : [
               "%{subtitle|%{}|%{subtitle}}",
               "",
               ""
            ],
            "title" : [
               "%{title}",
               "",
               ""
            ]
         }
      },
      "grids" : {
         "cellbar" : {
            "color" : "foreground-medium",
            "width" : 0
         },
         "symbols" : {
            "color" : "blue"
         },
         "volta" : {
            "color" : "blue",
            "span" : 0.7
         }
      },
      "head-first-only" : false,
      "headspace" : 60,
      "info" : {
         "author" : "",
         "keywords" : "",
         "subject" : "",
         "title" : "%{title}"
      },
      "kbdiagrams" : {
         "base" : "C",
         "height" : 20,
         "hspace" : 3.95,
         "keys" : 14,
         "linewidth" : 0.1,
         "pressed" : "foreground-medium",
         "show" : "right",
         "vspace" : 0.3,
         "width" : 4
      },
      "labels" : {
         "align" : "left",
         "comment" : "",
         "width" : "auto"
      },
      "library" : "",
      "marginbottom" : 40,
      "marginleft" : 40,
      "marginright" : 40,
      "margintop" : 80,
      "outlines" : [
         {
            "collapse" : false,
            "fields" : [
               "sorttitle",
               "artist"
            ],
            "fold" : false,
            "label" : "By Title",
            "letter" : 5,
            "line" : "%{title}%{artist| - %{}}"
         },
         {
            "collapse" : false,
            "fields" : [
               "artist",
               "sorttitle"
            ],
            "fold" : false,
            "label" : "By Artist",
            "letter" : 5,
            "line" : "%{artist|%{} - }%{title}"
         }
      ],
      "pagealign-songs" : 1,
      "papersize" : "a4",
      "showlayout" : false,
      "spacing" : {
         "chords" : 1.2,
         "diagramchords" : 1.2,
         "empty" : 1,
         "grid" : 1.2,
         "lyrics" : 1.2,
         "tab" : 1,
         "title" : 1.2,
         "toc" : 1.4
      },
      "split-marker" : [
         "",
         "",
         ""
      ],
      "theme" : {
         "background" : "none",
         "foreground" : "black",
         "foreground-light" : "grey90",
         "foreground-medium" : "grey70"
      },
      "titles-directive-ignore" : true
   },
   "settings" : {
      "chordnames" : "strict",
      "chords-canonical" : false,
      "chords-under" : false,
      "choruslabels" : true,
      "columns" : 1,
      "decapo" : false,
      "inline-annotations" : "%s",
      "inline-chords" : false,
      "lineinfo" : true,
      "lyrics-only" : false,
      "memorize" : false,
      "notenames" : false,
      "strict" : true,
      "suppress-empty-chords" : true,
      "suppress-empty-lyrics" : true,
      "titles" : "center",
      "transcode" : "",
      "transpose" : 0,
      "truesf" : false
   },
   "text" : {
      "chorus" : {
         "recall" : {
            "quote" : false,
            "tag" : "",
            "type" : ""
         }
      }
   },
   "toc" : {
      "line" : "%{title}",
      "order" : "page",
      "title" : "Table of Contents"
   },
   "tuning" : [
      "A1"
   ],
   "user" : {
      "fullname" : "nomike,,,",
      "name" : "nomike"
   }
}

produces this PDF: test.pdf

nomike commented 2 years ago

Give me a few minutes, I'm working on a patch for this.

sciurius commented 2 years ago

I could nitpick that these aren't the sources you included in the original bug report ☺.

As i remarked in #234:

Fortunately it is trivial to derive the keys from the chord, provided it is a common chord (i.e. major, minor. 7th, maj7, minor7, aug, dim, sus4m and half-dim).

m6, add9, sus2 and 6 are currently not in the list.

I've added the chords (and NC) and added a warning for unknown chords.

nomike commented 2 years ago

Seems we had an overlap. I added definitions for all chords I could find. Feel free to cherry-pick whatever you like. This should cover almost if not all of them.

But see my comments in the pull request for some small unresolved issues.