Echo Nest API audio analysis data is now provided by Spotify. This project is part of the internet-sensors project: https://reactivemusic.net/?p=5859 and updates the 2013 Echo Nest project described here: https://reactivemusic.net/?p=6296
The original analyzer document by Tristan Jehan can be found here (for the time being): https://web.archive.org/web/20160528174915/http://developer.echonest.com/docs/v4/_static/AnalyzeDocumentation.pdf
This implementation uses node.js for Max instead of Ruby to access the API. You will need set up a developer account with Spotify and request API credentials. See below.
Other than that, the synthesis code in Max has not changed. Some of the following background information and video is from the original version. ..
What if you used that data to reconstruct music by driving a sequencer in Max? The analysis is a series of time based quanta called segments. Each segment provides information about timing, timbre, and pitch – roughly corresponding to rhythm, harmony, and melody.
main Max patch
abstractions and other files
node folders and infrastructure
- You will need to install node.js
- the node package manager will do the rest – see below.
Note: Your best bet is to just download the repository, leave everything in place, and run it from the existing folder
You will need to sign up for a developer account at Spotify and get an API key. https://developer.spotify.com/documentation/general/guides/authorization-guide/
Edit spot1.js replacing the cliendID and clientSecret with your spotify credentials
node for max install instructions (first time only)
- Open the Max patch: spotify-synth1.maxpat
- Scroll the patch over to the far right side until you see this green panel:
- Click the [script npm init] message – this initializes the node infrastructure in the current folder
- Then click each of the 2 script npm install messages – this installs the necessary libraries
- Open the Max patch: spotify-synth1.maxpat
- Click the green [script start] message
- Click the Speaker icon to start audio
- Click the first dot in the preset object to set the mixer settings to something reasonable
- open the Max Console window so you can see the Spotify API data
- From the 2 menus at the top of the screen select an Artist and Title that match, for example: Albert Ayler and “Witches and Devils”
- Click the [analyze] button – the console window should fill with interest data about your selection.
- Click [play]
- Note: if you hear a lot of clicks and pops, reduce the audio sample rate to 44.1 KHz.
Alternative search method:
Enter an Artist and Song title for analysis, in the text boxes. Then press the buttons for title and artist. Then press the /analyze button. If it works you will get prompts from the terminal window, the Max window, and you should see the time in seconds in upper right corner of the patch.
If there are problems with the analysis, its most likely due to one of the following:
- artist or title spelled incorrectly
- song is not available
- song is too long
- API is busy
The Mixer channels from Left to right are:
- synth (left)
- synth (right)
- random octave synth
- timbre synth
- master volume
- gain trim
- HPF cutoff frequency
Best results happen with slow abstract material, like the Miles (Wayne Shorter) piece above. The bass is not really happening. Lines all sound pretty much the same. I’m thinking it might be possible to derive a bass line from the pitch data by doing a chordal analysis of the analysis.
Here are screenshots of the Max sub-patches (the main screen is in the video above)
Timbre (percussion synth) – plays filtered noise:
Random octave synth:
Here’s a Coltrane piece, using roughly the same configuration but with sine oscillators for everything:
There are issues with clicks on the envelopes and the patch is kind of a mess but it plays!
Several modules respond to the API data:
- tone synthesiszer (pitch data)
- harmonic (random octave) synthesizer (pitch data)
- filtered noise (timbre data)
- bass synthesizer (key and mode data)
- envelope generator (loudness data)
Since the key/mode data is global for the track, bass notes are probable guesses. This method doesn’t work for material with strong root motion or a variety of harmonic content. It’s essentially the same approach I use when asked to play bass at an open mic night.
Now that this project is running again. I plan to write additional synthesizers that follow more of the spirit of the data. For example, distinguishing strong pitches from noise.
Also would like to make use of the [section] data as well as the rhythmic analysis. There is an amazing amount of potential here.