Skip to contentSkip to conversation

Audio cd's in guest OS

Qemu-devel Lars Roland 6 participants 9 messages Nov 4, 2005 – Nov 7, 2005

lore
Share & tools
lore
#0 lore raw

Hi all

Is it somehow possible to pass a audio cd from a host running Linux to the guest OS ? -

I am basiclly trying to rip a cd using itunes inside my guest OS (Windows XP) but as audio cd's does not has a traditional filesystem on them you cannot mount them in Linux (host OS). The: -cdrom predicate in Qemu 0.7.2 only works if the block device contains a mounted filesystem so I am unable to see how I can pass on an audio cd.

Regards.

Lars Roland

#1 lore raw

I've found on systems where traditional rippers don't work (eg, cdparanoia), CDFS has a greater chance of ripping the CDs (by default into WAV, but you can enable an option to rip it in the pure CDDA format if you want). It requires patching the Linux source, so if you aren't experienced with compiling your own kernel, then it might not be the best option.

http://www.elis.rug.ac.be/~ronsse/cdfs/

If you get it to work, then you may use LAME, oggenc, FLAC, or whatever to encode the audio tracks into your favorite format (mp3, Ogg Vorbis, and FLAC in my examples).

Quoted 15 lines · Lars Roland

Hi all

Is it somehow possible to pass a audio cd from a host running Linux to the guest OS ? -

I am basiclly trying to rip a cd using itunes inside my guest OS (Windows XP) but as audio cd's does not has a traditional filesystem on them you cannot mount them in Linux (host OS). The: -cdrom predicate in Qemu 0.7.2 only works if the block device contains a mounted filesystem so I am unable to see how I can pass on an audio cd.

Regards.

Quoted 8 lines

Lars Roland

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

--
Mike

#2 lore raw
Quoted 4 lines · Mike Swanson

I've found on systems where traditional rippers don't work (eg, cdparanoia), CDFS has a greater chance of ripping the CDs (by default into WAV, but you can enable an option to rip it in the pure CDDA format if you want).

Thanks - I should have known that someone had made a file system for this. However I still think it would be great to be able to pass the actual /dev/cdrom on to the guest OS, but I must admit that I have not grasped the complexity yet on doing this, so I am going to do some Qemu code reading before continuing - I am not even sure if it can be done in VMWare although I seam to remember that Windows as a host OS running VMWare allows the guest access to a audio cdrom.

Regards

Lars Roland

#3 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 8 lines · Lars Roland
Quoted 4 lines · Mike Swanson

I've found on systems where traditional rippers don't work (eg, cdparanoia), CDFS has a greater chance of ripping the CDs (by default into WAV, but you can enable an option to rip it in the pure CDDA format if you want).

Quoted 8 lines

Thanks - I should have known that someone had made a file system for this. However I still think it would be great to be able to pass the actual /dev/cdrom on to the guest OS, but I must admit that I have not grasped the complexity yet on doing this, so I am going to do some Qemu code reading before continuing - I am not even sure if it can be done in VMWare although I seam to remember that Windows as a host OS running VMWare allows the guest access to a audio cdrom.

Not sure how VMware does that; but actually I didn't even succeed accessing /dev/cdrom on the host when an audio cd is inserted:

dd if=/dev/hdc of=/dev/null bs=2352 count=1
dd: reading `/dev/hdc': Input/output error 0+0 records in
0+0 records out
0 bytes transferred in 0.077570 seconds (0 bytes/sec)

I used a blocksize of 2352 because I've read that's the size for audio cds... It didn't work with bs=1 either.

So maybe Qemu would have to access the cd drive on a lower level than via /dev/cdrom?

Just my 2 cents,
Oliver Gerlich
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDbJjvTFOM6DcNJ6cRAvMxAKChRu5Hs2CMtRcKdygnbKwBl5GoigCeL7XM XLYxM01N6If3A+9hCbF5wUQ=
=edig
-----END PGP SIGNATURE-----

#4 lore raw
Quoted 9 lines · Oliver Gerlich
Quoted 8 lines

Thanks - I should have known that someone had made a file system for this. However I still think it would be great to be able to pass the actual /dev/cdrom on to the guest OS, but I must admit that I have not grasped the complexity yet on doing this, so I am going to do some Qemu code reading before continuing - I am not even sure if it can be done in VMWare although I seam to remember that Windows as a host OS running VMWare allows the guest access to a audio cdrom.

That is interesting. I wonder how they did it.

Quoted 12 lines

Not sure how VMware does that; but actually I didn't even succeed accessing /dev/cdrom on the host when an audio cd is inserted:

dd if=/dev/hdc of=/dev/null bs=2352 count=1
dd: reading `/dev/hdc': Input/output error 0+0 records in
0+0 records out
0 bytes transferred in 0.077570 seconds (0 bytes/sec)

I used a blocksize of 2352 because I've read that's the size for audio cds... It didn't work with bs=1 either.

It is the sector size. But audio cds are stored in a different format than digital cds (the ones that contain filesystems on them such as ISO9660). It is even possible to have both formats on a single cd-rom (so it works to hold music for an audio cd player as well as music videos that can be played on a computer).

dd only supports accessing the digital side of things. I don't recall how hard it is to access raw audio, but I wouldn't be suprised if one needed low level controller commands (like it's needed to burn cd-r(w)s or dvd-r(w)s).

Quoted 3 lines

So maybe Qemu would have to access the cd drive on a lower level than via /dev/cdrom?

Yes.

A quick&easy hack might be to have an -audio-cdrom option, that takes a directory full of *.wav's and generates an emulated audio cd for the guest. (Might have to make it a monitor option as well, to allow swapping of audio and digital cdroms).

Then to use real audio cdroms from the host, just mount them via CDFS.

May not be worth the effort.

Quoted 2 lines

Just my 2 cents,
Oliver Gerlich

Signature · 2 lines
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.
#5 lore raw
In reply to Oliver Gerlich
Quoted 24 lines · Oliver Gerlich

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 8 lines · Lars Roland
Quoted 4 lines · Mike Swanson

I've found on systems where traditional rippers don't work (eg, cdparanoia), CDFS has a greater chance of ripping the CDs (by default into WAV, but you can enable an option to rip it in the pure CDDA format if you want).

Quoted 8 lines

Thanks - I should have known that someone had made a file system for this. However I still think it would be great to be able to pass the actual /dev/cdrom on to the guest OS, but I must admit that I have not grasped the complexity yet on doing this, so I am going to do some Qemu code reading before continuing - I am not even sure if it can be done in VMWare although I seam to remember that Windows as a host OS running VMWare allows the guest access to a audio cdrom.

Not sure how VMware does that; but actually I didn't even succeed accessing /dev/cdrom on the host when an audio cd is inserted:

Quoted 8 lines

dd if=/dev/hdc of=/dev/null bs=2352 count=1
dd: reading `/dev/hdc': Input/output error 0+0 records in
0+0 records out
0 bytes transferred in 0.077570 seconds (0 bytes/sec)

I used a blocksize of 2352 because I've read that's the size for audio cds... It didn't work with bs=1 either.

While the block size you gave is correct for cdda frames, you cannot read them this way. The commands you use for reading data from a data track varies, and the CDROM driver will always use the READ_10 command for io originating from the file system layer. You would also need to put some effort into the page cache to allow non-power-of-2 block sizes for this to work. So it's not trivial :-)

For reading audio tracks, you can use either some pass through command mechanism like CDROM_SEND_PACKET or SG_IO. Or the CDROMREADAUDIO ioctl, which is the easiest to use since it doesn't require an understanding of the command set.

Signature · 1 line
Jens Axboe
#6 lore raw
In reply to Lars Roland
Quoted 8 lines · Lars Roland
Quoted 4 lines · Mike Swanson

I've found on systems where traditional rippers don't work (eg, cdparanoia), CDFS has a greater chance of ripping the CDs (by default into WAV, but you can enable an option to rip it in the pure CDDA format if you want).

Quoted 7 lines

Thanks - I should have known that someone had made a file system for this. However I still think it would be great to be able to pass the actual /dev/cdrom on to the guest OS, but I must admit that I have not grasped the complexity yet on doing this, so I am going to do some Qemu code reading before continuing - I am not even sure if it can be done in VMWare although I seam to remember that Windows as a host OS running VMWare allows the guest access to a audio cdrom.

QEMU does not currently support reading raw CD tracks, but it is definitely possible to add it (along with play audio features and even CD recording).

Note that there is already an emulation for reading raw CD tracks because it is needed to boot Darwin on CDROM, but it only works on the data tracks of the CDROM.

Fabrice.

#7 lore raw
Quoted 17 lines · Fabrice Bellard
Quoted 8 lines · Lars Roland
Quoted 4 lines · Mike Swanson

I've found on systems where traditional rippers don't work (eg, cdparanoia), CDFS has a greater chance of ripping the CDs (by default into WAV, but you can enable an option to rip it in the pure CDDA format if you want).

Quoted 7 lines

Thanks - I should have known that someone had made a file system for this. However I still think it would be great to be able to pass the actual /dev/cdrom on to the guest OS, but I must admit that I have not grasped the complexity yet on doing this, so I am going to do some Qemu code reading before continuing - I am not even sure if it can be done in VMWare although I seam to remember that Windows as a host OS running VMWare allows the guest access to a audio cdrom.

Quoted 3 lines

QEMU does not currently support reading raw CD tracks, but it is definitely possible to add it (along with play audio features and even CD recording).

I actually implemented the commands needed for recording some months ago, but never really wrapped it up and submitted it. If there's any interesting in this, I'll dust it off when I have some spare time.

Signature · 1 line
Jens Axboe
#8 lore raw
Quoted 3 lines · Jens Axboe

I actually implemented the commands needed for recording some months ago, but never really wrapped it up and submitted it. If there's any interesting in this, I'll dust it off when I have some spare time.

Well I am interested and will happily spend some time checking the code.

Regards.

Lars Roland