LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Burn audio cd (https://www.linuxquestions.org/questions/linux-software-2/burn-audio-cd-257544/)

Ephracis 11-21-2004 07:51 AM

Burn audio cd
 
I have a dir with a few mp3-files that I want to burn to an audio-cd.

I tried to do something with cdrecord but I first got an error and then I tried to as the error said and use the -pad-option but then the cd just got "fsck"ed up (it's a joke, not fsck).

Code:

$ cdrecord dev=/dev/cdrom -audio file1.mp3 file2.mp3 [...] fileN.mp3
Cdrecord 2.00.3 (i686-pc-linux-gnu) Copyright (C) 1995-2002 Jörg Schilling
cdrecord: Cannot allocate memory. WARNING: Cannot do mlockall(2).
cdrecord: WARNING: This causes a high risk for buffer underruns.
cdrecord: Operation not permitted. WARNING: Cannot set RR-scheduler
cdrecord: Permission denied. WARNING: Cannot set priority using setpriority().
cdrecord: WARNING: This causes a high risk for buffer underruns.
scsidev: '/dev/cdrom'
devname: '/dev/cdrom'
scsibus: -2 target: -2 lun: -2
Warning: Open by 'devname' is unintentional and not supported.
Linux sg driver version: 3.5.27
Using libscg version 'schily-0.7'
Device type    : Removable CD-ROM
Version        : 0
Response Format: 1
Vendor_info    : 'SAMSUNG '
Identifikation : 'CD-R/RW SW-224B '
Revision      : 'R201'
Device seems to be: Generic mmc CD-RW.
Using generic SCSI-3/mmc CD-R driver (mmc_cdr).
Driver flags  : MMC-2 SWABAUDIO BURNFREE
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
cdrecord: Bad audio track size 5720407 for track 01.
cdrecord: Audio tracks must be at least 705600 bytes and a multiple of 2352.
cdrecord: See -pad option.

Then with the -pad
Code:

$ cdrecord dev=/dev/cdrom -audio -pad file1.mp3 file2.mp3 [...] fileN.mp3
Cdrecord 2.00.3 (i686-pc-linux-gnu) Copyright (C) 1995-2002 Jörg Schilling
cdrecord: Cannot allocate memory. WARNING: Cannot do mlockall(2).
cdrecord: WARNING: This causes a high risk for buffer underruns.
cdrecord: Operation not permitted. WARNING: Cannot set RR-scheduler
cdrecord: Permission denied. WARNING: Cannot set priority using setpriority().
cdrecord: WARNING: This causes a high risk for buffer underruns.
scsidev: '/dev/cdrom'
devname: '/dev/cdrom'
scsibus: -2 target: -2 lun: -2
Warning: Open by 'devname' is unintentional and not supported.
Linux sg driver version: 3.5.27
Using libscg version 'schily-0.7'
Device type    : Removable CD-ROM
Version        : 0
Response Format: 1
Vendor_info    : 'SAMSUNG '
Identifikation : 'CD-R/RW SW-224B '
Revision      : 'R201'
Device seems to be: Generic mmc CD-RW.
Using generic SCSI-3/mmc CD-R driver (mmc_cdr).
Driver flags  : MMC-2 SWABAUDIO BURNFREE
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
cdrecord: Operation not permitted. WARNING: Cannot set RR-scheduler
cdrecord: Permission denied. WARNING: Cannot set priority using setpriority().
cdrecord: WARNING: This causes a high risk for buffer underruns.
Starting to write CD/DVD at speed 24 in real TAO mode for single session.
Last chance to quit, starting real write    0 seconds. Operation starts.
Turning BURN-Free off

WARNING: padding up to secsize.
Track 01: Total bytes read/written: 5720407/5722416 (2433 sectors).

WARNING: padding up to secsize.
Track 02: Total bytes read/written: 4660163/4661664 (1982 sectors).

WARNING: padding up to secsize.
Track 03: Total bytes read/written: 4049828/4050144 (1722 sectors).

WARNING: padding up to secsize.
Track 04: Total bytes read/written: 6453248/6453888 (2744 sectors).

WARNING: padding up to secsize.
Track 05: Total bytes read/written: 22055249/22057056 (9378 sectors).

WARNING: padding up to secsize.
Track 06: Total bytes read/written: 4225986/4226544 (1797 sectors).

WARNING: padding up to secsize.
Track 07: Total bytes read/written: 3578984/3579744 (1522 sectors).

How shall I do?

J_Szucs 11-21-2004 05:37 PM

Do you mean you want to create an audio CD with each track containing an mp3 file?

The good news: you can burn such a CD, just the way as you did it using the -pad option.

And now the bad news: no player will play those tracks, since standard audio CD tracks should contain raw PCM data, and not mp3 :-(.

So, either you write those mp3s onto a data CD, or you extract them into raw PCM, and burn an audio CD.

Ephracis 11-22-2004 06:44 AM

Yeah I thought that the type may be the problem. But then my question is: how can I convert from mp3 to whatever you told me to use (I have read about so many types so I can't remember them all, wav, cdda, etc. So many terms. :P).

How shall I burn when I have the correct type that can be played in a standard cd-player?

J_Szucs 11-22-2004 09:11 AM

You have to do four things:

1.) Decode the mp3 files to wav:
lame --decode fileN.mp3 fileN.wav

2.) Resample the wav files to 44.1kHz bitrate
sox fileN.wav -r 44100 fileN-new.wav resample

3.) Normalize the volume
normalize -m *new.wav

4.) Burn the files onto a CD; you already know how to do it:
cdrecord dev=/dev/cdrom -audio -pad file1-new.wav file2-new.wav [...] fileN-new.wav

The above should work, though I never did it myself; these are all the result of some google searching I did.

J_Szucs 11-22-2004 07:36 PM

OK, here is a little script of mine that is supposed to automatize audio CD creation using lame, sox, normalize and cdrecord:
Code:

if [ -z "$1" ] ; then
  echo "Missing parameter: Location (directory) of album"
  exit
fi
if [ ! -d "$1" ] ; then
  echo "Error: album location $1 does not exist"
  exit
fi
# Decoding mp3s and resampling them
for file in `find $1 -name "*.mp3"` ; do
  echo "Decoding $1 to $1.wav:"
  lame --decode "$file" "$file.wav"
  echo "Resampling $file.wav to $file-new.wav"
  sox "$file.wav" -r 44100 "$file-new.wav resample
  rm "$file.wav"
done
# Normalizing volume
normalize -m "$1/*-new.wav"
echo "The files should be ready to burning onto CD now:"
ls -l "$1"
echo "Do you want to burn them now?"
read choice
case choice in
[Yy]) cdrecord dev=/dev/cdrom -audio -pad `find $1 -name "*-new.wav"` ;;
*) exit ;;
esac
echo "End"

The script should be used as follows:
/path/to/script /path/to/album

If you find that the script could be handy, then feel free to debug it, as I wrote it in 5 minutes and I never tested it.
Also it might need some addition to handle spaces and special characters in filenames, which could cause some trouble in the present state of the script.
A last note: the linuxquestions.org forum software always replaces the double "[" and "]" characters in the if constructs of my codes, so you must possibly correct the if construct syntax you find in my post.

Cheers

Edit:
This time the linuxquestions.org forum software totally ruined my code, so I had to replace double "[" and "]" characters by single ones just to make the script readable here. So, please double those characters in the if constructs before using the code.


All times are GMT -5. The time now is 06:19 PM.