Convert FLAC to mp3

{Long story}
I love music. In Berlin I bought a pair of Sennheiser. Then I started to realize what a big influence bitrate of hard compressed mp3 had on the quality. The solution to the problem is FLAC (Free Lossless Audio Codec). In short that is the quality you get from a cd. But since my mobile devices and portables can’t handle FLAC I’m now on two lanes:

  • FLAC for office and home usage
  • compressed VBR mp3 for my phone

However, if you wish to convert FLAC files to mp3 and do not want to loose the id3 Tags (like me), I found somewhat on the internet and created this little (bash) script:

[code lang=”bash”]

# by K-Soft! 05/24/2012 with parts from
# convert flac to mp3 and writes id3 tags
# usage: flactomp3 /path/to/my/awesome/music/
# requires FLAC, ID3, LAME
# change quality -V 0-9


if [ $# -eq 0 ] ; then
echo ‘No arguments provided, usage: flactomp3 /my/awesome/music/’
exit 0
for flacfile in $1*.flac
eval "$(
metaflac "$flacfile" –show-tag=ARTIST \
–show-tag=TITLE \
–show-tag=ALBUM \
–show-tag=GENRE \
–show-tag=TRACKNUMBER \
–show-tag=DATE | sed ‘s/=\(.*\)/="\1"/’
flac -c -d "$flacfile" | lame -m j -q 0 –vbr-new -V 0 -s 44.1 – "$outf"
id3 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$outf"