Soundcloud changed their API to requirea token. Here is a working example. Thank you Soundcloud! example to work.
git clone https://github.com/greggman/soundcloud-audio-reactive-example.git
cd soundcloud-audio-reactive-example
npm init
CLIENT_ID="your-client-id" SECRET="your-secret" node index.js
Now open the browser to http://localhost:8080
and open the
browser's dev tools.
- page makes request to this server for a track URL
- server asks soundcloud for an auth token
- server uses token to call
/resolve
endpoint to get track info which includes stream_url - server requests actual track URL URL for
<audio>
tag - page waits for user to click
- page sets
src
field of<audio>
tag to URL from step 4 and uses WebAudio API to analyse music as it streams
This is what the code used to do. Unfortunately while it worked with Chrome and Firefox it failed in Safari
- page makes request to this server for a token
- server asks soundcloud for an auth token, sends token to page
- page uses token to call
/resolve
endpoint to get track info which includes stream_url - page uses
GET
request to try to get actual URL for<audio>
tag - page waits for user to click
- page sets
src
field of<audio>
tag to URL from step 4 and uses WebAudio API to analyse music as it streams
CC0