using mpg123 to convert .mp3 to .wav files
Hi I am running mpg123 to convert my files from .mp3 to .wav
I am doing it this way mpg123 -w <filename>.wav <filename>.mp3 This works fine for me. But I was wondering if someone knew if there was a way to convert ALL my mp3 files in a directory to wav files with ONE command. something like this... mpg123 -w *.wav *.mp3 (which i know doesn't work) My second question is whether or not anyone knows of a GUI that converts mp3 to wav with a drag and a couple clicks of a mouse. Cheers, Chris |
Don't know about mpg123 but I found that using a lame script "mlame" coverts all my .wav to .mp3 automatically:
~/kencaz/./mlame -r -o "-v -V 0 -b 112" *.wav *.mp3 This will convert all file in my current foder from .wav to .mp3. I don't remember where I got the script but it's kinda hard to find so I'll include it here. You'll have to save it to a file then change permissions as usual... #!/bin/bash #!/usr/local/bin/bash ############################################################################ # # Run the LAME encoder on multiple files, with option to delete .wav files # after encoding. "mlame -h" will give instructions. # # Robert Hegemann <Robert.Hegemann@gmx.de> # ############################################################################ mp3coder="lame" options="-h -d -m j -b 128" rmsrc=false helptext="\ \nThis script runs the LAME mp3 encoder on multiple files: \n\n\ $0 [options] <file 1> ... <file n>\n\ \n\ options:\n\ -h this help text\n\ -r remove files after encoding\n\ -o \"<lame options>\" overrides script default options \"${options}\"\n\ \n\ example:\n\ $0 -r -o \"-v -V 0 -b 112\" a*.wav z*.aif\n\ \n\ " # process command-line options # this could be extended to fake the # commandline interface of the mp3encoder while getopts ":o:r" optn; do case $optn in o ) options=$OPTARG # replace default options ;; r ) rmsrc=true ;; \? ) printf "$helptext" exit 1 ;; esac done shift $(($OPTIND - 1)) # process input-files for filename in "$@"; do case $filename in *[*?]* ) # means shell couldnīt extend *.wav, etc. echo "warning: no $filename file(s) found" ;; *[.][wW][aA][vV] ) name=${filename%[.][wW][aA][vV]} if $mp3coder $options "$filename" "${name}.mp3" then if [ $rmsrc = true ]; then rm -f "$filename" fi fi ;; *[.][aA][iI][fF] ) name=${filename%[.][aA][iI][fF]} if $mp3coder $options "$filename" "${name}.mp3" then if [ $rmsrc = true ]; then rm -f "$filename" fi fi ;; * ) if $mp3coder $options "$filename" "${filename}.mp3" then if [ $rmsrc = true ]; then rm -f "$filename" fi fi ;; esac done |
Re: using mpg123 to convert .mp3 to .wav files
Quote:
Code:
#!/usr/bin/perl |
#!/usr/bin/perl
my $dir = "/change/this/to/your/directory"; opendir DH, $dir or die "Can't open $dir: $!"; $count2=1; while ($name = readdir DH) { next unless $name =~ /\.mp3$/; $wav="$count2.wav"; print "$wav\n"; system "mpg123 -w $wav \"$name\""; $count2++; } So I just changed the line my $dir = "/change/this/to/your/directory"; to my directory where i hold my mp3s but the script didn't work...nothing happened. Any ideas why? Thanks, Chris |
This little diddy from my notes should get you going.....
Code:
cd /home/music/directory Code:
cd /home/music/directory This part is in quotes to handle names with spaces in them "`basename "$i" .mp3`" |
Quote:
next unless $name =~/\.mp3$/i. This will ignore case. Otherwise did it give you some kind of error? I just used the script a few minutes ago as is so I know it works. |
Script in ruby:
files = Dir.entries(".") for file in files if file.include?(".mp3") file.gsub!(".mp3", "") system "mpg123 -w '#{file}'.wav '#{file}'.mp3" end end And I know: the post is old, and script is simple as possible |
For those who aren't scripters, here's a start toward a simple if verbose kludge:
https://raywoodcockslatest.wordpress...xcel-for-batch |
All times are GMT -5. The time now is 06:22 AM. |