Help - Search - Members - Calendar
Full Version: This script converts flac cue/bin to single flac files
Hydrogenaudio Forums > Lossless Audio Compression > FLAC
I am all FLAC
I have made this script for Linux that converts a flac compressed bin file to single flac files.

NOTICE1: it deletes the original files, so you only end up the flac files, a list of the song titles (in case you want to import the song names with EasyTag.sf.net) and the cue file.

NOTICE2: During convertion it needs ~2x of disk space of the big flac file size.

NOTICE3: As far as I know only Debian have a fixed version of bchunk, so if you (like me) doesn't use Debian, you have to download Debian's patch, and compile bchunk yourself. Without the fixed version of bchunk, the all songs will have wrong offsets!

CODE
#!/bin/sh

FLAC="$(echo *flac)"
CUE="$(echo *cue)"
AUD="audio.raw"

flac -d "$FLAC"
rm "$FLAC"

WAV="$(echo *wav)"
sox "$WAV" "$AUD"
rm "$WAV"

/usr/local/bin/bchunk -w "$AUD" "$CUE" track
rm "$AUD"

flac --best track*
rm track*wav

sed -n 's/    TITLE "\(.*\)"/\1/p' "$CUE" > songnames.txt
perilsensitive
Nice. I've never used bchunk.

You could use shntool for this as well. Assuming that you want to split the single flac file "album.flac" into tracks named "trackX.flac" (where X is the track number) using the cuesheet "album.cue", do the following:

CODE

shntool split -f album.cue -o "flac flac --best -o %f -" -a track album.flac


If there was a pregap for track 1, it'll be written to 00.flac. Delete this if you don't want it. You can also remove album.flac once you're done with it.

This also works to split ape cue/bin to single flac files.
I am all FLAC
QUOTE(perilsensitive @ Feb 16 2008, 09:03) *

Nice. I've never used bchunk.

You could use shntool for this as well. Assuming that you want to split the single flac file "album.flac" into tracks named "trackX.flac" (where X is the track number) using the cuesheet "album.cue", do the following:

CODE

shntool split -f album.cue -o "flac flac --best -o %f -" -a track album.flac


If there was a pregap for track 1, it'll be written to 00.flac. Delete this if you don't want it. You can also remove album.flac once you're done with it.

This also works to split ape cue/bin to single flac files.

Damn this is cool!!! biggrin.gif

Fedora doesn't come with shntool, I have just compiled it. I'd it's worth it biggrin.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.