canorusmusic / canorus

Canorus is a free cross-platform music score editor
http://www.canorus.org
GNU General Public License v3.0
34 stars 14 forks source link

add support for chord names [sf#42] #99

Closed matevz closed 4 years ago

matevz commented 5 years ago

Reported by matevz on 2018-07-18 21:08 UTC Add support for writing the chord names below the note. For now just the chord name would suffice, maybe take the user interface from the text and report error, if wrong value was typed in. The next step is to support transposition. The final step is to add guitar tablature support. Maybe even add new context for chords.

matevz commented 5 years ago

Updated by matevz on 2018-10-22 16:55 UTC

matevz commented 5 years ago

Commented by matevz on 2018-11-05 21:38 UTC A better approach would be to add the ChordName context as in Lilypond. A user can then write chords similar as in the Lyrics context, but in Chord syntax (see http://lilypond.org/doc/v2.19/Documentation/notation/displaying-chords). Then, it's just a matter of one checkbox to also show the guitar fret diagram (see http://lilypond.org/doc/v2.19/Documentation/notation/common-notation-for-fretted-strings).

matevz commented 4 years ago

Thinking a bit more about this. We should define a CAChordName : CAPlayable class with CADiatonicPitch _diatonicPitch and QString _qualityModifier fields. Having the chord pitch stored as CADiatonicPItch would enable simple transposition of the chords.

Additionally a new CAChordNameContext context should be introduced for containing CAChordName elements. In essence it would behave very similar to the CAFiguredBassContext. For example the rhythm of CAChordName would be computed the same as for the figured bass elements (i.e. a common rhythm for any playable event in the score).

Finally, the CADrawable instances for CAChordName and CAChordNameContext should be provided.

For entering the chord in the GUI, a similar non-intrusive and direct approach to entering lyrics could be used. User would place chords by clicking on an (empty) chord element, an inline text edit would show up, and then typing using the Lilypond syntax <notename>[:<quality modifier>] would place a chord. Some examples:

The rendering and formatting in the score should be the upper case note name with corresponding accidental and a superpositioned quality modifier with smaller font.

The parsing of the input should be done by validating <notename> and optionally the sign : and then whatever text after until the blank is reached. If the parsing is successful, the values should be placed inside the _diatonicPitch and _qualityModifier fields accordingly. If the syntax is invalid, _diatonicPitch should be CANoteName::Undefined and _qualityModifier should include the whole input text. In this case, the chord element should be rendered solely as _qualityModifier (without leading :) using regular font and the note checker should underline it with red.