Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: This script converts flac cue/bin to single flac files (Read 8009 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

This script converts flac cue/bin to single flac files

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: [Select]
#!/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

This script converts flac cue/bin to single flac files

Reply #1
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: [Select]
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.

This script converts flac cue/bin to single flac files

Reply #2
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: [Select]
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!!! 

Fedora doesn't come with shntool, I have just compiled it. I'd it's worth it