0

On a Linux system, I am intending to convert some audio files (mp3) and write them to an audio CD. Instead of directly writing to an optical disk, I would prefer to somehow redirect the output to an image file which can be burned later.

Specifically, I attempted the following steps:

  1. create a file to be written to (700 MiB, 777 permissions)

    dd if=/dev/zero of=./cd.img bs=$((1024 * 1024)) count=700
    
  2. attach file to loop device (/dev/loop0, as root)

    losetup --sizelimit 700MiB /dev/loop0 ./cd.img
    
  3. use mp3cd software to convert, normalize ... and ultimately write audio files to audio CD (as root)

    mp3cd --verbose --driver generic-mmc-raw --device /dev/loop0 ./audio/{01..03}.mp3
    

mp3cd fails on its last step, "burn". The file /tmp/mp3cd-root/tool-output.txt contains a hint that an SCSI command inquiry on /dev/loop0 failed. Most likely, I am missing some options in the losetup command.

In addition to achieving the image creation in this particular case of an audio cd, I would be thankful for some pointers on how images for data CDs/DVDs could be prepared in a similar way.

1 Answer 1

0

Have you tried passing the option -n to mp3cd?

On the man page http://outflux.net/unix/software/mp3cd/mp3cd.html :

-n, --simulate Don't actually burn a disc but do everything else.

7
  • That yields exit code 25, with the following output: 'cdrdao read-test --device /dev/loop0 cdda.toc >>tool-output.txt 2>&1' 'Checking for CDR...' 'cdrdao disk-info --device /dev/loop0' 'CDR not loaded?!'
    – itqa
    Apr 1, 2015 at 15:17
  • forgot to mention: during simulation, all steps before the loop device access are completed without trouble.
    – itqa
    Apr 1, 2015 at 15:24
  • What appears it mp3cd uses cdrdao to write to CD and it is using some commands that are specific to CD, and losetup don't support it, I think. I used some time ago the k3b to make iso so it may resolve your issue. Downsides, isn't a text application and need a lot of stuff from kde ...
    – Nine
    Apr 1, 2015 at 15:24
  • exactly. mp3cd can be instructed to do every preparatory step except the burning itself, so normalized wav files and a toc file, the basis for audio cd creation, are generated. If another commandline tool could be used for the actual image creation, the problem at hand would be solved. Nonetheless, i'd like to understand how an optical drive could be emulated in general.
    – itqa
    Apr 1, 2015 at 15:32
  • I don't know if the files have any order or something special in the way they are treated, but you can use mkisofs to generate an iso of the files generated and cdrecord to save it to a cd linux.die.net/man/8/mkisofs Normally cd emulation is mounting iso disks or similars to be accessible, simulate the hardware version don't know if is possible. Exist a cdemu utility but never used.
    – Nine
    Apr 1, 2015 at 16:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .