Analyze Music API

Guide to Using the Media Analyze Music API

Media Analyze Music API

The Media Analyze Music API takes your music media file and delivers insights into the format and characteristics.

Key features:

✓ General media info
✓ Percentage of music in the media file
✓ Loudness
✓ Beats per minute (BPM)
✓ Musical key
✓ Genre
✓ Instruments

Start building

Why use Media Analyze Music API?

Do you need to determine:

  • what type of music is in a collection?
  • will media platforms accept my music format?
  • how much of the media file is music?

Example output

See the Analyze Music API reference for more detailed explanations on these values.

Media info

The media_info section gives you details about the container and codec. See the Media File Formats for more explanation on these values.

        "media_info": {
        "container": {
            "kind": "none",
            "duration": 40.821,
            "bitrate": 128000,
            "size": 655711
        },
        "audio": {
            "codec": "mp3",
            "channels": 2,
            "sample_rate": 48000,
            "duration": 40.824,
            "bitrate": 128000
        }
    }

Music

The music section helps identify the sections that have music, but also an identification of key, genre, and instrument detected with a confidence score.

            "music": {
                "percentage": 100.0,
                "num_sections": 1,
                "sections": [
                    {
                        "section_id": "mu_1",
                        "start": 0.0,
                        "duration": 40.32,
                        "loudness": -22.36,
                        "bpm": 53.1,
                        "key": [
                            [
                                "C major",
                                0.73
                            ]
                        ],
                        "genre": [
                            [
                                "jazz",
                                0.69
                            ],
                            [
                                "instrumental",
                                0.09
                            ],
                            [
                                "rock",
                                0.05
                            ]
                        ],
                        "instrument": [
                            [
                                "vocals",
                                0.07
                            ],
                            [
                                "piano",
                                0.45
                            ],
                            [
                                "guitar",
                                0.23
                            ],
                            [
                                "strings",
                                0.07
                            ]
                        ]
                    }

A good example to get started is this Cue Sheet that identifies the loudness and music within an audio file which can help get an idea of how to analyze your files.