Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Documentation, Tips & Tricks
  • Search

Burning Audio CDs - Another Way

Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Post Reply
Advanced search
32 posts
  • 1
  • 2
  • Next
Author
Message
wolvenwraith
n00b
n00b
Posts: 67
Joined: Sun Dec 28, 2003 1:17 pm
Location: Someplace, Somewhere

Burning Audio CDs - Another Way

  • Quote

Post by wolvenwraith » Mon Dec 29, 2003 5:45 am

I found that I needed to burn albums of mp3's many times, and I hated all the GUIs out there that do it (poor ATAPI support, bad layout, etc. etc.). I am also a big fan of the powerful Linux CLI. So I hacked something up in order to solve these problems. All you need to do is put all your mp3's into one directory and run this script (I called it mp3burn and copied it into /usr/bin so I can run it anytime, it's nice to have).

Code: Select all

#!/bin/bash
 
for i in *.[Mm][Pp]3; do mv "$i" `echo $i | tr ' ' '_'`; done
for i in *.[Mm][Pp]3; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done
for i in *.mp3; do lame --decode $i `basename $i .mp3`.wav; done
normalize *.wav
cdrecord dev=ATAPI:0,0,0 speed=44 -pad -audio -v -gracetime=2 *.wav
rm *.wav
Note that the cdrecord line may need to be modified in order to accomadate your burner (notably the dev=, and speed= lines) and gracetime can be modified as you see it as well.

Don't forget to run chmod a+x on the file so that it is executable!

Notes: Just improved it a little bit, it now normalizes (emerge normalize) the .wav files and removes them after they're burnt. Also fixed the [Mm][Pp] thing in the first line. This little script should be pretty easy to alter if it doesn't fit you perfectly. Keep in mind too, this will change the names of you mp3's if they have spaces or caps in them.
Last edited by wolvenwraith on Mon Dec 29, 2003 8:40 pm, edited 1 time in total.
Top
pem725
n00b
n00b
User avatar
Posts: 68
Joined: Thu Sep 26, 2002 5:42 am
Location: Tucson, AZ USA

  • Quote

Post by pem725 » Mon Dec 29, 2003 8:55 am

What do you do with the wav files after burning?

Also, you might find burncenter allows you a similar setup with a few more features. Nice work though.

Like you, I am a fan of the CLI and use abcde and burncenter as console apps - along with the usual straightforward calls to cdrecord.
Cheers,
Patrick

Do the community a favor and answer a few stranded messages. I'm off to answer one now...thanks to gentoo!
Top
d99ma
Tux's lil' helper
Tux's lil' helper
Posts: 148
Joined: Mon Jul 21, 2003 4:20 pm
Location: Lund, Sweden

  • Quote

Post by d99ma » Mon Dec 29, 2003 10:42 am

Perhaps you should check for [mM][pP] when removing spaces, normalize the wav files and remove them after burning. Then it would be perfect!

/Martin
Top
wolvenwraith
n00b
n00b
Posts: 67
Joined: Sun Dec 28, 2003 1:17 pm
Location: Someplace, Somewhere

  • Quote

Post by wolvenwraith » Mon Dec 29, 2003 8:48 pm

Thanks for the feedback. I checked out burncenter and it seems pretty cool. However, it doesn't seem to support ATAPI burning out of the box (I didn't play with it much so I could be wrong). The other thing is I sorta like the one-liner style of this script, but that's just me :). All in all though burncenter seemed pretty nice.

Thanks to both of you for the suggestions, I made all the necessary changes to the script.
Top
Elm0
Apprentice
Apprentice
Posts: 281
Joined: Sun Nov 24, 2002 6:37 pm
Location: UK

  • Quote

Post by Elm0 » Mon Dec 29, 2003 10:50 pm

Nice script, obviously going to be quicker than a GUI if you do this a lot, however well designed the GUI is. The beauty of linux I suppose, why be forced into one way when you can choose your path!
Top
Munck
n00b
n00b
Posts: 35
Joined: Thu Feb 06, 2003 9:04 pm
Location: Skive, Denmark

  • Quote

Post by Munck » Tue Dec 30, 2003 12:56 pm

Thanks for the script. I've been looking for some easy way to do this, but I've been too lazy to write a script myself :)
Why?
- because I can !
Top
pengo
n00b
n00b
Posts: 53
Joined: Fri Aug 22, 2003 10:59 pm

  • Quote

Post by pengo » Sat Jan 03, 2004 9:00 pm

Hello there! I'm new at this and have a fresh install of Gentoo. What would I need to emerge for this script to work?

Thanks for the contribution!
Top
MrNugget
Tux's lil' helper
Tux's lil' helper
Posts: 144
Joined: Sat Nov 15, 2003 12:40 pm
Location: Germany

  • Quote

Post by MrNugget » Sat Jan 03, 2004 9:13 pm

Just "emerge cdrtools" and you'll be able to use cdrecord.
Top
dr_strange
Guru
Guru
User avatar
Posts: 480
Joined: Tue Apr 16, 2002 7:19 pm
Location: Cambridge, UK

  • Quote

Post by dr_strange » Sat Jan 03, 2004 9:13 pm

emerge cdrtools lame
Top
BakaO
n00b
n00b
User avatar
Posts: 74
Joined: Sat Sep 27, 2003 11:35 am

  • Quote

Post by BakaO » Wed Jan 14, 2004 9:10 pm

Hello,

your script is veyr cool, but I have 2 questions :

1-Is the 'normalize' really neccesary ? (I think if the dB levels are not the same, it is normal, no ?)

2-How can we add cd-text support ? I think it is related with the .inf files but how can we auto-generate them (form id-tag) or other method.


Thanks for all !
Top
TechSmurf
n00b
n00b
User avatar
Posts: 29
Joined: Mon Aug 25, 2003 7:14 pm
Location: ON, Canada

Thanks

  • Quote

Post by TechSmurf » Thu Feb 19, 2004 1:16 pm

I would just like to say, Thanks. :)
This little file saved me alot of time and work.
Keep up the good work. :D

(it worked 'right out of the box' )
Top
TheEternalVortex
Apprentice
Apprentice
User avatar
Posts: 207
Joined: Tue Oct 15, 2002 6:38 am
Location: San Jose, CA
Contact:
Contact TheEternalVortex
Website

  • Quote

Post by TheEternalVortex » Thu Feb 19, 2004 8:53 pm

What's the point of renaming all the files?
-- Andy
Top
metalh34d
Tux's lil' helper
Tux's lil' helper
Posts: 126
Joined: Wed Feb 04, 2004 3:35 pm

  • Quote

Post by metalh34d » Tue Apr 27, 2004 5:29 pm

doesn't converting mp3 into a wav cause lower quality sound, or is this just the way all mp3 burning is done?
Top
icefox13
Tux's lil' helper
Tux's lil' helper
Posts: 78
Joined: Mon Apr 19, 2004 1:58 pm
Location: Munich, Germany
Contact:
Contact icefox13
Website

  • Quote

Post by icefox13 » Tue Apr 27, 2004 5:47 pm

metalh34d wrote:doesn't converting mp3 into a wav cause lower quality sound, or is this just the way all mp3 burning is done?
Every compressed audio file (mp3, ogg) has to be converted to wav if you make an audio-cd (not mp3-cd), because wav is the format the tracks are stored on the disc.
(But you sometimes can't see this when burning an audio-cd because the mp3s are decoded and recorded nearly simultaneously.)
Top
metalh34d
Tux's lil' helper
Tux's lil' helper
Posts: 126
Joined: Wed Feb 04, 2004 3:35 pm

  • Quote

Post by metalh34d » Tue Apr 27, 2004 9:52 pm

I tried using the script and it didn't work very well. It only burned 2 tracks in the folder I had set to burn to cd. Also it took a very long time and it will only play in my car. Then again I'm having problems with burned cds playing on my cdroms anyway. Any help? Please?
Top
MighMoS
Guru
Guru
User avatar
Posts: 416
Joined: Thu Apr 24, 2003 2:20 pm
Location: @ ~
Contact:
Contact MighMoS
Website

  • Quote

Post by MighMoS » Thu May 06, 2004 2:43 am

Could it be added to rename the files back to their originals? Or at least how would I create a script that would remove the underscores? (I have very little programming experience)
jabber: MighMoS@jabber.org

localhost # export HOME=`which heart`
Top
diegs
Tux's lil' helper
Tux's lil' helper
Posts: 79
Joined: Wed Aug 06, 2003 3:07 am
Location: nyc
Contact:
Contact diegs
Website

  • Quote

Post by diegs » Sat May 22, 2004 4:42 am

No renaming:

Code: Select all

  GNU nano 1.3.2           File: /home/diegs/music/burn.sh
                                                                                
#!/bin/bash
                                                                                
for i in *.[Mm][Pp]3; do lame --decode "$i" "`basename "$i" .mp3`.wav"; done
normalize *.wav
cdrecord dev=ATAPI:0,0,0 speed=24 -pad -audio -v -gracetime=0 *.wav
rm *.wav
knowledge = fv
Top
Spack
n00b
n00b
User avatar
Posts: 32
Joined: Sun Feb 02, 2003 3:46 am

  • Quote

Post by Spack » Sat May 29, 2004 10:45 pm

This will handle ogg vorbis files aswell:

Code: Select all

#!/bin/bash

for i in *.[Mm][Pp]3; do mv "$i" `echo $i | tr ' ' '_'`; done
for i in *.[Mm][Pp]3; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done
for i in *.[Oo][Gg][Gg]; do mv "$i" `echo $i | tr ' ' '_'`; done
for i in *.[Oo][Gg][Gg]; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done
for i in *.mp3; do lame --decode $i `basename $i .mp3`.wav; done
for i in *.ogg; do oggdec $i; done
normalize *.wav
cdrecord dev=ATAPI:0,0,0 speed=44 -pad -audio -v -gracetime=2 *.wav
rm *.wav
Gentoo 2004.4
Gnome 2.8
Athlon XP 1800+ 512MB DDR
Promise SATA
Top
fireboy1919
n00b
n00b
User avatar
Posts: 47
Joined: Tue May 28, 2002 10:14 am

You've got it backwards

  • Quote

Post by fireboy1919 » Thu Jul 08, 2004 2:19 am

metalh34d wrote:doesn't converting mp3 into a wav cause lower quality sound, or is this just the way all mp3 burning is done?
wav is an uncompressed, lossless temporal format - the analog of bmp files in graphics.

mp3, on the other hand, is a compressed, lossy format, and whenever you convert to it, you lose information. Even if you do not compress at all you'll degrade the signal some when you convert to mp3 because it converts it to discrete cosine space (similar to doing a discrete fourier transform), and there's some loss of signal just from converting to it and back. You always have to convert back because you we listen to audio in temporal, not frequency space. Might as well do it by converting it to wav first.

Most people cannot hear the artifacts caused by the conversion; most people can't even hear the artifacts caused by removing a chunk of the signal after this conversion.

The real thing that you have to worry about is lower sample rates, which can cause aliasing if you sample at lower than twice the frequency of the highest frequency in the signal. As long as that doesn't happen (and it's not likely if you keep the audio at CD quality - 48kHz), you probably won't have problems. Well...there are a few more possible problems, but they're a lot less likely.
Top
freebit50
n00b
n00b
User avatar
Posts: 56
Joined: Wed May 26, 2004 2:01 pm

  • Quote

Post by freebit50 » Sun Jul 11, 2004 3:39 am

I love this little script!!! I was going to install k3b, but it was going to install a bunch of junk that I didn't want to wait for. This script works great, however, I added a little bit to it so cdrecord doesn't get messed on on weird filenames. I also made it so that in the end all the original files are back with no filename modifications. I also added comments. My CS teachers at school are always whining about comments and stuff.


Gotta go for a cruise with the new cd I just burned!!! Laters....

Code: Select all

#!/bin/bash

#
# create backups so that we leave originals untouched
#
mkdir ./bak
cp *.mp3 ./bak

#
# get rid of of stuff in the filename that could fubar cdrecord
#
for i in *.[Mm][Pp]3; do mv "$i" `echo $i | tr ' ' '_'`; done
for i in *.[Mm][Pp]3; do mv "$i" `echo $i | tr -d '-'`; done
for i in *.[Mm][Pp]3; do mv "$i" `echo $i | tr -d '_'`; done
for i in *.[Mm][Pp]3; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done
for i in *.[Mm][Pp]3; do mv "$i" `echo $i | tr -d '('`; done
for i in *.[Mm][Pp]3; do mv "$i" `echo $i | tr -d ')'`; done
for i in *.[Mm][Pp]3; do mv "$i" `echo $i | tr -d '+'`; done
for i in *.[Mm][Pp]3; do mv "$i" `echo $i | tr -d "'"`; done
for i in *.[Mm][Pp]3; do mv "$i" `echo $i | tr -d '[0-9]'`; done
# oops, stripped the 3 from mp3....gotta add it back in
for i in *.[Mm][Pp]; do mv "$i" `basename $i .mp`.mp3; done

#
# decode mp3 to wav using lame
#
for i in *.mp3; do lame --decode $i `basename $i .mp3`.wav; done

#
# normalize is a tool for adjusting the volume of audio files 
# to a standard level.
#
normalize *.wav

#
# let us burn!!!
#
cdrecord dev=ATAPI:0,0,0 speed=16 -pad -audio -v -gracetime=2 *.wav

#
# get rid of temp files and restore originals
#
rm *.wav
rm *.mp3
mv ./bak/*.mp3 ./
rm -rf ./bak 

Top
AGM
Apprentice
Apprentice
Posts: 171
Joined: Sat Nov 02, 2002 5:24 pm
Contact:
Contact AGM
Website

  • Quote

Post by AGM » Sun Jul 11, 2004 8:38 am

You could also check out bashburn, that's what I use. It's very cool.
Top
MighMoS
Guru
Guru
User avatar
Posts: 416
Joined: Thu Apr 24, 2003 2:20 pm
Location: @ ~
Contact:
Contact MighMoS
Website

  • Quote

Post by MighMoS » Sun Jul 11, 2004 4:13 pm

Rather than moving all these files back and forth, wouldn't just using symlinks be easier?
jabber: MighMoS@jabber.org

localhost # export HOME=`which heart`
Top
freebit50
n00b
n00b
User avatar
Posts: 56
Joined: Wed May 26, 2004 2:01 pm

  • Quote

Post by freebit50 » Mon Jul 12, 2004 5:29 am

Rather than moving all these files back and forth, wouldn't just using symlinks be easier?

Code: Select all

Probrably. I am a newb and didn't think of it. On the other hand, when I was doing the testing, for the 16 songs that I used to fill a cd, all the moving around seemed instantanious. 
Top
agnitio
Tux's lil' helper
Tux's lil' helper
Posts: 136
Joined: Sat Apr 17, 2004 9:02 am

  • Quote

Post by agnitio » Thu Jul 15, 2004 7:33 pm

Why not use [:upper:] and [:lower:] insead of [A-Z] and [a-z] so that it works for non-english characters as well.
Top
cottonmouth
Tux's lil' helper
Tux's lil' helper
Posts: 105
Joined: Sat Jan 24, 2004 9:28 am

  • Quote

Post by cottonmouth » Sat Sep 11, 2004 12:08 pm

freebit50 wrote:I also added comments. My CS teachers at school are always whining about comments and stuff.
Very nice. I don't know shell-scripting, but your comments make unintelligble bash-code much more understandable. Thanks!

Programming is about communication and exchange of ideas between people, the machine is just the medium. Code for people, not for machines.

Or, as the Yukihiro Matsumoto said:
Code is an expression of the thoughts, attitudes, and ideas of the programmer. By reading code, you can not only figure out what particular task the programmers were trying to accomplish and understand how they did it, but you can also gain insight into how they were thinking. This is the reason that reading code makes programmers better.
Matsumoto created Ruby, and no matter if you're interested in the language, his philosophy is enriching for all developers, no matter how skilled one is or which language one works in. Read more here
Answer an unanswered post
Top
Post Reply

32 posts
  • 1
  • 2
  • Next

Return to “Documentation, Tips & Tricks”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic