FLAC

From Indie IT Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Convert From Flac to MP3

for f in *.flac; do avconv -i "$f" -acodec libmp3lame -ab 320k "${f%.flac}.mp3"; done

Create A Single .flac File From CD

abcde -1 -a default,cue

Create Both FLAC and MP3 Files From CD

~/.abcde.conf

OUTPUTTYPE="mp3,flac"
LAMEOPTS='--preset extreme'
FLACOPTS='--verify --best'
OUTPUTDIR="$HOME/Music/"
OUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}/${ALBUMFILE}/${TRACKNUM} ${TRACKFILE}'
VAOUTPUTFORMAT='${OUTPUT}/Various/${ALBUMFILE}/${TRACKNUM} - ${ARTISTFILE} ${TRACKFILE}'
PADTRACKS=y
EJECTCD=y
MAXPROCS=4

http://markledden.wordpress.com/2011/01/08/automated-cd-ripping-to-flac-mp3-simultaneously/

Split An Audio .flac File

#!/bin/bash

clear

# Introduction

echo
echo "This script will convert, split and tag FLAC files with an associated cue sheet"
echo
echo "WARNING: THIS SCRIPT WILL AUTOMATICALLY INSTALL SOME NECESSARY PACKAGES IF NOT ALREADY INSTALLED"
echo

# Filenaming template

# %a author
# %A album
# %g genre
# %n track number
# %t title
# %d date
# %c comments

# This is obviously the *correct* naming convetion :P
TEMPLATE='%A - %n - %a - %t'

# This will check if all packages needed are present in the system, and will install them if not.

FLAC=`which flac`
if [ -z "$FLAC" ]; then
  echo "ERROR (Don't worry) ;-)"
  echo "FLAC is not in your system, automatically installing..."
  sudo apt-get update && sudo apt-get install flac -y
  clear
  echo "OK NOW, PROCEEDING..."
  echo
fi

CUE=`which cuebreakpoints`
if [ -z "$CUE" ]; then
  echo "ERROR (Wish every error were like this one...) ;-)"
  echo
  echo "cuetools not present, automatically installing..."
  sudo apt-get update && sudo apt-get install cuetools -y
  clear
  echo "OK NOW, PROCEEDING..."
  echo
fi

SHN=`which shntool`
if [ -z "$SHN" ]; then
  echo "ERROR (Not the end of the world, anyway) ;-)"
  echo
  echo "shntool is not around here, let's get it..."
  sudo apt-get update && sudo apt-get install shntool -y
  clear
  echo "OK, PROCEEDING..."
  echo
fi

LL=`which lltag`
if [ -z "$LL" ]; then
  echo "OH, MY GOD! ;-)"
  echo
  echo "lltag is not in your computer, installing..."
  sudo apt-get update && sudo apt-get install lltag -y
  clear
  echo "AT LAST, PROCEEDING..."
  echo
fi

# Now it will check if we have chosen a cue file

for i in "$@"; do
  # There's no point in checking for a  mixed case file extension if we're 
  # going to rely on it having a lower case extenstion later on
  case "$i" in
    *.cue)
      echo "Checking if file $i is a .cue file...";;
    *)
      echo "Warning: File $i is not a .cue file. Aborting."
      continue
  esac

  # Processing files
  
  FILENAME=$(basename "$i" .cue)
  TMPCUE=$(mktemp --suffix=.cue)
  cp "$FILENAME.cue" "$TMPCUE"
  
  # Try to "fix" incompatible cue files (this is a guess but works for me)
  if grep "^\s*INDEX 00 00:00:00\s*$" "$TMPCUE" > /dev/null; then
    echo "Attempting to fix incompatible cue file..."
    sed -i -e "/^\s*INDEX 01/d" -e "s/^\(\s*\)INDEX 00/\1INDEX 01/" "$TMPCUE"
  fi

  echo "Splitting files..."
  cuebreakpoints  "$TMPCUE"
  shnsplit -o flac -f "$TMPCUE" "$FILENAME.flac"
  
  echo "Adding tags..."
  cuetag "$TMPCUE" split-track*.flac
  
  # This will rename files using the strucure "track-number title", the one I like, but it can be easyly changed using common parameters. Please read lltag manual for more information.
  
  echo "Renaming files..."
  lltag --yes --no-tagging --rename "$TEMPLATE" $(ls split-track*.flac)
  echo
  echo
  echo "Process ended."
done

# cleaning up
rm "$TMPCUE"

Thanks - http://ubuntuforums.org/showthread.php?t=2147598

Install the following programmes:

Linux Terminal $:

sudo apt-get install cuetools shntool flac

Split the audio file in the following manner, required commandline first followed by an example:

Linux Terminal $:

cuebreakpoints file.cue | shnsplit -o flac file.flac

cuebreakpoints Skyscraper.flac.cue | shnsplit -o flac Skyscraper.flac

Thanks go to Danilo Dellaquila for the above tutorial.