Skip to content

Instantly share code, notes, and snippets.

@karlgrz
Created November 2, 2012 06:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karlgrz/3999158 to your computer and use it in GitHub Desktop.
Save karlgrz/3999158 to your computer and use it in GitHub Desktop.
Steps to reproduce echonest remix problems with Ubuntu 12.10, Python 2.7, VirtualBox on Windows 7 Host
-Windows 7 64-bit Ultimate host, Virtualbox version 4.24
- Ubuntu Desktop 12.10 64-bit from ubuntu.com 7:30PM 2012-11-02
- installed following (I realize some of these have nothing to do with running these libraries, but I wanted to include anything in case something sticks out to you guys)
- hg
- git
- dropbox
- keepass
- chromium
- vsftpd
- build-essential
- ffmpeg (including ln -s .......en-ffmpeg)
- python2.7-dev
- python-setuptools
- sudo easy_install pip
- sudo pip install numpy
- created new ssh keys
- confirm "import numpy" works
- confirm en-ffmpeg works
- git clone https://github.com/echonest/remix.git
- cd remix
- git submodule update --init (appeared to check out the most recent, starts with 73046e...")
- added my API key to .bashrc and confirmed it was set properly
- sudo python setup.py install (from remix)
- python test.py (which looks similar to the Step 4 - Make something beautiful example from http://echonest.github.com/remix/index.html#how except I used my own mp3, a filename called Rain.mp3 output to RainReverse.mp3, both in the same folder as test.py, which is two levels above remix github repo)
Here's the output:
karl@karl-VirtualBox:~$ python test.py
en-ffmpeg -i "Rain.mp3"
en-ffmpeg -y -i "Rain.mp3" -ac 2 -ar 44100 "/tmp/tmpUeMqCw.wav"
Computed MD5 of file is d68d079a0cb2571ec693cbbe834a0b89
Probing for existing analysis
Analysis not found. Uploading...
Traceback (most recent call last):
File "test.py", line 5, in <module>
audio_file = audio.LocalAudioFile("Rain.mp3")
File "/usr/local/lib/python2.7/dist-packages/remix-1.5.0-py2.7-linux-x86_64.egg/echonest/audio.py", line 896, in __init__
tempanalysis = AudioAnalysis(filename)
File "/usr/local/lib/python2.7/dist-packages/remix-1.5.0-py2.7-linux-x86_64.egg/echonest/audio.py", line 125, in __init__
self.metadata = self.pyechonest_track.meta
AttributeError: 'Track' object has no attribute 'meta'
karl@karl-VirtualBox:~$
I'm happy to provide any more information that might help debug this. I'll also try some more things tomorrow.
KG
"""Reverse a song by playing its beats forward starting from the end of the song"""
import echonest.audio as audio
# Easy around wrapper mp3 decoding and Echo Nest analysis
audio_file = audio.LocalAudioFile("Rain.mp3")
# You can manipulate the beats in a song as a native python list
beats = audio_file.analysis.beats
beats.reverse()
# And render the list as a new audio file!
audio.getpieces(audio_file, beats).encode("RainReverse.mp3")
@tkell
Copy link

tkell commented Nov 2, 2012

Thanks for the super-detailed info! Quick question: what version of python do you have?

Thanks!
Thor

@karlgrz
Copy link
Author

karlgrz commented Nov 5, 2012

My apologies for omitting that specifically. Python 2.7.3.

@karlgrz
Copy link
Author

karlgrz commented Nov 6, 2012

So I found out that Ubuntu 12.10 doesn't install linux kernel headers by default. I didn't think this had anything to do with this problem (since it seems more of an issue with what is being returned from the EchoNest API, but I'm just speculating here) but I figured I'd try to re-install everything after installing the headers. Still fails with the same error.

@karlgrz
Copy link
Author

karlgrz commented Nov 6, 2012

Hmm...this is possibly odd. I tried to query the Echo Nest API for the MD5 of the song I am trying to analyze in test.py and I get a Forbidden response. Could it be possible that my API key or account is somehow inactive or something? Here's the call and output:

curl -F "api_key=3DZYVD30H9QKDS6VE" -F "format=json" -F "md5=d68d079a0cb2571ec693cbbe834a0b89" -F "bucket=audio_summary" "http://developer.echonest.com/api/v4/track/analyze"
{"response": {"status": {"version": "4.2", "code": 0, "message": "Success"}, "track": {"status": "forbidden", "id": "TRSUBDC13A9EED0348"}}}

@karlgrz
Copy link
Author

karlgrz commented Nov 6, 2012

Whoa, ok. Mind = blown.

I used a different mp3 (something off of a commercially released record, in this case Jerry Cantrell's Degradation Trip) and this time the analysis (and also test.py) executed successfully.

Does this mean that I CANNOT analyze home brewed tracks? That makes the remix API a little useless to me, as I had wanted to use it for mixing up my own songs (i.e. songs I export from Cubase). Am I doing something wrong?

@tkell
Copy link

tkell commented Nov 8, 2012

In terms of your API key, the simplest test is this:
http://developer.echonest.com/api/v4/artist/search?api_key=YOUR_API_KEY&name=radiohead, which looks good.

In terms of remix metadata, I suspect that the API is being a bit kittenish. For the moment, my tests indicate that you can just comment out the offending line in audio.py, and nothing in remix should break:

        self._bars = None
        self._beats = None
        self._tatums = None
        self._sections = None
        self._segments = None

        self.identifier = self.pyechonest_track.id
        # self.metadata   = self.pyechonest_track.meta # this is the problem line!   

We'll get a better fix pushed out soon, but that should get you up and running. If you have problems with that, let me know!

Best,
Thor

@karlgrz
Copy link
Author

karlgrz commented Nov 8, 2012

Thank you, my friend. Much appreciate the prompt help! This makes a happy developer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment