The `chord` module
Précédent | Chapitre 4. Extending GNU Solfege | Suivant

## The `chord` module

### Avertissement

The chord module has been superseeded by the idproperty module. This module will not be developed further, and will eventually be removed from the program. You should modify your lessons to use the `idproperty` module. The chord module will be removed from the solfege program in the next development series, in Solfege version 3.11.0.

It is easy to do the convert. In Solfege 3.10 the lesson file heading would contain the following line:

       module = chord

Replace that with this:

       module = idproperty
       flavour = "chord"

The chord module let you identify different properties of chords, such as their name, inversion, top tone etc.

The properties are defined by the `props` variable in the lesson file header, and there should be a variable `prop_labels` that defines the label to use. `props` and `prop_labels` must be lists of equal length. You only have to define these two variables if you need other properties than the default ones: `name`, `inversion` and `toptone`.

Below is a minimal lesson file. It will create an exercise that will play a minor or major chord and the user answers with two buttons labeled "Minor" and "Major" and two buttons representing the inversion. Notice that unused properties, toptone in this example, are hidden.

    header {
        module = chord
        title = "Minor and major chords"
        lesson_id = "e263d40a-d8ff-4000-a7f2-c02ba087bf72"
        qprops = "name", "inversion", "toptone"
        qprop_labels = _("Chord type"), _("Inversion"), _("Toptone")
    }
    question {
      name = "Major"
      music = chord("c' e' g'")
      inversion = 0
    }
    question {
      name = "Minor"
      music = chord("es' g' c''")
      inversion = 1
    }

The `inversion` property is special. If assigned integer values, like in the example, the integer values will be replaced with strings. So `0` is replaced with "root position", `1` with "1. inversion" etc.

Précédent | Niveau supérieur | Suivant
Lesson files | Sommaire | The `compareintervals` module