Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / November 2005

Tip: Looking for answers? Try searching our database.

Read the contents of an audio CD, HELP! PLEASE!

Thread view: 
jim shirreffs - 23 Nov 2005 18:14 GMT
Hello, I am trying to put together a Java system for playing audio CDs on a
large CD player, I have most of it working But entering all the data like
Artist, Title, track name, track length (seconds) is a real pain in the
butt. What I would like to do is write a java class that would extrack that
info from an audio CD placed in the computers CDROM drive. I have looked and
looked and looked and looked, but I can not find any exambles of how to read
an audio CD. I have found some C++ stuff but reducing  the MSVC++ code to a
callable JNI API is also kicking my butt. I could do it with C code but I
can find any C code (Windows) either.

Does anyone have simple/reuseable code they are willing to share that can
just reads the contents of an audio CD? Or can anyone tell me how to do it?

In either Java or C or readable C++?

thanks in advance

jim s.
Roedy Green - 23 Nov 2005 18:26 GMT
> What I would like to do is write a java class that would extrack that
>info from an audio CD placed in the computers CDROM drive.

There are also databases of that information. IIRC Roxio CD Creator
will access one of them to find that info for a track where it is
missing from the original CD.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

jim shirreffs - 23 Nov 2005 18:33 GMT
Yes I have read alittle bit about them, I should investigate them a bit
more. But I know it is posible to just get the info from the CD, it is
maddening that thus far I can find any readable code to do it.

thanks for a good suggestion, that will be what I will do if I can't get any
help here.

jim s.

>> What I would like to do is write a java class that would extrack that
>>info from an audio CD placed in the computers CDROM drive.
>
> There are also databases of that information. IIRC Roxio CD Creator
> will access one of them to find that info for a track where it is
> missing from the original CD.
Monique Y. Mudama - 23 Nov 2005 20:41 GMT
[trimming all the other groups]

> Yes I have read alittle bit about them, I should investigate them a
> bit more. But I know it is posible to just get the info from the CD,
> it is maddening that thus far I can find any readable code to do it.

Why do you know this?  I've never seen a CD ripping tool that can do
that.

Signature

monique

Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html

jim shirreffs - 24 Nov 2005 20:14 GMT
> [trimming all the other groups]
>
[quoted text clipped - 4 lines]
> Why do you know this?  I've never seen a CD ripping tool that can do
> that.

Because just about every CD playing program that I have looked at will tell
me how many track are on the CD, the track name and the track playing time.
Some will tell song title too. That is all I am after. I am not burning CDs,
I am putting together a system for playing CDs, I have all that done, but I
need to automatic as much as possible the procedure for adding a new CD to
the CD play system.

jim s
Monique Y. Mudama - 25 Nov 2005 20:34 GMT
>> [trimming all the other groups]
>>
[quoted text clipped - 12 lines]
> playing CDs, I have all that done, but I need to automatic as much
> as possible the procedure for adding a new CD to the CD play system.

I'm pretty sure that the programs that do this all support going out
to some server to grab the info.  But I could be wrong.

Signature

monique

Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html

Gordon Beaton - 28 Nov 2005 07:31 GMT
> Because just about every CD playing program that I have looked at will tell
> me how many track are on the CD, the track name and the track playing time.
> Some will tell song title too. That is all I am after. I am not burning CDs,
> I am putting together a system for playing CDs, I have all that done, but I
> need to automatic as much as possible the procedure for adding a new CD to
> the CD play system.

You need to calculate a checksum from information about the number and
lengths of the tracks on the CD. You can use the checksum to look up
artist names, titles etc from a database such as Freedb (CDDB was
previously popular but has changed its name to Gracenote and become a
pay service).

Some information here (especially under "technical" and "external links":
http://en.wikipedia.org/wiki/CDDB

How to read the necessary info and calculate the disc ID:
http://freedb.org/modules.php?name=Sections&sop=viewarticle&artid=6

You can find example code on freshmeat or sourceforge, search for
"cddb checksum" or "cddb disc id" or similar.

/gordon

Signature

[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e

Roedy Green - 23 Nov 2005 18:41 GMT
>Does anyone have simple/reuseable code they are willing to share that can
>just reads the contents of an audio CD? Or can anyone tell me how to do it?
>
>In either Java or C or readable C++?

IF you google java audio cd metadata you will get a ton of utilities
that can read the metadata, though I found none in Java.  I suspect
this means your best route is to write the metadata grabber in C++
using some Windows library and a JNI hook.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

jim shirreffs - 23 Nov 2005 19:27 GMT
>>Does anyone have simple/reuseable code they are willing to share that can
>>just reads the contents of an audio CD? Or can anyone tell me how to do
[quoted text clipped - 6 lines]
> this means your best route is to write the metadata grabber in C++
> using some Windows library and a JNI hook.

Yea, that what I think too C++ with JNI, but finding VC++ (version 6) code
that I can understand is not an easy thing to do. I am not a C++ guy, C I
love but VC++ is a nightmare.

jim
Boudewijn Dijkstra - 23 Nov 2005 19:37 GMT
>>>Does anyone have simple/reuseable code they are willing to share that can
>>>just reads the contents of an audio CD? Or can anyone tell me how to do it?
[quoted text clipped - 9 lines]
> that I can understand is not an easy thing to do. I am not a C++ guy, C I
> love but VC++ is a nightmare.

Who said you should use VC++?
jim shirreffs - 23 Nov 2005 20:21 GMT
>>>>Does anyone have simple/reuseable code they are willing to share that
>>>>can
[quoted text clipped - 13 lines]
>
> Who said you should use VC++?

My C compiler is VC++ version 6.
Boudewijn Dijkstra - 23 Nov 2005 23:32 GMT
>>>>>Does anyone have simple/reuseable code they are willing to share that can
>>>>>just reads the contents of an audio CD? Or can anyone tell me how to do
[quoted text clipped - 14 lines]
>
> My C compiler is VC++ version 6.

That doesn't answer the question.
Roedy Green - 24 Nov 2005 00:19 GMT
On Thu, 24 Nov 2005 00:32:08 +0100, "Boudewijn Dijkstra"
<usenet@bdijkstra.tmfweb.nl> wrote, quoted or indirectly quoted
someone who said :

>That doesn't answer the question.

for most people buying a new compiler is a major expense.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Matt Parker - 24 Nov 2005 18:41 GMT
> On Thu, 24 Nov 2005 00:32:08 +0100, "Boudewijn Dijkstra"
> <usenet@bdijkstra.tmfweb.nl> wrote, quoted or indirectly quoted
[quoted text clipped - 3 lines]
>
> for most people buying a new compiler is a major expense.

The Microsoft command line compiler is free -
http://msdn.microsoft.com/visualc/vctoolkit2003/ - you only pay if you want
the IDE.

GCC is also free and Free.

Matt
Ben_ - 23 Nov 2005 21:11 GMT
> IF you google java audio cd metadata you will get a ton of utilities
> that can read the metadata, though I found none in Java.

Here is one:
"
Features of FreeMP3 Player:
(...)
- integrated CD audio metadata lookup
(...)

FreeMP3 Player is free software based on Zinf's excellent open source code
player (formerly Free*MP), released under the GPL. Download the latest
source code for FreeMP3 Player: FreeMP3Player-src.zip
"
http://www.freewirep2p.com/player.html

HTH.
Ben_ - 23 Nov 2005 21:16 GMT
Oops, my bad, it's C/C++...
Ben_ - 23 Nov 2005 21:36 GMT
Commercial one:
"
CD-Text Reader (via JNI)
US$: 79.90
http://cdtextreader.miik.com.ua/features.html
The trial version is fully functional and can be evaluated for unlimited
time. The only difference between trial and full versions is that the trial
version will display an about box each time the CD-Text Reader is
initialized.
"

If you can live with the nag...
jim shirreffs - 24 Nov 2005 21:20 GMT
Thanks I think that might do the trick. I  will have to see if I can isolate
the section of code that does the CD io but it looks promising.

jim s

>> IF you google java audio cd metadata you will get a ton of utilities
>> that can read the metadata, though I found none in Java.
[quoted text clipped - 13 lines]
>
> HTH.
Oliver Wong - 23 Nov 2005 19:48 GMT
> Hello, I am trying to put together a Java system for playing audio CDs on
> a
[quoted text clipped - 16 lines]
>
> In either Java or C or readable C++?

   I can only give you high-level hints which might help you come up with
better Google queries to find sample code.

   I can think of two places where this data is stored off the top of my
head. Some CDs have a "CD TEXT" meta data encoded on them which will include
the artist name, the album name, and track list. Some CD TEXT also contains
an album cover picture. The CD TEXT does not contain track length, AFAIK, as
that info can be determined from the TOC.

   If the CD doesn't have CD TEXT metadata encoded on them, then you'll
have to rely on a centralized database. Different DBs have different APIs,
so you'll probably want to choose one, go to their site, and read the
documentation they have. One such site is http://www.freedb.org/

   The idea is to uniquely identify the CD, send the id to the DB, and the
DB will return all the data it has (including artist name, album name, track
names and track lengths). Unfortunately, the id does NOT uniquely identify a
CD, so occasionally a DB will send back multiple results. It's a design
choice you have to make as to what to do in that scenario (pick the first
one? let the user pick one? etc.)

   - Oliver
jim shirreffs - 24 Nov 2005 21:27 GMT
Tons of good stuff and code there, I will have to install ASPI to use it but
that was a good tip.

jim

>> Hello, I am trying to put together a Java system for playing audio CDs on
>> a
[quoted text clipped - 39 lines]
>
>    - Oliver
Michael Dunn - 24 Nov 2005 09:28 GMT
> Hello, I am trying to put together a Java system for playing audio CDs on a
> large CD player, I have most of it working But entering all the data like
[quoted text clipped - 8 lines]
> Does anyone have simple/reuseable code they are willing to share that can just reads the contents
> of an audio CD? Or can anyone tell me how to do it?

Just for a laugh (obviously windows only)

(in case the lines wrap in the try block, line numbers added at the end)

class CD_Info
{
 public CD_Info()
 {
   java.io.PrintWriter writeOut = null;
   try
   {
     java.io.File file = new java.io.File("CD_Info.vbs");//1
     writeOut = new java.io.PrintWriter(new java.io.BufferedWriter(new
java.io.FileWriter(file)));//2
     //writeOut.println("mp3file = \"C:\\Test.mp3\"");//3 - testing c drive
     writeOut.println("mp3file = \"D:\\0101-OrderOfThePhoenix.mp3\"");//4
     writeOut.println("Set winMedia = CreateObject(\"WMPlayer.OCX\")");//5
     writeOut.println("Set cdInfo = winMedia.newMedia(mp3file)");//6
     writeOut.println("msgbox \"Artist = \" & cdInfo.getIteminfo(\"Artist\") & vbnewline & _");//7
     writeOut.println("\"Title = \" & cdInfo.getIteminfo(\"Title\")");//8
     writeOut.println("Set winMedia = Nothing");//9
     writeOut.println("Set cdInfo = Nothing");//10
     writeOut.close();//11
     Runtime.getRuntime().exec("WScript.exe CD_Info.vbs");//12
     Thread.sleep(5000);//13
     file.deleteOnExit();//14
   }
   catch(Exception e){e.printStackTrace();}
 }
 public static void main(String[] args){new CD_Info();}
}
Tom the Canuck - 26 Nov 2005 18:58 GMT
I do not think that info is on the CD itself.
Stick an audio CD into your PC and just
see. You get TRACK 1, TRACK2, . . .
I rip some of the CDs I buy using CDex (freeware)
to make MP3 files. I have to use CDDB in that app
to get the info you seem to want. Not all CDs are in
that database. Those, I have to enter by hand.
Good luck.

Tom the Canuck.

> Hello, I am trying to put together a Java system for playing audio CDs on a
> large CD player, I have most of it working But entering all the data like
[quoted text clipped - 14 lines]
>
> jim s.
Ben_ - 26 Nov 2005 20:31 GMT
http://en.wikipedia.org/wiki/CD-TEXT

"
CD-TEXT is a extension of the standard "Red Book" Compact Disc
specification, which allows track and album titles to be stored directly on
the disk. The specification was released in September 1996, and backed by
Sony. Support for CD Text is common, but not universal. Utilities exist to
automatically rip CD-TEXT data, and insert it into CDDB or FreeDB.
"


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.