Skip to content
DocumentationAPI Reference

Get Track's Audio Analysis

Deprecated
client.AudioAnalysis.Get(ctx, id) (*AudioAnalysisGetResponse, error)
GET/audio-analysis/{id}

Get a low-level audio analysis for a track in the Spotify catalog. The audio analysis describes the track’s structure and musical content, including rhythm, pitch, and timbre.

ParametersExpand Collapse
id string

The Spotify ID for the track.

ReturnsExpand Collapse
type AudioAnalysisGetResponse struct{…}
Bars []TimeIntervalObjectoptional

The time intervals of the bars throughout the track. A bar (or measure) is a segment of time defined as a given number of beats.

Confidence float64optional

The confidence, from 0.0 to 1.0, of the reliability of the interval.

minimum0
maximum1
Duration float64optional

The duration (in seconds) of the time interval.

Published booloptional

The playlist's public/private status (if it should be added to the user's profile or not): true the playlist will be public, false the playlist will be private, null the playlist status is not relevant. For more about public/private status, see Working with Playlists

Start float64optional

The starting point (in seconds) of the time interval.

Beats []TimeIntervalObjectoptional

The time intervals of beats throughout the track. A beat is the basic time unit of a piece of music; for example, each tick of a metronome. Beats are typically multiples of tatums.

Confidence float64optional

The confidence, from 0.0 to 1.0, of the reliability of the interval.

minimum0
maximum1
Duration float64optional

The duration (in seconds) of the time interval.

Published booloptional

The playlist's public/private status (if it should be added to the user's profile or not): true the playlist will be public, false the playlist will be private, null the playlist status is not relevant. For more about public/private status, see Working with Playlists

Start float64optional

The starting point (in seconds) of the time interval.

Meta AudioAnalysisGetResponseMetaoptional
AnalysisTime float64optional

The amount of time taken to analyze this track.

AnalyzerVersion stringoptional

The version of the Analyzer used to analyze this track.

DetailedStatus stringoptional

A detailed status code for this track. If analysis data is missing, this code may explain why.

InputProcess stringoptional

The method used to read the track's audio data.

Platform stringoptional

The platform used to read the track's audio data.

StatusCode int64optional

The return code of the analyzer process. 0 if successful, 1 if any errors occurred.

Timestamp int64optional

The Unix timestamp (in seconds) at which this track was analyzed.

formatint64
Published booloptional

The playlist's public/private status (if it should be added to the user's profile or not): true the playlist will be public, false the playlist will be private, null the playlist status is not relevant. For more about public/private status, see Working with Playlists

Sections []AudioAnalysisGetResponseSectionoptional

Sections are defined by large variations in rhythm or timbre, e.g. chorus, verse, bridge, guitar solo, etc. Each section contains its own descriptions of tempo, key, mode, time_signature, and loudness.

Confidence float64optional

The confidence, from 0.0 to 1.0, of the reliability of the section's "designation".

minimum0
maximum1
Duration float64optional

The duration (in seconds) of the section.

Key int64optional

The estimated overall key of the section. The values in this field ranging from 0 to 11 mapping to pitches using standard Pitch Class notation (E.g. 0 = C, 1 = C♯/D♭, 2 = D, and so on). If no key was detected, the value is -1.

KeyConfidence float64optional

The confidence, from 0.0 to 1.0, of the reliability of the key. Songs with many key changes may correspond to low values in this field.

minimum0
maximum1
Loudness float64optional

The overall loudness of the section in decibels (dB). Loudness values are useful for comparing relative loudness of sections within tracks.

Mode float64optional

Indicates the modality (major or minor) of a section, the type of scale from which its melodic content is derived. This field will contain a 0 for "minor", a 1 for "major", or a -1 for no result. Note that the major key (e.g. C major) could more likely be confused with the minor key at 3 semitones lower (e.g. A minor) as both keys carry the same pitches.

Accepts one of the following:
const AudioAnalysisGetResponseSectionModeModeNoResult AudioAnalysisGetResponseSectionMode = -1
const AudioAnalysisGetResponseSectionModeModeMinor AudioAnalysisGetResponseSectionMode = 0
const AudioAnalysisGetResponseSectionModeModeMajor AudioAnalysisGetResponseSectionMode = 1
ModeConfidence float64optional

The confidence, from 0.0 to 1.0, of the reliability of the mode.

minimum0
maximum1
Published booloptional

The playlist's public/private status (if it should be added to the user's profile or not): true the playlist will be public, false the playlist will be private, null the playlist status is not relevant. For more about public/private status, see Working with Playlists

Start float64optional

The starting point (in seconds) of the section.

Tempo float64optional

The overall estimated tempo of the section in beats per minute (BPM). In musical terminology, tempo is the speed or pace of a given piece and derives directly from the average beat duration.

TempoConfidence float64optional

The confidence, from 0.0 to 1.0, of the reliability of the tempo. Some tracks contain tempo changes or sounds which don't contain tempo (like pure speech) which would correspond to a low value in this field.

minimum0
maximum1
TimeSignature int64optional

An estimated time signature. The time signature (meter) is a notational convention to specify how many beats are in each bar (or measure). The time signature ranges from 3 to 7 indicating time signatures of "3/4", to "7/4".

minimum3
maximum7
TimeSignatureConfidence float64optional

The confidence, from 0.0 to 1.0, of the reliability of the time_signature. Sections with time signature changes may correspond to low values in this field.

minimum0
maximum1
Segments []AudioAnalysisGetResponseSegmentoptional

Each segment contains a roughly conisistent sound throughout its duration.

Confidence float64optional

The confidence, from 0.0 to 1.0, of the reliability of the segmentation. Segments of the song which are difficult to logically segment (e.g: noise) may correspond to low values in this field.

minimum0
maximum1
Duration float64optional

The duration (in seconds) of the segment.

LoudnessEnd float64optional

The offset loudness of the segment in decibels (dB). This value should be equivalent to the loudness_start of the following segment.

LoudnessMax float64optional

The peak loudness of the segment in decibels (dB). Combined with loudness_start and loudness_max_time, these components can be used to describe the "attack" of the segment.

LoudnessMaxTime float64optional

The segment-relative offset of the segment peak loudness in seconds. Combined with loudness_start and loudness_max, these components can be used to desctibe the "attack" of the segment.

LoudnessStart float64optional

The onset loudness of the segment in decibels (dB). Combined with loudness_max and loudness_max_time, these components can be used to describe the "attack" of the segment.

Pitches []float64optional

Pitch content is given by a “chroma” vector, corresponding to the 12 pitch classes C, C#, D to B, with values ranging from 0 to 1 that describe the relative dominance of every pitch in the chromatic scale. For example a C Major chord would likely be represented by large values of C, E and G (i.e. classes 0, 4, and 7).

Vectors are normalized to 1 by their strongest dimension, therefore noisy sounds are likely represented by values that are all close to 1, while pure tones are described by one value at 1 (the pitch) and others near 0. As can be seen below, the 12 vector indices are a combination of low-power spectrum values at their respective pitch frequencies. pitch vector

Published booloptional

The playlist's public/private status (if it should be added to the user's profile or not): true the playlist will be public, false the playlist will be private, null the playlist status is not relevant. For more about public/private status, see Working with Playlists

Start float64optional

The starting point (in seconds) of the segment.

Timbre []float64optional

Timbre is the quality of a musical note or sound that distinguishes different types of musical instruments, or voices. It is a complex notion also referred to as sound color, texture, or tone quality, and is derived from the shape of a segment’s spectro-temporal surface, independently of pitch and loudness. The timbre feature is a vector that includes 12 unbounded values roughly centered around 0. Those values are high level abstractions of the spectral surface, ordered by degree of importance.

For completeness however, the first dimension represents the average loudness of the segment; second emphasizes brightness; third is more closely correlated to the flatness of a sound; fourth to sounds with a stronger attack; etc. See an image below representing the 12 basis functions (i.e. template segments). timbre basis functions

The actual timbre of the segment is best described as a linear combination of these 12 basis functions weighted by the coefficient values: timbre = c1 x b1 + c2 x b2 + ... + c12 x b12, where c1 to c12 represent the 12 coefficients and b1 to b12 the 12 basis functions as displayed below. Timbre vectors are best used in comparison with each other.

Tatums []TimeIntervalObjectoptional

A tatum represents the lowest regular pulse train that a listener intuitively infers from the timing of perceived musical events (segments).

Confidence float64optional

The confidence, from 0.0 to 1.0, of the reliability of the interval.

minimum0
maximum1
Duration float64optional

The duration (in seconds) of the time interval.

Published booloptional

The playlist's public/private status (if it should be added to the user's profile or not): true the playlist will be public, false the playlist will be private, null the playlist status is not relevant. For more about public/private status, see Working with Playlists

Start float64optional

The starting point (in seconds) of the time interval.

Track AudioAnalysisGetResponseTrackoptional
AnalysisChannels int64optional

The number of channels used for analysis. If 1, all channels are summed together to mono before analysis.

AnalysisSampleRate int64optional

The sample rate used to decode and analyze this track. May differ from the actual sample rate of this track available on Spotify.

CodeVersion float64optional

A version number for the Echo Nest Musical Fingerprint format used in the codestring field.

Codestring stringoptional

An Echo Nest Musical Fingerprint (ENMFP) codestring for this track.

Duration float64optional

Length of the track in seconds.

EchoprintVersion float64optional

A version number for the EchoPrint format used in the echoprintstring field.

Echoprintstring stringoptional

An EchoPrint codestring for this track.

EndOfFadeIn float64optional

The time, in seconds, at which the track's fade-in period ends. If the track has no fade-in, this will be 0.0.

Key int64optional

The key the track is in. Integers map to pitches using standard Pitch Class notation. E.g. 0 = C, 1 = C♯/D♭, 2 = D, and so on. If no key was detected, the value is -1.

minimum-1
maximum11
KeyConfidence float64optional

The confidence, from 0.0 to 1.0, of the reliability of the key.

minimum0
maximum1
Loudness float64optional

The overall loudness of a track in decibels (dB). Loudness values are averaged across the entire track and are useful for comparing relative loudness of tracks. Loudness is the quality of a sound that is the primary psychological correlate of physical strength (amplitude). Values typically range between -60 and 0 db.

formatfloat
Mode int64optional

Mode indicates the modality (major or minor) of a track, the type of scale from which its melodic content is derived. Major is represented by 1 and minor is 0.

ModeConfidence float64optional

The confidence, from 0.0 to 1.0, of the reliability of the mode.

minimum0
maximum1
NumSamples int64optional

The exact number of audio samples analyzed from this track. See also analysis_sample_rate.

OffsetSeconds int64optional

An offset to the start of the region of the track that was analyzed. (As the entire track is analyzed, this should always be 0.)

RhythmVersion float64optional

A version number for the Rhythmstring used in the rhythmstring field.

Rhythmstring stringoptional

A Rhythmstring for this track. The format of this string is similar to the Synchstring.

SampleMd5 stringoptional

This field will always contain the empty string.

StartOfFadeOut float64optional

The time, in seconds, at which the track's fade-out period starts. If the track has no fade-out, this should match the track's length.

SynchVersion float64optional

A version number for the Synchstring used in the synchstring field.

Synchstring stringoptional

A Synchstring for this track.

Tempo float64optional

The overall estimated tempo of a track in beats per minute (BPM). In musical terminology, tempo is the speed or pace of a given piece and derives directly from the average beat duration.

formatfloat
TempoConfidence float64optional

The confidence, from 0.0 to 1.0, of the reliability of the tempo.

minimum0
maximum1
TimeSignature int64optional

An estimated time signature. The time signature (meter) is a notational convention to specify how many beats are in each bar (or measure). The time signature ranges from 3 to 7 indicating time signatures of "3/4", to "7/4".

minimum3
maximum7
TimeSignatureConfidence float64optional

The confidence, from 0.0 to 1.0, of the reliability of the time_signature.

minimum0
maximum1
WindowSeconds int64optional

The length of the region of the track was analyzed, if a subset of the track was analyzed. (As the entire track is analyzed, this should always be 0.)

Get Track's Audio Analysis

package main

import (
  "context"
  "fmt"

  "github.com/cjavdev/spotted-go"
  "github.com/cjavdev/spotted-go/option"
)

func main() {
  client := spotted.NewClient(
    option.WithAccessToken("My Access Token"),
  )
  audioAnalysis, err := client.AudioAnalysis.Get(context.TODO(), "11dFghVXANMlKmJXsNCbNl")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", audioAnalysis.Bars)
}
{
  "bars": [
    {
      "confidence": 0.925,
      "duration": 2.18749,
      "published": true,
      "start": 0.49567
    }
  ],
  "beats": [
    {
      "confidence": 0.925,
      "duration": 2.18749,
      "published": true,
      "start": 0.49567
    }
  ],
  "meta": {
    "analysis_time": 6.93906,
    "analyzer_version": "4.0.0",
    "detailed_status": "OK",
    "input_process": "libvorbisfile L+R 44100->22050",
    "platform": "Linux",
    "status_code": 0,
    "timestamp": 1495193577
  },
  "published": true,
  "sections": [
    {
      "confidence": 1,
      "duration": 6.97092,
      "key": 9,
      "key_confidence": 0.297,
      "loudness": -14.938,
      "mode": -1,
      "mode_confidence": 0.471,
      "published": true,
      "start": 0,
      "tempo": 113.178,
      "tempo_confidence": 0.647,
      "time_signature": 4,
      "time_signature_confidence": 1
    }
  ],
  "segments": [
    {
      "confidence": 0.435,
      "duration": 0.19891,
      "loudness_end": 0,
      "loudness_max": -14.25,
      "loudness_max_time": 0.07305,
      "loudness_start": -23.053,
      "pitches": [
        0.212,
        0.141,
        0.294
      ],
      "published": true,
      "start": 0.70154,
      "timbre": [
        42.115,
        64.373,
        -0.233
      ]
    }
  ],
  "tatums": [
    {
      "confidence": 0.925,
      "duration": 2.18749,
      "published": true,
      "start": 0.49567
    }
  ],
  "track": {
    "analysis_channels": 1,
    "analysis_sample_rate": 22050,
    "code_version": 3.15,
    "codestring": "codestring",
    "duration": 207.95985,
    "echoprint_version": 4.15,
    "echoprintstring": "echoprintstring",
    "end_of_fade_in": 0,
    "key": 9,
    "key_confidence": 0.408,
    "loudness": -5.883,
    "mode": 0,
    "mode_confidence": 0.485,
    "num_samples": 4585515,
    "offset_seconds": 0,
    "rhythm_version": 1,
    "rhythmstring": "rhythmstring",
    "sample_md5": "sample_md5",
    "start_of_fade_out": 201.13705,
    "synch_version": 1,
    "synchstring": "synchstring",
    "tempo": 118.211,
    "tempo_confidence": 0.73,
    "time_signature": 4,
    "time_signature_confidence": 0.994,
    "window_seconds": 0
  }
}
Returns Examples
{
  "bars": [
    {
      "confidence": 0.925,
      "duration": 2.18749,
      "published": true,
      "start": 0.49567
    }
  ],
  "beats": [
    {
      "confidence": 0.925,
      "duration": 2.18749,
      "published": true,
      "start": 0.49567
    }
  ],
  "meta": {
    "analysis_time": 6.93906,
    "analyzer_version": "4.0.0",
    "detailed_status": "OK",
    "input_process": "libvorbisfile L+R 44100->22050",
    "platform": "Linux",
    "status_code": 0,
    "timestamp": 1495193577
  },
  "published": true,
  "sections": [
    {
      "confidence": 1,
      "duration": 6.97092,
      "key": 9,
      "key_confidence": 0.297,
      "loudness": -14.938,
      "mode": -1,
      "mode_confidence": 0.471,
      "published": true,
      "start": 0,
      "tempo": 113.178,
      "tempo_confidence": 0.647,
      "time_signature": 4,
      "time_signature_confidence": 1
    }
  ],
  "segments": [
    {
      "confidence": 0.435,
      "duration": 0.19891,
      "loudness_end": 0,
      "loudness_max": -14.25,
      "loudness_max_time": 0.07305,
      "loudness_start": -23.053,
      "pitches": [
        0.212,
        0.141,
        0.294
      ],
      "published": true,
      "start": 0.70154,
      "timbre": [
        42.115,
        64.373,
        -0.233
      ]
    }
  ],
  "tatums": [
    {
      "confidence": 0.925,
      "duration": 2.18749,
      "published": true,
      "start": 0.49567
    }
  ],
  "track": {
    "analysis_channels": 1,
    "analysis_sample_rate": 22050,
    "code_version": 3.15,
    "codestring": "codestring",
    "duration": 207.95985,
    "echoprint_version": 4.15,
    "echoprintstring": "echoprintstring",
    "end_of_fade_in": 0,
    "key": 9,
    "key_confidence": 0.408,
    "loudness": -5.883,
    "mode": 0,
    "mode_confidence": 0.485,
    "num_samples": 4585515,
    "offset_seconds": 0,
    "rhythm_version": 1,
    "rhythmstring": "rhythmstring",
    "sample_md5": "sample_md5",
    "start_of_fade_out": 201.13705,
    "synch_version": 1,
    "synchstring": "synchstring",
    "tempo": 118.211,
    "tempo_confidence": 0.73,
    "time_signature": 4,
    "time_signature_confidence": 0.994,
    "window_seconds": 0
  }
}