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

J

jim shirreffs

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.
 
R

Roedy Green

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.
 
J

jim shirreffs

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.
 
R

Roedy Green

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.
 
J

jim shirreffs

Roedy Green said:
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.

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
 
B

Boudewijn Dijkstra

jim shirreffs said:
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.

Who said you should use VC++?
 
O

Oliver Wong

jim shirreffs said:
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++?

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
 
B

Ben_

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.
 
B

Ben_

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...
 
J

jim shirreffs

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
 
J

jim shirreffs

Tons of good stuff and code there, I will have to install ASPI to use it but
that was a good tip.

jim
 
T

Tom the Canuck

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.
 
B

Ben_

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.
"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top