LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-11-2009, 03:06 AM   #1
thilaga
LQ Newbie
 
Registered: Apr 2009
Posts: 9

Rep: Reputation: 0
accessing track info from audio CD


Hi,

I am trying to play audio from the audio CD.
For this, I have understood that the audio CD contains only "*.cda" files which is nothing but "compact Disk audio". These are the pointers to the tracks in the CD. These track info are stored in the format of TOC's in the CD.

I would like to know how do I access the TOC's of an audio CD.

Thanks in advance.

Best Regards,
Thilaga
 
Old 04-11-2009, 03:25 AM   #2
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
It really doesn't contain "files", at least not as we know them. It doesn't have a proper file system (first requisite to be able to hold files). But, as with everything, it all depends on your definition of file system and "file". Windows users do see .cda files because it's just the way that Windows has to show us what's inside the disk. If you open the same disk in kde, let's say, it will show you many folders, that will contain .mp3 and .ogg files. Of course, the cdadio hasn't anything like that into it. But kde let's you see the tracks as that, and ripping a cd is as easy as dropping this virtual non-existant files from the cd to your hd.

But, to answer your question, the info you want to read is called cd-text. Not all the cds have it. And most audio extraction tools and players should be able to read it. cdda2wav comes to my mind, but most GUI players/rippers should read it ok. If you need something more specific just ask.
 
Old 04-11-2009, 04:50 AM   #3
thilaga
LQ Newbie
 
Registered: Apr 2009
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks for your reply.

I understood now.

1. How do the default players of Linux plays the audio CD and it displays the track info. For eg: if the CD contains 15 tracks, then the player says 15 tracks and displays the song duration for each track.

2. Is there a possibility to read TOC's from audio CD without CD-Text in linux.

3. I am able to open the contents of the audio CD as a hex file in linux. I am not sure about the format of the audio CD. Like nth byte to (n+10) corresponds to TOC of audio CD and the remaining are uncompressed raw audio data. If the format of the audio CD is known, might be I can retrieve the track info according to the format.

Thanks in advance.

Regards,
Thilaga
 
Old 04-11-2009, 06:17 AM   #4
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by thilaga View Post
Thanks for your reply.

I understood now.

1. How do the default players of Linux plays the audio CD and it displays the track info. For eg: if the CD contains 15 tracks, then the player says 15 tracks and displays the song duration for each track.
I am a bit over my head here, because I simply never looked too deep into multimedia stuff. It's really not my field. However I think that the ToC for audiocds contain at least the following data:
  • the total lenght
  • number of tracks
  • offset for each track

With this info you can compute the duration for each track. I have no idea what API would I use in, let's say, C language to work with cdaudio. Never needed that. But it shouldn't be hard to figure if that's what you seek here.

Quote:
2. Is there a possibility to read TOC's from audio CD without CD-Text in linux.
Yes, sure. In command line I'd use cdparanoia like this:

Code:
$ cdparanoia -d /dev/sr0 -Q
cdparanoia III release 10.2 (September 11, 2008)


Table of contents (audio tracks only):
track        length               begin        copy pre ch
===========================================================
  1.    61580 [13:41.05]        0 [00:00.00]    no   no  2
  2.    47160 [10:28.60]    61580 [13:41.05]    no   no  2
  3.    20465 [04:32.65]   108740 [24:09.65]    no   no  2
  4.    53865 [11:58.15]   129205 [28:42.55]    no   no  2
  5.    22335 [04:57.60]   183070 [40:40.70]    no   no  2
  6.    25525 [05:40.25]   205405 [45:38.55]    no   no  2
TOTAL  230930 [51:19.05]    (audio only)
Just change /dev/sr0 by whatever your cdrom reader device node is.

Quote:
3. I am able to open the contents of the audio CD as a hex file in linux. I am not sure about the format of the audio CD. Like nth byte to (n+10) corresponds to TOC of audio CD and the remaining are uncompressed raw audio data. If the format of the audio CD is known, might be I can retrieve the track info according to the format.
I don't know much about this. All I think I know is that each session needs a proper ToC, and each one takes around 14 mb or so. The audio is recorded as raw pcm, 16 bits, stereo, 44khz and -important- as little endian.

I guess that the whole format is specified in detail in the red book, however if I am not mistaken sony holds the rights over that and won't probably give a copy away for free.

Probably someone else around can give a better insight on this.
 
Old 04-13-2009, 07:10 AM   #5
thilaga
LQ Newbie
 
Registered: Apr 2009
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks for your reply.

Simple DirectMedia Layer (SDL) (i.e.) libSDL is available which is nothing but the cross-platform multimedia library designed to provide low level access to audio, CD Rom audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.

Documentation is there about how to access SDL API's.

I am using this currently.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to track which process is accessing disk? mldqj Linux - Kernel 6 02-12-2009 07:20 AM
M-Audio Fast Track Pro only accepts one audio connection at a time BorgAssimilator Linux - Hardware 0 09-29-2008 03:04 AM
Gnomebaker not writing track info saravkrish Linux - Software 1 02-11-2007 10:18 PM
mplayer getting track info nutthick Linux - Software 5 08-11-2006 03:50 AM
Possible to store track/title info when converting from MP3 to CD Audio? JBailey742 Linux - Software 3 05-03-2006 06:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration