jpochyla / psst

Fast and multi-platform Spotify client with native GUI
MIT License
8.5k stars 217 forks source link

Audio Features Integration #57

Open shiftgeist opened 3 years ago

shiftgeist commented 3 years ago

Spotify has a lot of metadata. It'd be nice to view them to some degree.

Example:

GET https://api.spotify.com/v1/audio-features
{
    "audio_features": [
        {
            "danceability": 0.808,
            "energy": 0.626,
            "key": 7,
            "loudness": -12.733,
            "mode": 1,
            "speechiness": 0.168,
            "acousticness": 0.00187,
            "instrumentalness": 0.159,
            "liveness": 0.376,
            "valence": 0.369,
            "tempo": 123.99,
            "type": "audio_features",
            "id": "4JpKVNYnVcJ8tuMKjAj50A",
            "uri": "spotify:track:4JpKVNYnVcJ8tuMKjAj50A",
            "track_href": "https://api.spotify.com/v1/tracks/4JpKVNYnVcJ8tuMKjAj50A",
            "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/WhpYUARk1kNJ_qP0AdKGcDDFKOQTTgsOoINrqyPQjkUnbteuuBiyj_u94iFCSGzdxGiwqQ6d77f4QLL_8=/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1458063189&Signature=JRE8SDZStpNOdUsPN/PoS49FMtQ%3D",
            "duration_ms": 535223,
            "time_signature": 4
        },
        {
            "danceability": 0.457,
            "energy": 0.815,
            "key": 1,
            "loudness": -7.199,
            "mode": 1,
            "speechiness": 0.034,
            "acousticness": 0.102,
            "instrumentalness": 0.0319,
            "liveness": 0.103,
            "valence": 0.382,
            "tempo": 96.083,
            "type": "audio_features",
            "id": "2NRANZE9UCmPAS5XVbXL40",
            "uri": "spotify:track:2NRANZE9UCmPAS5XVbXL40",
            "track_href": "https://api.spotify.com/v1/tracks/2NRANZE9UCmPAS5XVbXL40",
            "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/WhuQhwPDhmEg5TO4JjbJu0my-awIhk3eaXkRd1ofoJ7tXogPnMtbxkTyLOeHXu5Jke0FCIt52saKJyfPM=/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1458063189&Signature=qfclum7FwTaR/7aQbnBNO0daCsM%3D",
            "duration_ms": 187800,
            "time_signature": 4
        },
        {
            "danceability": 0.281,
            "energy": 0.402,
            "key": 4,
            "loudness": -17.921,
            "mode": 1,
            "speechiness": 0.0291,
            "acousticness": 0.0734,
            "instrumentalness": 0.83,
            "liveness": 0.0593,
            "valence": 0.0748,
            "tempo": 115.7,
            "type": "audio_features",
            "id": "24JygzOLM0EmRQeGtFcIcG",
            "uri": "spotify:track:24JygzOLM0EmRQeGtFcIcG",
            "track_href": "https://api.spotify.com/v1/tracks/24JygzOLM0EmRQeGtFcIcG",
            "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/ehbkMg05Ck-FN7p3lV7vd8TUdBCvM6z5mgDiZRv6iSlw8P_b8GYBZ4PRAlOgTl3e5rS34_l3dZGDeYzH4=/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1458063189&Signature=bnTm0Hcb%2Bxo8ZCmuxm1mY0JY4Hs%3D",
            "duration_ms": 497493,
            "time_signature": 3
        }
    ]
}

Docs: https://developer.spotify.com/documentation/web-api/reference/#endpoint-get-several-audio-features (page is very slow for me)

zrthxn commented 3 years ago

What would a user want to do with these primarily? I think spotify uses these to recommend tracks, so will that be the main use? Find other tracks with similar metrics?

shiftgeist commented 3 years ago

@zrthxn yes recommending tracks and finding similar tracks like done on (everynoise.com) is that I thought of.

jpochyla commented 3 years ago

I have a local branch with knobs for some of the recommendation parameters, more work is needed, though.

image
zrthxn commented 3 years ago

@jpochyla could you create a remote branch for this? I'd like to try to build something for this, maybe something like "tracks similar to..." or playlists of a similar type

jpochyla commented 3 years ago

Similar tracks have been in master for a while (right click on track). I've pushed preliminary support for the parameter knobs in a0ae67446251ce342a6e4e71c2b01c38aed07b99. I'm leaving this open, as some of the parameters don't have any knob yet, and we might also want to visualise audio properties of existing tracks.