A music streaming search engine for Youtube, Spotify, and Soundcloud.
A music streaming search engine for Youtube, Spotify, and Soundcloud.
Playlisting and music recommendation data.
The Echonest API provides sample level audio analysis.
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.
You will need to sign up for a developer account at The Echo Nest, and get an API key. https://developer.echonest.com
Edit the ruby server file: echonest-synth2.rb replacing the API with your new API from echonest
Install the following ruby gems (from the terminal):
gem install patron
gem install osc-ruby
gem install json
gem install uri
1. In Terminal run the ruby server:
2. Open the Max patch: echonest-synth4.maxpat and turn on the audio.
3. Enter an Artist and Song title for analysis, in the text boxes. Then press the greet 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:
3. Press one of the preset buttons to turn on the tracks.
4. Now you can play the track by pressing the /play button.
The Mixer channels from Left to right are:
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:
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. Its essentially the same approach I use when asked to play bass at an open mic night.
The envelopes click at times – it may be due to the relaxed method of timing, i.e.., none at all. If they don’t go away when timing is corrected, this might get cleaned up by adding a few milliseconds to the release time – or looking ahead to make sure the edges of segments are lining up.
[update] Using the Max [poly~] object cleared up the clicking and distortion issues.
Timbre data drives a random noise filter machine. I just patched something together and it sounded responsive – but its kind of hissy – an LPF might make it less interesting.
Haven’t used any of the beat, tatum, or section data yet. The section data should be useful for quashing monotony.
another update – 4/2013
tried to write this into a Max4Live device – so that the pitch data would be played my a Midi (software) instrument. No go. The velocity data gets interpreted in mysterious ways – plus each instrument has its own envelope which interferes with the segment envelopes. Need to think this through. One idea would be to write a device which uses EN analysis data for beats to set warp markers in Live. It would be an amazing auto-warp function for any song. Analysis wars: Berlin vs. Somerville.
Echonest anaylsis in Max.
By Michael Dewberrry
I downloaded the fork version from ‘dewb’ as it has been converted to run in Max6. It looks like the object retrieves all of the analysis data. It would actually be instructive to read the source code to see how they implemented libcurl and JSON for the http: requests.
Pure imagination using the Echonest API.
by Paul Lamere
National Weather Service REST API
Now using this API with Max and Pd. See the Internet sensors projects:
This fork adds the following features to Chris Wilson’s Web Audio Playground:
Try it out at: http:zerokidz.com/wap/index.html
For optimum results try Chrome on Mac OS. But it does work in other browsers.
Patch file format is JSON. Patches are reloaded by firing gesture events which created them.
Source code: https://github.com/tkzic/WebAudio
Note: You can either run a local web server, using nodeserver.js and index.html – in the WebAudio folder – or use the online version of WAP as described here.
1. Load WAP in a Google Chrome browser using the following URL: http:zerokidz.com/wap/index.html
2. In WAP, load a patch called: delay-thing.
Note: If the patch doesn’t exist you can paste it in by opening the file osctest/delay-thing.json in a text editor and copying the text. Then click paste in WAP and paste in the text. Then make sure to save it in WAP by typing in the name “delay-thing” and clicking the save-as: button
3. In a terminal window, go to the osctest/ folder and start the server by typing:
4. In WAP, Press the OSC button – the ruby server should acknowledge with the message: “WebSocket connection open”
5. Open the Max patch: wapOSCtester.maxpat
6. In WAP press the play button on the Oscillator module (you should hear sounds)
7. In the Max patch drag the slider on the left to control the oscillator pitch. You should hear the sound change and see the sliders move in WAP.
The html side of the connection is done in js/socketsOSC.js
look at the function: connectOSC() – which gets triggered by the OSC button in index.html
Incoming messages from Max (via Ruby server) are parsed in parseOSCMessage() which figures out how to set appropriate values for the audio objects in the DOM.
There are currently no acknowledgement or error messages being returned (at least I don’t remember doing this)
The recorder works with the web audio API. There is an example which records audio input from the built in mic, writes it to a .wav file, and creates a link for download.
local version in tkzic/web-audio-api/Recorderjs-master/example_simple_exportwav.html
This is a tweak of a demo program by Boris Smus from http://webaudioapi.com
The audio is generated in the web browser using the webaudio API. Oscillator frequency is being controlled by an iPod touch running touchOSC.
A ruby program is running in the background. It starts 2 servers, one to handle Osc messages from the iPod. and a websockets server which passes Osc messages to the web client in the browser, which parses the data and sets oscillator frequency.
local source files in tkzic/web-audio-api/webaudioapi/content/posts/oscillator-ws
(these are for my local files – source has not been published yet) Please contact me directly for more information about this code. Or have a look at a very similar example at: https://github.com/tkzic/WebAudio
1. run the node webserver in tkzic/
(it will run on localhost port 8081 – for example http://127.0.0.1:8081)
2. In Chrome web browser, run: http://192.168.1.104:8081/web-audio-api/webaudioapi/content/posts/oscillator-ws/index.html
The following screen will appear:
3. From a terminal prompt run this ruby script (in tkzic/web-audio-api/webaudioapi/content/posts/oscillator-ws)
4. In webpage in Chrome, click the sockets button – the ruby server should open a socket connection, also click the play/pause button to start the oscillator
5. In touchOSC point the host to the ip address of the laptop (ie., 192.168.1.104) running on default ports, (out 8000, in 9000)
6. In touchOSC run the ‘simple’ layout and move fader1 to change the pitch of the oscillator
Need to clean up the ruby server code to handle error conditions, ie., network interruptions, missing files, browser incompatibility, etc.,