Disclosure: I build Audial, the API this post uses.

In November 2024 Spotify stopped giving new Web API apps access to the audio-features and audio-analysis endpoints. If you built playlist tools, DJ utilities or music dashboards on energy, danceability and tempo, a new app can't get those numbers from Spotify any more. Threads asking for a replacement are still open.

Here's one replacement that works on audio files you have. It measures energy, danceability, loudness, key, tempo and time signature for the whole track, and energy, danceability and loudness for each section.

The code

pip install audial-sdk export AUDIAL_API_KEY=your_key # from audialmusic.ai, Profile → Apps & API Keys 
import audial song = audial.segment("track.mp3") # sections, tempo, bars, key features = audial.audio_features(song["analysis_id"]) # energy, danceability, loudness a = song["analysis"] f = features["features"] print(a["bpm"], a["key"], a["camelot"], a["time_signature"]) print(f["energy"], f["danceability"], f["loudness_lufs"], f["mode"]) for s in features["sections"]: print(f'{s["start"]:6.1f}-{s["end"]:6.1f} {s["label"]:<7} ' f'energy {s["energy"]} danceability {s["danceability"]}') 

On a 65-second demo song, both calls together took 38 seconds and printed:

89.99 Dmin 7A 4/4 0.27 0.604 -14.35 Dorian 0.0- 21.9 INTRO energy 0.089 danceability 0.357 21.9- 43.2 VERSE energy 0.432 danceability 0.756 43.2- 48.5 UP energy 0.126 danceability 0.38 48.5- 65.6 VERSE energy 0.347 danceability 0.8 

The per-section numbers are the part Spotify never gave you. The intro sits at 0.09 energy and the verses around 0.35–0.43, so you can tell a build from a drop, not just one number for the whole song.

How the fields map

Spotify audio features Here
energy (0–1) features.energy (0–1), plus one per section
danceability (0–1) features.danceability (0–1), plus one per section
loudness (dB) features.loudness_lufs (integrated LUFS, ITU-R BS.1770), plus one per section
tempo analysis.bpm, plus a tempo map in analysis.grid for tracks that drift
key + mode (integers) analysis.key (e.g. Dmin), analysis.camelot (7A), and features.mode as a mode name (e.g. Dorian) with mode_confidence
time_signature analysis.time_signature
valence, acousticness, speechiness, instrumentalness, liveness Not provided. audial.tags(id) gives moods, genres and instruments as words instead

What's different, honestly

  • You need the audio. Spotify computed features from a track ID. This works on a file you upload, so it fits your own music, a DJ library on disk or a label's catalogue. It doesn't help if all you have is Spotify IDs.
  • It's slower than a lookup. It analyses the audio, so a track takes about half a minute. The first call after a quiet period can take a few minutes while a machine starts. For a library, run tracks in parallel and cache the JSON.
  • The numbers are its own. Energy here reflects loudness, rhythmic activity and low end, and danceability reflects how strong and regular the beat is. They're on the same 0–1 scale as Spotify's but aren't Spotify's model, so don't mix the two in one dataset.

Cost

  • Free: 2 runs. An analysis with its features counts as one run, so that's two tracks.
  • After that: $10 a month for 100 credits. On a plan, segment and audio_features are a credit each.
  • REST: the same calls work over plain REST if you're not in Python. POST /api/functions/run/segmentation, then POST /api/functions/run/audio-features with the analysis id. The API reference is at audialmusic.ai/resources/api-reference.

If you're replacing Spotify's endpoint in something real, I'd like to hear what's missing. Valence is the one I expect to hear about.