Hi all,

I wrote this script. This will help you create audio Cd from mp3's easier.

It is still under development so feedbacks and comments are welcome:

Attachment: mp3_vh.sh.bz2
Description: Binary data

#!/bin/sh

#/***************************************************************************
#                          mp3_vh.sh  -  description
#                            -------------------
#    begin                : Sun 11 Nov  2001
#    copyright            : (C) 2001 by Nguyen Hung.Vu
#    website              : http://site.techviet.com/Vu.Hung/
#    email                : [EMAIL PROTECTED]
# ***************************************************************************/

#/***************************************************************************
# *                                                                         *
# *   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.                                   *
# *                                                                         *
# ***************************************************************************/
#//------------------------------------------------------------------------------
echo "------------------------------------------"
echo "  Welcome and thank you for using this    "
echo "  This script will enbale you making      "
echo "  Audio CD easier                         "
echo "  Nguyen Hung.Vu <[EMAIL PROTECTED]>     "
echo "------------------------------------------"

echo "------------------------------------------"
echo " Usage: Copy this file to the folder      "
echo " contains mp3s you want to burn into CD-R "
echo " then                                     "
echo " %chmod a+x mp3_vh.sh                     "
echo " %./mp3_vh.sh                             "
echo " Then following the instructions          "
echo " It is easy                               "
echo "------------------------------------------"
echo ""
echo "Press any key to continue...              "
read continue_x

echo ""
echo "You need mpg123, sox and cdrecord installed."
echo "Install them from your Linux Cds if don't have them yet."
echo "Now checking for needed software..."
#read ready_now

s_mpg123=`whereis mpg123`
s_madplay=`whereis madplay`
s_lame=`whereis lame`
s_sox=`whereis sox`
s_normalize=`whereis normalize`
s_cdrecord=`whereis cdrecord`

S_mpg123=/usr/bin/mpg123
S_sox=/usr/bin/sox
S_normalize=/usr/bin/normalize
S_cdrecord=/usr/bin/cdrecord

echo  " Whereis mpg123?"
echo $s_mpg123
#echo $s_madplay
#echo $s_lame

echo " Whereis sox?"
echo $s_sox

#echo $s_normalize

echo " Whereis cdrecord?"
echo $s_cdrecord

echo " Please double check if below are not correct..."
echo "mpg123 ..." $S_mpg123
echo "sox ..."    $S_sox
echo "cdrecord ..." $S_cdrecord

echo
echo "If they are incorrect, you can change them. (y/n)..."
read change_path

case  $change_path in
Y|y)
        echo "Enter path to mpg123. Press enter to use default path"
        echo "/usr/bin/mpg123: "
        read S1_mpg123
        test -n "$S1_mpg123" && $S_mpg123=$S1_mpg123

        echo "Enter path to sox. Press enter to use default path"
        echo "/usr/bin/sox: "
        read S1_sox
        test -n "$S1_sox" && $S_sox=$S1_sox

        echo "Enter path to normalize. Press enter to use default path"
        echo "/usr/bin/normalize"
        read S1_normalize
        test -n "$S1_normalize" && $S_normalize=$S1_normalize

        echo "Enter path to cdrecord. Press enter to use default path"
        echo "/usr/bin/cdrecord: "
        read S1_cdrecord
        test -n "$S1_cdrecord" && $S_cdrecord=$S1_cdrecord
esac

echo "Do you want to resample wav files(y/n)"
read resample
S_resample=0
case $resample in
        Y | y)
                S_resample=1
esac
        
echo "Do you want to normalize wav files(y/n)"
read normalize
S_normalize=0
case $normalize in
        Y | y)
                S_normalize_yn=1
esac

echo "Burning speed?"
read S_speed
        
echo "Now I got all needed information. Insert a blank Cd into "
echo "Cd-rom drive.Press any to begin "
echo "Convert mp3 to wav and burn them to Cd"
read convert_ready

echo "Now convert all [:space] or \"%20\" to under bar..."
for i in *mp3
do
        mv "$i" `echo $i | tr ' ' '_'`
done

echo "Done"

echo "Converting mp3 to wav. It may take a while. Please wait..."
for i in *.mp3
do
        $S_mpg123 -w `basename $i .mp3`.wav $i
done

echo "Done"



echo "Resampling .wav files..."
if $S_resample -eq 1
then
        
        for i in *.wav
        do
                $S_sox $i "$i_new.wav" resample
                mv $i
        done
fi
echo "Done"

echo "Normalizing .wav files..."
if $S_normalize_yn -eq 1
then
        for i in *wav
        do
                $S_normalize -n $i
        done
fi

echo "Detecting you CD-R drive..."

$S_cdrecord -scanbus

S_dev=`$S_cdrecord -scanbus | grep Remo | awk '{print $1}'`

$S_cdrecord dev=$S_dev -eject speed=$S_speed -pad -audio *.wav

# Uncomment the following lines when you debug
#echo "cdrecord path: "$S_cdrecord
#echo "\$S_dev is: "$S_dev
#echo "\$S_speed is: "$S_speed

S1_dev=`$S_cdrecord -scanbus | grep Remo`
echo "Successfully creating Audio Cd"
echo "Speed: " $S_speed
echo "Drive: " $S1 
echo "with: " $S_cdrecord
ech  "Done ;)"
Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to