Saturday, April 26, 2014

Status on 26/04/2014

For the past few days I've been trying to run an android app to identify a song using Echoprint(www.echoprint.me). Unfortunately, it is not working. I've been testing it with several songs, but none of them are replied with the right answer from the server. There was a lot of things to learn! It was a new information for me to know that the Android can run c++ codes also. I've used NDK to build the library, which was already there in the internet!

 This is what I've done! 

1. Followed the exact methods from http://masl.cis.gvsu.edu/2012/01/25/android-echoprint/ to create a library, which I didn't use.
2. Realized that there is already a package which could be compiled and installed on android and downloaded it for testing the code. (https://github.com/gvsumasl/EchoprintForAndroid). 
3. There was an "Unknown error" and there was some problem in jsonformat. The author of the package should have used some other server, while I used echonest's API.
4. I managed to print the response of the request, but it failed even for "Bryan Adam's summer of 69". It was there in the list of identifiable songs in echoprint's site.
5. Anyway, it was a nice way to start with and I'm still with zero lines of codes of my own. 

At the same time, I happened to find an open source music player app from the internet.( https://github.com/kreed/vanilla). Before compiling and installing, I downloaded the app to my phone from google play. I was totally astonished to see a decent music player. I downloaded the source and I was totally confused to see how this app is working. The layout and the apps were good. The very next day, I got a notification that there is an update for vanilla on my phone. Then, I went to the github page and realized that the project was abandoned and the last commit was 2 years back.  There is no point in reinventing the wheels, so I decided to add my idea to a different module and add it with the present project. That confusion made some logic, it felt good when I realized that I was looking at a completely different project. 

Right now, the plan is to create a service which should work on a scheduled time to learn the listening habits of the users. Learn only the songs which he is playing. The other issue is with mp3 decoding! As far as I know, there is no android api to decode the mp3 songs and get it's PCM data. I should be looking at JLayer or Lame to decode the mp3. 

When I used Jlayer in my academic project (desktop application) and it required FFMPEG to decode the mp3 and there was some problem with decoding chunks of mp3 data. I had to convert the entire mp3 file to make it work.  I do not know how I am going to do that stuff in android, even if it is possible, I sense that there should be a small layer of "decoding and conversion" which should be followed in order to make this thing work. Echoprint currently accept only PCM values of a specific frequency and sampling, which would be highly expensive. 

I tried to compile LAME decoder to android using ndk, by using a method other than this, which didn't work and my laptop, which may or may not survive an another power failure is testing my patience!

Raghu