๐Ÿ”ŽWorking with tags

How to obtain the Muzaic dictionary required for music ordering?

The Muzaic API operates on a tagging mechanism. To retrieve music of a specific type based on mood and/or music genre/style, you should use designated keywords known as 'mood tags.' You can obtain the current list of available tags by making a request to the 'getTags' endpoint.

Getting the list of tags using getTags endpoint

getTags

GET /getTags

Endpoint allows you to obtain JSON with all the currently accepted mood tags for muzaic system.

{
    "tags": [
        {
            "id": "1",
            "name": "acoustic",
            "int_bonus": "0",
            "tem_bonus": "0",
            "rhy_bonus": "-1",
            "ton_bonus": "1",
            "var_bonus": "0",
            "tagCategoryId": "4",
            "secret": "0",
            "active": "1"
        },
        {
            "id": "2",
            "name": "electronic",
            "int_bonus": "0",
            "tem_bonus": "1",
            "rhy_bonus": "1",
            "ton_bonus": "0",
            "var_bonus": "-1",
            "tagCategoryId": "4",
            "secret": "0",
            "active": "1"
        }
        ],
    "tagsRelations": {
        "1": {
            "2": -1
        },
        "2": {
            "1": -1
        }
    }
}

Handling tags relations

Some tags are negatively correlated, their meanings are contradictory, and they shouldn't be selected simultaneously. These correlations are described in the tagRelations field of the response, which is a JSON object of objects. The keys in this object represent tag IDs, and only negative correlations are available, indicated by a value of '-1'.

"1": {
    "2": -1,
    "16": -1,
    "4": -1
} 

In the example provided, negative correlations are shown for tag ID '1.' Tags with IDs '2,' '4,' and '16' should be disabled for selection in the frontend app.

Handling parameters bonuses

Each tag comes with a set of system-calculated bonuses that influence music parameters. When handling the selection of tags in a frontend application, these bonuses should be added to (or subtracted from) the parameter representation. When multiple tags are selected, the overall bonus is calculated according to the following rules:

  1. If all parameter bonuses have positive values or are zero, the maximal bonus is used.

  2. If all parameter bonuses have negative values or are zero, the minimal bonus is used.

  3. When there are mixed bonuses (both positive and negative values), an average is calculated and rounded to the nearest integer value.

Example parameter handling

There are two tags selected โ€“ 'acoustic' and 'happy'. Bonuses for 'acoustic' tag look like this:

{
  "id": 1,
  "name": "acoustic",
  "int_bonus": 0,
  "rhy_bonus": -1,
  "tem_bonus": 0,
  "ton_bonus": 1,
  "var_bonus": 0
}

Whereas bonuses for 'happy' tag are as follows:

{
   "id": 7,
   "name": "happy",
   "int_bonus": 4,
   "rhy_bonus": 2,
   "tem_bonus": 0,
   "ton_bonus": 4,
   "var_bonus": 4
}

So, calculated (combined) bonuses are:

  • Intensity: +4 (maximal from 0 and 4)

  • Rhythm: +1 (average of -1 and 2, rounded to the nearest integer)

  • Tempo: 0

  • Tone: +4 (maximal from 1 and 4)

  • Variance: +4

The calculated parameter values (to be passed to the 'singleFile' endpoint) are as follows:

  • Intensity: 9

  • Rhythm: 6

  • Tempo: 5

  • Tone: 9

  • Variance: 9

Good to know: You are not required to calculate the parameters; providing the tags alone is sufficient. Calculate parameters only when your app offers manual music parameter adjustments.

Full response JSON example

{
    "tags": {
        "id": 1,
        "name": "acoustic",
        "int_bonus": 0,
        "rhy_bonus": -1,
        "tem_bonus": 0,
        "ton_bonus": 1,
        "var_bonus": 0
    },
    {
        "id": 2,
        "name": "electronic",
        "int_bonus": 0,
        "rhy_bonus": 1,
        "tem_bonus": 1,
        "ton_bonus": 0,
        "var_bonus": -1
    },
    {
        "id": 4,
        "name": "lo-fi",
        "int_bonus": -1,
        "rhy_bonus": 1,
        "tem_bonus": 0,
        "ton_bonus": -1,
        "var_bonus": -2
    },
    {
        "id": 5,
        "name": "ambient",
        "int_bonus": 1,
        "rhy_bonus": -1,
        "tem_bonus": 0,
        "ton_bonus": 0,
        "var_bonus": -4
    },
    {
        "id": 7,
        "name": "happy",
        "int_bonus": 4,
        "rhy_bonus": 2,
        "tem_bonus": 0,
        "ton_bonus": 4,
        "var_bonus": 4
    },
    {
        "id": 8,
        "name": "jazz",
        "int_bonus": -1,
        "rhy_bonus": 1,
        "tem_bonus": -1,
        "ton_bonus": 0,
        "var_bonus": 0
    },
    {
        "id": 10,
        "name": "dreamy",
        "int_bonus": -4,
        "rhy_bonus": -4,
        "tem_bonus": -3,
        "ton_bonus": 0,
        "var_bonus": 0
    },
    {
        "id": 11,
        "name": "dynamic",
        "int_bonus": 4,
        "rhy_bonus": 3,
        "tem_bonus": 2,
        "ton_bonus": 0,
        "var_bonus": 0
    },
    {
        "id": 12,
        "name": "expressive",
        "int_bonus": 0,
        "rhy_bonus": 1,
        "tem_bonus": 0,
        "ton_bonus": 0,
        "var_bonus": 4
    },
    {
        "id": 14,
        "name": "epic",
        "int_bonus": 4,
        "rhy_bonus": 2,
        "tem_bonus": 1,
        "ton_bonus": 0,
        "var_bonus": 0
    },
    {
        "id": 15,
        "name": "cinematic",
        "int_bonus": 2,
        "rhy_bonus": 1,
        "tem_bonus": 0,
        "ton_bonus": 2,
        "var_bonus": 3
    },
    {
        "id": 16,
        "name": "house",
        "int_bonus": 1,
        "rhy_bonus": 3,
        "tem_bonus": 1,
        "ton_bonus": 0,
        "var_bonus": -1
    },
    {
        "id": 17,
        "name": "latin",
        "int_bonus": 0,
        "rhy_bonus": 3,
        "tem_bonus": 0,
        "ton_bonus": 0,
        "var_bonus": 3
    },
    {
        "id": 18,
        "name": "sensual",
        "int_bonus": 0,
        "rhy_bonus": 2,
        "tem_bonus": 0,
        "ton_bonus": -3,
        "var_bonus": -2
    },
    {
        "id": 52,
        "name": "edm",
        "int_bonus": 2,
        "rhy_bonus": 4,
        "tem_bonus": 2,
        "ton_bonus": 0,
        "var_bonus": -3
    },
    {
        "id": 54,
        "name": "pop",
        "int_bonus": 0,
        "rhy_bonus": 1,
        "tem_bonus": 0,
        "ton_bonus": 1,
        "var_bonus": 1
    },
    {
        "id": 55,
        "name": "lounge",
        "int_bonus": -1,
        "rhy_bonus": -1,
        "tem_bonus": -2,
        "ton_bonus": 2,
        "var_bonus": 0
    },
    {
        "id": 56,
        "name": "ebm/industrial",
        "int_bonus": 1,
        "rhy_bonus": 4,
        "tem_bonus": 1,
        "ton_bonus": -3,
        "var_bonus": -4
    },
    {
        "id": 57,
        "name": "atmospheric",
        "int_bonus": 0,
        "rhy_bonus": -4,
        "tem_bonus": -4,
        "ton_bonus": 0,
        "var_bonus": -4
    },
    {
        "id": 58,
        "name": "urban",
        "int_bonus": 2,
        "rhy_bonus": 2,
        "tem_bonus": 2,
        "ton_bonus": -2,
        "var_bonus": 2
    },
    {
        "id": 59,
        "name": "down-to-earth",
        "int_bonus": 0,
        "rhy_bonus": 1,
        "tem_bonus": 1,
        "ton_bonus": 0,
        "var_bonus": -3
    },
    {
        "id": 60,
        "name": "low-key",
        "int_bonus": 1,
        "rhy_bonus": 0,
        "tem_bonus": 0,
        "ton_bonus": -4,
        "var_bonus": -2
    },
    {
        "id": 61,
        "name": "serious",
        "int_bonus": 1,
        "rhy_bonus": -2,
        "tem_bonus": -3,
        "ton_bonus": -4,
        "var_bonus": 0
    },
    {
        "id": 62,
        "name": "peaceful",
        "int_bonus": -1,
        "rhy_bonus": -2,
        "tem_bonus": -3,
        "ton_bonus": 4,
        "var_bonus": 0
    },
    {
        "id": 63,
        "name": "romantic",
        "int_bonus": 0,
        "rhy_bonus": -1,
        "tem_bonus": -2,
        "ton_bonus": 2,
        "var_bonus": 0
    },
    {
        "id": 64,
        "name": "symphonic",
        "int_bonus": 4,
        "rhy_bonus": 1,
        "tem_bonus": 0,
        "ton_bonus": 0,
        "var_bonus": 2
    },
    {
        "id": 65,
        "name": "dramatic",
        "int_bonus": 4,
        "rhy_bonus": 0,
        "tem_bonus": 1,
        "ton_bonus": -4,
        "var_bonus": 4
    },
    {
        "id": 66,
        "name": "groovy",
        "int_bonus": 0,
        "rhy_bonus": 4,
        "tem_bonus": 2,
        "ton_bonus": 0,
        "var_bonus": -1
    },
    {
        "id": 67,
        "name": "mysterious",
        "int_bonus": 0,
        "rhy_bonus": 2,
        "tem_bonus": -2,
        "ton_bonus": -4,
        "var_bonus": -4
    },
    "tagsRelations": {
        "1": {
            "2": -1,
            "16": -1,
            "4": -1
        },
        "2": {
            "1": -1,
            "14": -1,
            "15": -1,
            "8": -1
        },
        "16": {
            "1": -1,
            "4": -1,
            "8": -1,
            "14": -1,
            "15": -1,
            "17": -1
        },
        "14": {
            "2": -1,
            "8": -1,
            "16": -1,
            "17": -1,
            "4": -1
        },
        "15": {
            "2": -1,
            "4": -1,
            "8": -1,
            "16": -1,
            "17": -1
        },
        "4": {
            "1": -1,
            "15": -1,
            "16": -1,
            "17": -1,
            "14": -1
        },
        "8": {
            "2": -1,
            "14": -1,
            "15": -1,
            "16": -1,
            "17": -1
        },
        "5": {
            "12": -1
        },
        "12": {
            "5": -1
        },
        "17": {
            "4": -1,
            "8": -1,
            "14": -1,
            "15": -1,
            "16": -1
        },
        "10": {
            "11": -1
        },
        "11": {
            "10": -1,
            "13": -1
        },
        "13": {
            "11": -1
        }
    }
}

Last updated