Decoding a folder of mp3s in Linux.

I’m trying to decode a bunch of (legally acquired, via emusic.com) mp3s to wavs so that I can then re-encode them to ogg vorbis @ q0.

I wanna have 24 hours of music on a single disc at work, that’s why.

Here’s what I’m doing:

$ for i in *.mp3; do mpg321 -w basename $i .mp3.wav $i; done

Seems to work fine, as long as there are no spaces or special characters in the name. When there are special characters or spaces, however, basename hangs and mpg321 doesn’t touch the file.

Is there a way around this, without going through every file by hand and renaming it? I’ve also tried it as basename “$i” and basename ‘$i’.

I think you meant to direct this to GQ and missed your turn? :slight_smile:

That’s basically all I can possibly contribute to this thread. The rest of it might as well be written in Mandarin Chinese as far as I am concerned, since I haven’t got a clue what you are talking about. :wink:

I disagree.

Ummm… yeah. Mods? I’ll take the other forum starting with a “G” for 100, Alex.

You need to double quote the filename globs, otherwise the shell will interpret them as a sequence of two arguments (which is why your command is hanging). Here’s a fixed version:



#!/bin/bash

for i in "*.mp3"
 do mpg321 -w `basename "$i .mp3"`.wav $i;
 done



Thanks SG. It’s working, but now the wavs are getting concatenated in a big giant file called track_one.mp3. Oh well… I guess I’ll stick to mlame.

The problem is that the shell interprets spaces as special charecters. if you put the name in " " or ’ ', the shell will not interpret the argument.

MP3 and Ogg Vorbis are both lossy compression formats. Unless the original MP3s were encoded at some ridiculously high bitrate, the resulting Oggs will sound like crap.

UnuMondo

Given that I’m playing these at less than 10% volume on my crappy work PC speakers, I don’t expect be able to hear a note of Ross “Dr. Knighty” Knight’s bass, let alone appreciate the exquisite distortion he pumps it through. So in this case, having 64kbs oggs re-encoded from 194kbs mp3s that sound subjectively better than, say, 128kbs mp3s ripped straight from the CD, suits my purposes nicely.

Don’t worry; I’m not deleting the originals.

Anyway, mlame works fine, once I edited the source to get rid of that -new-converted-file.mp3 tag it puts at the end of the file names.