Set Key

Set Key

If a Region does not provide any information about what key it should be in, one will be chosen automatically. There are two common situations where this is undesirable:

When coordinating keys of multiple Regions, at a minimum you should pick a tonic beforehand and supply that to the key object for each Region.

Note: Although you are also allowed to specify the exact quality of a key object, doing so requires some care. The specific qualities of keys that can be used are dependent on the Descriptor. These are available in the attributes.tags list of a Descriptor. If a provided quality is not supported, it will be automatically changed to a valid alternative, which will not be exactly what you expected.

Here is an example of 60 seconds of music at 60 beats per minute, starting with cinematic_minimal_mysterious then switching to cinematic_minimal_tense, both in some key with a tonic of e:

{
    "spans": [
        {
            "id": 111,
            "type": "metered",
            "time": 0,
            "tempo": 60,
            "regions": [
                {
                    "id": 222,
                    "region": "music",
                    "descriptor": "cinematic_minimal_mysterious",
                    "beat": 0,
                    "key": {
                        "tonic": "e"
                    },
                    "end_type": {
                        "beat": 32,
                        "event": "transition",
                        "type": "cut"
                    }
                },
                {
                    "id": 333,
                    "region": "music",
                    "descriptor": "cinematic_minimal_tense",
                    "beat": 32,
                    "key": {
                        "tonic": "e"
                    }
                }
            ]
        },
        {
            "type": "unmetered",
            "time": 60
        }
    ]
}

Here is the same thing done using Actions (slightly shorter and defines Region changes in seconds rather than beats):

{
    "spans": [
        {
            "id": 111,
            "type": "metered",
            "time": 0,
            "tempo": 60,
            "actions": [
                {
                    "time": 0,
                    "add_region": {
                        "descriptor": "cinematic_minimal_mysterious",
                        "key": {
                            "tonic": "e"
                        },
                        "random_instruments": true,
                        "cut_at": 30
                    }
                },
                {
                    "time": 32,
                    "add_region": {
                        "descriptor": "cinematic_minimal_tense",
                        "key": {
                            "tonic": "e"
                        },
                        "random_instruments": true
                    }
                }
            ]
        },
        {
            "type": "unmetered",
            "time": 60
        }
    ]
}