Showing posts with label line. Show all posts
Showing posts with label line. Show all posts

Thursday, August 11, 2011

Getting Lyrics of Songs in Java in 2 line code

Hello Fellaws,


Hope you all are having fun with your favorite programming language JAVA <3 :)


Well today in this post I am providing you an API which will take Song Name and Singer's name as arguments and in response it will provide you the lyrics of that song.


Requirement is Internet Connection else it will respond empty String ("")


Below is the API download link
Download Here


Lets begin with demo

  • Import this JAR file in your project. I am using NetBeans to develop my demo code. Steps are provided to import API in your code using NetBeans
    • Right click on your project name present on left Pane of Netbeans (Under which you have your .java files etc.
    • Select Properties, in the Project Properties Frame select Libraries on left pane
    • Click on Add Jar/Folder and select the above JAR file
    • You are done with importing API in your project




  • Now comes the coding part below is the code, in this code I am providing the Song Name : Only You Can Love Me This Way and Singer Name : Keith Urban


Congrats in 2 line code you get your favorite song's lyrics


Thats it for this Post.


Take Care


Peace



For Any Query mail me: ravjot.singh.28@gmail.com

Friday, August 5, 2011

Playing any Mp3 and stopping it using 2 line code ;)

Hello Fellaws,


Hope you are enjoying your java codes ;) :P


Well today i will provide you APIs to play mp3 songs using your own code ;)


I know it feels great playing your fav. songs using your code ;) ;) ;) <3


So lets begin below is the zip file containing 2 APIs
Download Here


This RavMp3APIs.zip contains 2 JAR files
1. RavMp3.jar   -> Contains the core code to play Mp3 Songs
2. RavMp3Support.jar   -> Contains Supporting files


So, just download this zip file and read the below steps to play Mp3 files ;)


Steps are as follows

  • Import these JAR files in your project. I am using NetBeans to develop my demo code. Steps are provided to import APIs in your code using NetBeans
    • Right click on your project name present on left Pane of Netbeans (Under which you have your .java files etc.
    • Select Properties, in the Project Properties Frame select Libraries on left pane
    • Click on Add Jar/Folder and select the above 2 JAR files
    • You are done with importing API in your project




  • Now Comes the code section, well to make it easy for you all. I have tried my level best to make the code short for you :) 
    • So, to play a Mp3 file you have to do 2 line coding
      • 1st Line -> PlayMp3 pm = new PlayMp3();     // Create PlayMp3 Object 
      • 2nd Line -> pm.playSong("D:\\Music\\Songs\\English Songs\\Lucky.mp3");   //call playSong(String son) method. NOTE: this methods take song's path as argument.
      • Optional Line -> pm.stopSong(); //to stop the song any time the user want 
    • Let me provide you a code with GUI that will make more clear about this API 



  • Congratulations, you developed your own Mp3 Player. Enjoy and Listen to your favorite Songs. :)


Thats it for this post


Take Care


Peace



For Any Query mail me: ravjot.singh.28@gmail.com