-
Notifications
You must be signed in to change notification settings - Fork 9
SID to MP3 music file converter with Stereo panning
Leandro Nini edited this page Nov 6, 2022
·
1 revision
A sample script to convert sid files into mp3 with stereo panning, provided by CustardFlan.
Requires sidplayfp, sox, lame, exiftool and id3v2.
#!/bin/bash
#Set sidplayfp verbosity level
#spfpverb=v2
#spfpverb=q
spfpverb=v0
#Set the track to convert (in case you need to choose one before converting)
sidsubtrack=1
echo =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
echo SID to MP3 music file converter with Stereo panning, by Custard! SandS - 230922
echo =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
echo Removing previous files from the workspace...
rm -f left.wav i.wav right.wav d.wav id.wav cen.wav cenleft.wav cenright.wav cenfin.wav final.wav final-fade.wav
rm -f currfile1.txt cttitle.txt ctartist.txt ctcopyright.txt
echo Convert to SID...
for file in "$@"; do
#sidplayfp -f48000 -p32 $file -w --info
#sidplayfp -$spfpverb -f48000 -p32 -rr --delay=1 --digiboost -u2 -u3 -w --info -ols$sidsubtrack $file
sidplayfp -$spfpverb -f48000 -p32 -rr --delay=1 -u2 -u3 -w --info -ols$sidsubtrack $file
ls *.wav > currfile1.txt
currfile1=cat currfile1.txt
exiftool -s -s -s -Title $currfile1 > cttitle.txt
exiftool -s -s -s -Artist $currfile1 > ctartist.txt
exiftool -s -s -s -Copyright $currfile1 > ctcopyright.txt
mv $currfile1 left.wav
sidplayfp -$spfpverb -f48000 -p32 -rr --delay=1 -u1 -u3 -w --info -ols$sidsubtrack $file
mv $currfile1 right.wav
sidplayfp -$spfpverb -f48000 -p32 -rr --delay=1 -u1 -u2 -w --info -ols$sidsubtrack $file
mv $currfile1 cen.wav
echo Processing with sox to mix the result...
sox left.wav i.wav remix 1v0.75 2v0.25
sox right.wav d.wav remix 1v0.25 2v0.75
sox i.wav d.wav -c 2 id.wav --combine mix-power
sox cen.wav cenleft.wav remix 1v0.50 2v0
sox cen.wav cenright.wav remix 1v0 2v0.50
sox cenleft.wav cenright.wav -c 2 cenfin.wav --combine mix-power
sox id.wav cenfin.wav -c 2 final.wav --combine mix-power
sox -V4 final.wav final-fade.wav fade p 0 0 3
#DEBUG:
#read -p "PAUSE - To check the audio processed by sox..."
echo Converting to MP3...
lame -V0 final-fade.wav $currfile1.mp3
fftitle=cat cttitle.txt
ffartist=cat ctartist.txt
ffcopyright=cat ctcopyright.txt
ffyear=cat ctcopyright.txt
ffcutyear=${ffyear:0:4}
id3v2 -a "$ffartist" -t "$fftitle" --TCOP "$ffcopyright" --TYER "$ffcutyear" "$currfile1.mp3"
#mp3tag -a "$ffartist" -s "$fftitle" -l "$ffcopyright" "$currfile1.mp3"
echo Deleting temporary files from the workspace...
rm -f left.wav i.wav right.wav d.wav id.wav cen.wav cenleft.wav cenright.wav cenfin.wav final.wav final-fade.wav
rm -f currfile1.txt cttitle.txt ctartist.txt ctcopyright.txt
done
echo ----------------------------------------------------------
echo Done!
echo /////////////////////////////////////////////////////////`