Davno
05-11-2008, 10:56 AM
Part -1-
This is a little help file about audio ripping, converting, encoding. ect.... I refer to it often and i tought that it would be useful to others. These are the type files i use and more documentation can be found in there respective man pages.
Most programs and scripts are available on the net (google) or see this post for some of the scripts.
I did not write these scripts except that i modified some. Before using some of these programs you should already know how to install scripts and programs from source.
Some of this stuff is pretty basic but i have seen a lot of questions about audio with linux on many forum to see that there is a need for a newbie HowTo:
AUDIO RIPPING, CONVERTING, ENCODING, ect...
PART -1- (part 2 will be in the next post due to forum limitations)
.cda to .mp3
.cda to .wav
.wav to .mp3 with lame or gogo (petit)
.wav to .flac
.wav to .ogg
.wav to .ape
.ape to .mp3
.ape to .mp3 if .cue present
.ape to .wav
.flac to .mp3
.flac to .mp3 if .cue present
.flac to .ogg
.flac to .wav
.m4a to .wav
.m4a to .mp3
Joining .mp3
Joining .flac
Utilies used in this tutorial:
mpgtx
flac
lame
mplayer
k3b
grip
cdparanoia
petit (gogo)
oggenc
Monkey Audio Library
shntool
mp3splt
mp3wrap
mpg123
k3bmonkeyaudioplugin
________________________________
.cda to .mp3
Use Grip. (lame must be installed)
or if you prefer the command line with cdparanoia (see .cda to .wav) followed with mlame see (.wav to .mp3).
To convert an entire album into one big .mp3 file you can use K3b (lame must be installed).
.cda to .wav
Grip again will do well with the rip only button.
or if you prefer the command line with cdparanoia:
First change directory to where the .wav files will be created.
exemple:
cd /home/userxxx/temp
Options:
cdparanoia -B (for the whole cd)
cdparanoia 4 (for the track # 4 only)
see man paranoia for all options.
Or with a script:
Since i like to automate every thing, i made a simple script for this.
Scripts are really neet for these task, this one will create a link (NeWRiP) to the desktop for the files that will be created in your /home/userxxx/NeWRiP/ and will run cdparanoia. (Just put in a cd and type cdrip).
You will need to modified this script with your username in it.
cdrip script:
#!/bin/bash
# cdrip
# cdparanoia script (.cda to .wav)
# Will create a directory if it does not exist.
# Will create a link to the desktop if it does not exist.
# Will cd to proper directory to execute cdparanoia.
[ -d /home/UserName/NeWRiP ] || mkdir /home/UserName/NeWRiP
[ -L /home/UserName/Desktop/NeWRiP ] || ln -s /home/UserName/NeWRiP /home/UserName/Desktop
cd /home/YourUserName/NeWRiP
cdparanoia -B
.wav to .mp3 (One track a the time)
Using Lame (lossy)
Lame will encode at 192kps with this option.
lame -b 192 /home/PathToTheMusicFiles/song01.wav /home/PathToTheMusicFiles/song01.mp3
see:
lame --help
lame --longhelp
.wav to .mp3 using Gogo (renamed Petit is a encoder based on lame 3.9x, Google for petit313.tgz)
(it encode at least twice as fast as lame)
Usage:
gogo -b 192 /home/PathToTheMusicFiles/song01.wav /home/PathToTheMusicFiles/song01.mp3 .wav to .mp3 (script for multiple tracks at once)
(lame must be installed for wav2mp3 to work)
Usage:
cd /path/to/directory/with/wav files
Then use the wav2mp3 script:
#!/bin/bash
#
# wav2mp3
# This will convert all the files in the directory
# cd /path/to/directory/with/wav files
# Then run this script
for i in *.wav; do
#out=$(ls $i | sed -e 's/.wav//g')
#out=$(echo $i | sed -e 's/.wav$//')
#lame -h -b 192 "$i" "$out.mp3"
lame -h -b 192 "$i" "${i%.wav}.mp3"
done
.wav to .mp3 (another script for multiple tracks at once)
(lame must be installed for mlame to work)
I modified mlame script to encode at 192kps by default.
Usage:
mlame /home/PathToTheMusicFile/*.wav* /home/PathToTheMusicFile/.mp3
mlame script:
#!/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>
#
# 1 - Make it executable:
# chmod -775 mlame
#
# 2 - Put to use from command line:
# ./mlame -o "-v -V 0 -b 128" *.wav *.mp3
# WARNING: if option -r the original .wav becomes .mp3
################################################## ##########################
mp3coder="lame"
options="-h -d -m j -b 192"
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 ":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 mlame options:
-h: help text
-r: remove files after encoding
.wav to .flac (require the installation of Flac)
http://flac.sourceforge.net/
Flac is a lossless compression format, meaning no lost of quality in the compression.
It compress to about 60% of the original size.
Great for storing cd quality album onto a harddrive, ect... It can also be played as .flac on a computer and some portable player also play Flac.
See man flac for options.
Usage:
flac /home/PathToTheMusicFiles/song01.wav
.wav to .ogg
Encode using oggenc (lossy)
http://www.vorbis.com/
Quality from 0 to 10
4 = 110kps-128kps
5 = 136kps-160kps
6 = 160kps-192kps
oggenc --help
Usage:
oggenc -q 6 /home/PathToTheMusicFiles/song01.wav
.wav to .ape
(Google for the Monkey Audio Library for Linux) (mac-3.99-u4-b5.tar.gz)
Also its nice to have this (k3bmonkeyaudioplugin-3.1.tar.bz2)
Encode .wav to .ape (lossless to lossless)
Modes:
Compress (better quality) (fast): '-c1000'
Compress (normal): '-c2000'
Compress (high): '-c3000'
Compress (extra high): '-c4000'
Compress (insane): '-c5000'
Decompress: '-d'
Verify: '-v'
Convert: '-nXXXX'
Usage:
mac /home/PathToTheMusicFiles/song01.wav /home/PathToTheMusicFiles/song01.ape -c1000
PS: I would not normally compress to that format, i would rather use Flac instead but sometimes you need this librairy to decompress a .ape to .wav or a .ape to .mp3.
see next .ape to .mp3
.ape to .mp3
(require the Monkey Audio Library for Linux and also mp3splt)
Use the script cueape
I slightly modified that script to my taste.
It's a very useful script that read a .cue file to break down a album_xyz.ape into multiple tracks.
Usage:
cueape [input ape file] [input cue file] [parameters] Parameters: -m for mp3 or -o for ogg encode.
Exemple:
cueape /home/PathToTheMusicFile/albumXYZ.ape /home/PathToTheMusicFile/albumXYZ.cue -m
It will decompress to a .wav then it will encode to .mp3 or .ogg
It keep one big album_xyz.wav and one big album_xyz.mp3.
.mp3 is encode in VBR of 192 kps. (my default)
Then it call for mp3splt to split that big album_xyz.mp3 into multiple tracks.
mp3splt also write the tags {some tags error i find, not a big deal}
cueape script:
#!/bin/bash
################################################## ##############################################
#usage cueape [input ape file] [input cue file] [parameters]
#Parameters can be: -m for mp3 encoding or -o for ogg encoding.
# Decompress to .wav then encode to .mp3 or to .ogg see options [parameters]
# Keeps a copy of .wav and the original .ape, also it will keep a big .mp3
# It then split the resulting .mp3 file into multiple .mp3 tracks.
# .mp3 are encoded to VBR average 192 kps.
# mp3splt will then write tags.
################################################## ##############################################
#cueape 0.1
#This script is intended to convert ape or flac + cue files to
#ogg vorbis or mp3 files, setting the tags to the correct value,
#obtained from the cue file.
#REQUIREMENTS:
# -Oggenc installed (it comes with vorbis-tools) if you want to encode into Ogg Vorbis.
# -lame installed if you want to encode into mp3
# -mac to decode ape files (Monkey's Audio)
# -flac to decode flac files.
# -mp3split
#IF YOU FIND A BUG OR HAVE A SUGGESTION COMMENTO OR SIMPLY WANT TO CONTACT ME PLEASE MAIL ME TO
#rafadev_*@gmail.com REMOVING THE "_*"
#This is done to prevent spamming
#Copyright (C) 2006 Rafael Ponieman - Buenos Aires, Argentina
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#scripted by deX
case "$1" in
*.[aA][pP][eE] | *[fF][lL][aA][cC] )
if [ ! -f "$1" ] ; then
echo "Input file $1 doesn't exist"
exit 1
fi
if [ ! -f "$2" ]; then
echo "Cue input file $2 doesn't exist"
exit 1
fi ;;
* )
echo "Error: invalid input parameters"
exit ;;
esac
#Testing parameters
if [ "$3" != "-m" ] && [ "$3" != "-o" ] ; then
echo -en "\033[1;31mInvalid parameters\n"
echo -en "\033[1;37m"
echo -en "Usage: cueape [input ape file] [input cue file] [parameters]\nParameters can be: -m for mp3 encoding or -o for ogg encoding.\n"
exit 1
fi
#Need help with this one, coudn't solve it. I need to know how to check if a
#program actually exists and is accesible
#Checking for mac
#[ -f $(which 'maca' >> /dev/null) ] || {
# echo -en "\033[1;31mYou must have mac in your PATH.\033[1;37m\nPlease install Monkey's Audio Codec\nYou can get it from http://sourceforge.net/projects/mac-port/\n"
#}
#Saving the position so as to return afterwards
olddir="$(pwd)"
#Going to target directory
cd "$(dirname "$1")"
#Checking for the output folder. If it's not there I create it
[ ! -d "Output" ] && mkdir -p "Output"
cp "$2" "Output/"
#Decompress
echo -en "\nCueape 0.1\n\n"
echo -en "\033[1;32mStarting conversion\n"
#Checking filetype by extension and decompressing
tmp="$(basename "$1")"
tmp="${tmp##*.}"
case "$tmp" in
[fF][lL][aA][cC] )
echo -en "\033[1;32mDecompressing FLAC file\n\n"
echo -en "\033[1;37m"
tm="$(basename "$1")"
tm="${tm%.[fF][lL][aA][cC]}"
out="$(flac "-d" "$1" -o "Output/${tm}.wav" )"
;;
[aA][pP][eE] )
echo -en "\033[1;32mDecompressing APE file\n\n"
echo -en "\033[1;37m"
tm="$(basename "$1")"
tm="${tm%.[aA][pP][eE]}"
out="$(mac "$1" "Output/${tm}.wav" "-d")"
;;
* )
echo "Error: line 99"
esac
cd "Output"
echo -en "\033[1;32m\nDecompression finished\n"
echo -en "\033[1;32mStarting reencoding\n\n"
echo -en "\033[1;37m"
if [ "$3" = "-o" ] ; then
#Calling oggenc. Saving output for future checking
out="$(oggenc -q 6 -o "$tm.ogg" "$tm.wav")"
echo -en "\033[1;32m\nReencoding finished\n"
echo -en "\033[1;32mSplitting\n\n"
echo -en "\033[1;37m"
out="$(mp3splt -c "$(basename "$2")" -o "@n+-+@t" "$tm.ogg")"
else
#Calling lame. Saving output for future checking
out="$(lame --preset standard "$tm.wav" "$tm.mp3")"
echo -en "\033[1;32m\nReencoding finished\n"
echo -en "\033[1;32mSplitting\n\n"
echo -en "\033[1;37m"
#Using framemode becaus this settings are for VBR
out="$(mp3splt -f -c "$(basename "$2")" -o "@n+-+@t" "$tm.mp3")"
fi
cd "$oldir"
echo -en "\033[1;32m\nProcessing finished successfully\n"
echo -en "\033[1;37m"
exit 0
.ape to .wav
(require the Monkey Audio Library)
If no .cue file present you can go without the cueape script and decompress those .ape files one at the time.
There will be no tags writen and no split of tracks if this is a album.
usage:
mac /home/PathToTheMusicFile/song01.ape /home/PathToTheMusicFile/song01.wav -d
END OF PART -1- (see next post for part -2-)
This is a little help file about audio ripping, converting, encoding. ect.... I refer to it often and i tought that it would be useful to others. These are the type files i use and more documentation can be found in there respective man pages.
Most programs and scripts are available on the net (google) or see this post for some of the scripts.
I did not write these scripts except that i modified some. Before using some of these programs you should already know how to install scripts and programs from source.
Some of this stuff is pretty basic but i have seen a lot of questions about audio with linux on many forum to see that there is a need for a newbie HowTo:
AUDIO RIPPING, CONVERTING, ENCODING, ect...
PART -1- (part 2 will be in the next post due to forum limitations)
.cda to .mp3
.cda to .wav
.wav to .mp3 with lame or gogo (petit)
.wav to .flac
.wav to .ogg
.wav to .ape
.ape to .mp3
.ape to .mp3 if .cue present
.ape to .wav
.flac to .mp3
.flac to .mp3 if .cue present
.flac to .ogg
.flac to .wav
.m4a to .wav
.m4a to .mp3
Joining .mp3
Joining .flac
Utilies used in this tutorial:
mpgtx
flac
lame
mplayer
k3b
grip
cdparanoia
petit (gogo)
oggenc
Monkey Audio Library
shntool
mp3splt
mp3wrap
mpg123
k3bmonkeyaudioplugin
________________________________
.cda to .mp3
Use Grip. (lame must be installed)
or if you prefer the command line with cdparanoia (see .cda to .wav) followed with mlame see (.wav to .mp3).
To convert an entire album into one big .mp3 file you can use K3b (lame must be installed).
.cda to .wav
Grip again will do well with the rip only button.
or if you prefer the command line with cdparanoia:
First change directory to where the .wav files will be created.
exemple:
cd /home/userxxx/temp
Options:
cdparanoia -B (for the whole cd)
cdparanoia 4 (for the track # 4 only)
see man paranoia for all options.
Or with a script:
Since i like to automate every thing, i made a simple script for this.
Scripts are really neet for these task, this one will create a link (NeWRiP) to the desktop for the files that will be created in your /home/userxxx/NeWRiP/ and will run cdparanoia. (Just put in a cd and type cdrip).
You will need to modified this script with your username in it.
cdrip script:
#!/bin/bash
# cdrip
# cdparanoia script (.cda to .wav)
# Will create a directory if it does not exist.
# Will create a link to the desktop if it does not exist.
# Will cd to proper directory to execute cdparanoia.
[ -d /home/UserName/NeWRiP ] || mkdir /home/UserName/NeWRiP
[ -L /home/UserName/Desktop/NeWRiP ] || ln -s /home/UserName/NeWRiP /home/UserName/Desktop
cd /home/YourUserName/NeWRiP
cdparanoia -B
.wav to .mp3 (One track a the time)
Using Lame (lossy)
Lame will encode at 192kps with this option.
lame -b 192 /home/PathToTheMusicFiles/song01.wav /home/PathToTheMusicFiles/song01.mp3
see:
lame --help
lame --longhelp
.wav to .mp3 using Gogo (renamed Petit is a encoder based on lame 3.9x, Google for petit313.tgz)
(it encode at least twice as fast as lame)
Usage:
gogo -b 192 /home/PathToTheMusicFiles/song01.wav /home/PathToTheMusicFiles/song01.mp3 .wav to .mp3 (script for multiple tracks at once)
(lame must be installed for wav2mp3 to work)
Usage:
cd /path/to/directory/with/wav files
Then use the wav2mp3 script:
#!/bin/bash
#
# wav2mp3
# This will convert all the files in the directory
# cd /path/to/directory/with/wav files
# Then run this script
for i in *.wav; do
#out=$(ls $i | sed -e 's/.wav//g')
#out=$(echo $i | sed -e 's/.wav$//')
#lame -h -b 192 "$i" "$out.mp3"
lame -h -b 192 "$i" "${i%.wav}.mp3"
done
.wav to .mp3 (another script for multiple tracks at once)
(lame must be installed for mlame to work)
I modified mlame script to encode at 192kps by default.
Usage:
mlame /home/PathToTheMusicFile/*.wav* /home/PathToTheMusicFile/.mp3
mlame script:
#!/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>
#
# 1 - Make it executable:
# chmod -775 mlame
#
# 2 - Put to use from command line:
# ./mlame -o "-v -V 0 -b 128" *.wav *.mp3
# WARNING: if option -r the original .wav becomes .mp3
################################################## ##########################
mp3coder="lame"
options="-h -d -m j -b 192"
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 ":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 mlame options:
-h: help text
-r: remove files after encoding
.wav to .flac (require the installation of Flac)
http://flac.sourceforge.net/
Flac is a lossless compression format, meaning no lost of quality in the compression.
It compress to about 60% of the original size.
Great for storing cd quality album onto a harddrive, ect... It can also be played as .flac on a computer and some portable player also play Flac.
See man flac for options.
Usage:
flac /home/PathToTheMusicFiles/song01.wav
.wav to .ogg
Encode using oggenc (lossy)
http://www.vorbis.com/
Quality from 0 to 10
4 = 110kps-128kps
5 = 136kps-160kps
6 = 160kps-192kps
oggenc --help
Usage:
oggenc -q 6 /home/PathToTheMusicFiles/song01.wav
.wav to .ape
(Google for the Monkey Audio Library for Linux) (mac-3.99-u4-b5.tar.gz)
Also its nice to have this (k3bmonkeyaudioplugin-3.1.tar.bz2)
Encode .wav to .ape (lossless to lossless)
Modes:
Compress (better quality) (fast): '-c1000'
Compress (normal): '-c2000'
Compress (high): '-c3000'
Compress (extra high): '-c4000'
Compress (insane): '-c5000'
Decompress: '-d'
Verify: '-v'
Convert: '-nXXXX'
Usage:
mac /home/PathToTheMusicFiles/song01.wav /home/PathToTheMusicFiles/song01.ape -c1000
PS: I would not normally compress to that format, i would rather use Flac instead but sometimes you need this librairy to decompress a .ape to .wav or a .ape to .mp3.
see next .ape to .mp3
.ape to .mp3
(require the Monkey Audio Library for Linux and also mp3splt)
Use the script cueape
I slightly modified that script to my taste.
It's a very useful script that read a .cue file to break down a album_xyz.ape into multiple tracks.
Usage:
cueape [input ape file] [input cue file] [parameters] Parameters: -m for mp3 or -o for ogg encode.
Exemple:
cueape /home/PathToTheMusicFile/albumXYZ.ape /home/PathToTheMusicFile/albumXYZ.cue -m
It will decompress to a .wav then it will encode to .mp3 or .ogg
It keep one big album_xyz.wav and one big album_xyz.mp3.
.mp3 is encode in VBR of 192 kps. (my default)
Then it call for mp3splt to split that big album_xyz.mp3 into multiple tracks.
mp3splt also write the tags {some tags error i find, not a big deal}
cueape script:
#!/bin/bash
################################################## ##############################################
#usage cueape [input ape file] [input cue file] [parameters]
#Parameters can be: -m for mp3 encoding or -o for ogg encoding.
# Decompress to .wav then encode to .mp3 or to .ogg see options [parameters]
# Keeps a copy of .wav and the original .ape, also it will keep a big .mp3
# It then split the resulting .mp3 file into multiple .mp3 tracks.
# .mp3 are encoded to VBR average 192 kps.
# mp3splt will then write tags.
################################################## ##############################################
#cueape 0.1
#This script is intended to convert ape or flac + cue files to
#ogg vorbis or mp3 files, setting the tags to the correct value,
#obtained from the cue file.
#REQUIREMENTS:
# -Oggenc installed (it comes with vorbis-tools) if you want to encode into Ogg Vorbis.
# -lame installed if you want to encode into mp3
# -mac to decode ape files (Monkey's Audio)
# -flac to decode flac files.
# -mp3split
#IF YOU FIND A BUG OR HAVE A SUGGESTION COMMENTO OR SIMPLY WANT TO CONTACT ME PLEASE MAIL ME TO
#rafadev_*@gmail.com REMOVING THE "_*"
#This is done to prevent spamming
#Copyright (C) 2006 Rafael Ponieman - Buenos Aires, Argentina
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#scripted by deX
case "$1" in
*.[aA][pP][eE] | *[fF][lL][aA][cC] )
if [ ! -f "$1" ] ; then
echo "Input file $1 doesn't exist"
exit 1
fi
if [ ! -f "$2" ]; then
echo "Cue input file $2 doesn't exist"
exit 1
fi ;;
* )
echo "Error: invalid input parameters"
exit ;;
esac
#Testing parameters
if [ "$3" != "-m" ] && [ "$3" != "-o" ] ; then
echo -en "\033[1;31mInvalid parameters\n"
echo -en "\033[1;37m"
echo -en "Usage: cueape [input ape file] [input cue file] [parameters]\nParameters can be: -m for mp3 encoding or -o for ogg encoding.\n"
exit 1
fi
#Need help with this one, coudn't solve it. I need to know how to check if a
#program actually exists and is accesible
#Checking for mac
#[ -f $(which 'maca' >> /dev/null) ] || {
# echo -en "\033[1;31mYou must have mac in your PATH.\033[1;37m\nPlease install Monkey's Audio Codec\nYou can get it from http://sourceforge.net/projects/mac-port/\n"
#}
#Saving the position so as to return afterwards
olddir="$(pwd)"
#Going to target directory
cd "$(dirname "$1")"
#Checking for the output folder. If it's not there I create it
[ ! -d "Output" ] && mkdir -p "Output"
cp "$2" "Output/"
#Decompress
echo -en "\nCueape 0.1\n\n"
echo -en "\033[1;32mStarting conversion\n"
#Checking filetype by extension and decompressing
tmp="$(basename "$1")"
tmp="${tmp##*.}"
case "$tmp" in
[fF][lL][aA][cC] )
echo -en "\033[1;32mDecompressing FLAC file\n\n"
echo -en "\033[1;37m"
tm="$(basename "$1")"
tm="${tm%.[fF][lL][aA][cC]}"
out="$(flac "-d" "$1" -o "Output/${tm}.wav" )"
;;
[aA][pP][eE] )
echo -en "\033[1;32mDecompressing APE file\n\n"
echo -en "\033[1;37m"
tm="$(basename "$1")"
tm="${tm%.[aA][pP][eE]}"
out="$(mac "$1" "Output/${tm}.wav" "-d")"
;;
* )
echo "Error: line 99"
esac
cd "Output"
echo -en "\033[1;32m\nDecompression finished\n"
echo -en "\033[1;32mStarting reencoding\n\n"
echo -en "\033[1;37m"
if [ "$3" = "-o" ] ; then
#Calling oggenc. Saving output for future checking
out="$(oggenc -q 6 -o "$tm.ogg" "$tm.wav")"
echo -en "\033[1;32m\nReencoding finished\n"
echo -en "\033[1;32mSplitting\n\n"
echo -en "\033[1;37m"
out="$(mp3splt -c "$(basename "$2")" -o "@n+-+@t" "$tm.ogg")"
else
#Calling lame. Saving output for future checking
out="$(lame --preset standard "$tm.wav" "$tm.mp3")"
echo -en "\033[1;32m\nReencoding finished\n"
echo -en "\033[1;32mSplitting\n\n"
echo -en "\033[1;37m"
#Using framemode becaus this settings are for VBR
out="$(mp3splt -f -c "$(basename "$2")" -o "@n+-+@t" "$tm.mp3")"
fi
cd "$oldir"
echo -en "\033[1;32m\nProcessing finished successfully\n"
echo -en "\033[1;37m"
exit 0
.ape to .wav
(require the Monkey Audio Library)
If no .cue file present you can go without the cueape script and decompress those .ape files one at the time.
There will be no tags writen and no split of tracks if this is a album.
usage:
mac /home/PathToTheMusicFile/song01.ape /home/PathToTheMusicFile/song01.wav -d
END OF PART -1- (see next post for part -2-)