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: Convert Cue Sheets (single -> multiple file) (Read 21297 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Convert Cue Sheets (single -> multiple file)

I have a collection of single-files containing whole images of CDs together with corresponding cue sheets referencing the single file.

I now prefer to have my archive in multiple flac files for songs and not complete album images.

Is there way to automatically convert cue-sheets to reference multiple files (one for each entry in the cue sheet) from single-file cue sheets?

Any help welcome,

ElFishie

Convert Cue Sheets (single -> multiple file)

Reply #1
CUE Tools (download link here).  Currently it accepts WAV and FLAC input, and outputs to WAV.


Convert Cue Sheets (single -> multiple file)

Reply #2
tks, nice tool.


the output styles correspond to EAC's ways of producing cue-sheets like

gaps appended -> with gaps (noncompliant)
gaps prepended -> with corrected gaps
gaps left out -> with leftout gaps

correct?

is there a way it can read ape-files?
(my original problem, then I wouldn't have to convert to wav first)

tks, ElFishie

Convert Cue Sheets (single -> multiple file)

Reply #3
Yes, you are correct.

I don't plan to add APE support.

Convert Cue Sheets (single -> multiple file)

Reply #4
Hmmmm...

just for the purpose of turning single-file cue-sheets to multiple-file cue-sheets:

is it an absolute necessity to have the single file images as input?
could the same information also be generated from a set of flac files generated from the original image?
B/c this is what I'm doing anyway.
I just would like to save the extra step of generating another image file.

If not, no sweat: still great tool!

Convert Cue Sheets (single -> multiple file)

Reply #5
Foobar2000 can also convert Image+CUE to multiple files.  I don't know if it will create a new cuesheet for the files though.
flac > schiit modi > schiit magni > hd650

Convert Cue Sheets (single -> multiple file)

Reply #6
just for the purpose of turning single-file cue-sheets to multiple-file cue-sheets:

is it an absolute necessity to have the single file images as input?
could the same information also be generated from a set of flac files generated from the original image?

A single image CUE contains all the information needed to generate an individual track CUE.  The image file is not necessary.

Foobar2000 can also convert Image+CUE to multiple files.  I don't if it will create a new cuesheet for the files though.

I don't think so (WOW! Something foobar2k CAN'T do??? ), but EAC sure can!

Moitah,
How are you determining the lengths of tracks from wave and flac files?

Convert Cue Sheets (single -> multiple file)

Reply #7
It is possible to convert single-file cuesheets to multiple-file cuesheets without knowing the length of the audio image, but CUE Tools can't do it right now.  I'll keep it in mind for a future version.

@greynol:  For WAV files, the length (in samples) is the size of the data chunk divided by the "block align" value.  For FLAC, the length is stored in the STREAMINFO metadata block (I use libFLAC to read this currently, but the older versions that could only read the length from FLAC files (not decode them) parsed the bitstream manually).

Convert Cue Sheets (single -> multiple file)

Reply #8
Thanks Moitah.

I have a batch file that converts separate track CUEs into single file CUEs, one that converts cg and lg CUEs into nc CUEs, and one that creates a CUE from information in an EAC log.  Currently they all require the source files to be in wave format and determine track length from the file size which will not be correct if there is any RIFF data though though they do return an error if it appears that a track doesn't end on a frame boundary.

IOW, I'm assuming the size of the PCM data is 44 bytes less than the size of the wave file.

Convert Cue Sheets (single -> multiple file)

Reply #9
OK, one mo'

can "CUE Tools" run from command line?

Convert Cue Sheets (single -> multiple file)

Reply #10
Nope.  If you know C#, it shouldn't be too hard to use my CUESheet class.  Just something like:

Code: [Select]
CUESheet cueSheet = new CUESheet(pathSrc);
cueSheet.Write(pathDst, CUEStyle.GapsAppended);

I think will work.  Just fill in pathSrc and pathDst.

Convert Cue Sheets (single -> multiple file)

Reply #11
Cue Splitter 0.6 - http://www.enfis.it/details.php?id=42

Can split and generate new cue files.

Some info:

Quote
Supported audio file: uncompressed pcm WAVE, MP3, FLAC and APE.
Supported audio tags: ID3v1, ID3v2, Lyrics, Vorbis comment e APE.
Complete support for Unicode, UTF8 and ANSI in every part of the program.
Can load .CUE files written in Unicode, UTF8 and ANSI (any codepage).
Hidden tracks and sub-indexes are automatically detected.
You can include the gap sound chunk (mostly silence) in splitted file.
Various file access method to improve performance across different systems.
Generated file names are automatically constructed using a user-defined "file mask" string (Press F1 or F6 for a "file mask" tutorial).
Generated file tags are automatically filled with informations extracted from "CUE" files (informations can be modified on-the-fly).
Automatically generates an M3U playlist file ready for Winamp (and others).
You can automatically generate a new CUE sheet file at the end of split process!
You can send all splitted fiiles into a common directory (press F6 to configure this feature).
CUE sheet and M3U generated files can use a file mask!
You can select only desired tracks for extraction.
You can associate .CUE extension with CUE Splitter (menu File->Configuration or press F6) and double-click on .CUE files from Windows explorer.
You can handle any number of custom "file mask" strings, as needed, directly from the user-interface (Press F1 or F6 for a "file mask" tutorial).
You can choose a character case changer, used in file names and tags, between: "title case", "upper case", "lower case" and "sentence case".
You can scan a single audio file or an entire directory recursively, to obtain file informations and detect audio errors (menu Tool->Audio file information).
You can edit artist and title values from the user-interface using pop-up menu or double-clicking above a track (changes will not saved back to CUE file).
You can create and handle your custom list of musical genres (used for tags).
You can choose your preferred font face to use in the user-interface form.
Multi-language interface: you can translate the software to your language using the buil-in translating tool (menu Language -> Translate...).
Simple, light and straightforward user-interface.
Tray icon enabled.
Free )


And yep, its free and works very well
myspace.com/borgei - last.fm/user/borgei

Convert Cue Sheets (single -> multiple file)

Reply #12
There's also shntool (http://shnutils.freeshell.org/shntool/). It's a command-line program. It will split a file using a cuesheet and can also make cuesheets from multiple files.

Convert Cue Sheets (single -> multiple file)

Reply #13
I recently finished a batch file that will convert single wave cue sheets to noncompliant cue sheets using only the single wave cue sheet as a source (the audio data is not used).

Convert Cue Sheets (single -> multiple file)

Reply #14
Code: [Select]
@ECHO OFF
SET _outfile="%~dpn1 (noncompliant).cue"
IF EXIST %_outfile% (
  ECHO "%~n1 (noncompliant).cue"
  ECHO already exists!
  ECHO.
  ECHO Press any key to end . . .
  PAUSE>nul
  GOTO end
)
SET _tempfile=%TEMP%\~cueconv.tmp
IF EXIST %_tempfile% DEL %_tempfile%
SET _track=
SET _line=
SET _skip=
SET _index=
SET _header=1
IF "%~1" == "" GOTO end
GOTO start

:get_next_line
SET /A _line+=1
SET _skip=skip=%_line%

:start
FOR /F "usebackq tokens=1,2* %_skip%" %%X IN (%1) DO (
  SET _x=%%X
  SET _y=%%Y
  SET _z=%%Z
  GOTO generate_cue
)
GOTO end

:generate_cue
IF "%_x%" == "FILE" GOTO file
IF "%_x%" == "TITLE" CALL :set_title
IF "%_x%" NEQ "INDEX" GOTO other
IF "%_y%" == "00" GOTO 00_index
IF "%_y%" == "01" GOTO 01_index
GOTO XX_index
:other
IF %_header% EQU 0 (
  IF "%_x%" == "TRACK" (
    SET _x=  TRACK
  ) ELSE (
    SET _x=    %_x%
  )
)
IF DEFINED _z (
  ECHO %_x% %_y% %_z%>>%_tempfile%
  GOTO get_next_line
)
IF DEFINED _y (
  ECHO %_x% %_y%>>%_tempfile%
  GOTO get_next_line
)
ECHO %_x%>>%_tempfile%
GOTO get_next_line

:file
IF %_header% == 0 GOTO error
TYPE %_tempfile%>%_outfile%
DEL %_tempfile%
SET _header=0
GOTO get_next_line

:set_title
IF DEFINED _z (
  SET _title=%_y% %_z%
) ELSE (
  SET _title=%_y%
)
GOTO :eof

:01_index
CALL :extract_index %_z%
SET /A _iframes=mm*4500+ss*75+ff
IF "%_index%" NEQ "0" (
  CALL :set_file %_title%
  TYPE %_tempfile%>>%_outfile%
  DEL %_tempfile%
  ECHO    INDEX 01 00:00:00>>%_outfile%
)
SET _index=
GOTO get_next_line

:00_index
IF "%_z%" == "00:00:00" GOTO get_pregap
SET _index=0
CALL :extract_index %_z%
SET /A _igap=mm*4500+ss*75+ff - _iframes
CALL :format_index %_igap%
ECHO    INDEX %_y% %mm%:%ss%:%ff%>>%_tempfile%
TYPE %_tempfile%>>%_outfile%
DEL %_tempfile%
CALL :set_file %_title%
ECHO    INDEX 01 00:00:00>>%_outfile%
GOTO get_next_line

:XX_index
CALL :extract_index %_z%
SET /A _igap=mm*4500+ss*75+ff - _iframes
CALL :format_index %_igap%
ECHO    INDEX %_y% %mm%:%ss%:%ff%>>%_outfile%
GOTO get_next_line

:set_file
SET /A _track+=1
SET tt=%_track%
IF %tt% LSS 10 (SET tt=0%tt%)
ECHO FILE "%tt% - %~1.wav" WAVE>>%_outfile%
GOTO :eof

:get_pregap
SET /A _advance=_line + 1
SET _skip=skip=%_advance%
FOR /F "usebackq tokens=1,2* %_skip%" %%X IN (%1) DO (
  SET _x=%%X
  SET _y=%%Y
  SET _z=%%Z
  GOTO got_pregap
)
:got_pregap
CALL :extract_index %_z%
SET /A _pregap=mm*4500+ss*75+ff
ECHO    PREGAP %_z%>>%_tempfile%
GOTO get_next_line

:extract_index
SET _z=%1
IF %_z:~0,1% == 0 (
  SET mm=%_z:~1,1%
) ELSE (
  SET mm=%_z:~0,2%
)
IF %_z:~3,1% == 0 (
  SET ss=%_z:~4,1%
) ELSE (
  SET ss=%_z:~3,2%
)
IF %_z:~6,1% == 0 (
  SET ff=%_z:~7,1%
) ELSE (
  SET ff=%_z:~6,2%
)
GOTO :eof

:format_index
SET /A mm=%1/4500
SET /A ss=%1%%4500/75
SET /A ff=%1%%4500%%75
IF %mm% LSS 10 (SET mm=0%mm%)
IF %ss% LSS 10 (SET ss=0%ss%)
IF %ff% LSS 10 (SET ff=0%ff%)
GOTO :eof

:error
ECHO Input CUE is not of the single file variety!
ECHO.
ECHO Press any key to end . . .
PAUSE>nul
DEL %_outfile%

:end

 

Convert Cue Sheets (single -> multiple file)

Reply #15
stunning - thanks a lot.

I have two error messages:

system tells me it can't process the command "Your" when I have the batch file process a track called
    TITLE "You Oughta Know (Jimmy The Saint Blend) & Your House (A Capella)"

message does not appear when I eliminate the "&"

Second is the message that the system is unable to find C:\...\Temp\~cueconv.tmp
(... is my temp path)

I havent tried debugging, maybe you are faster with this.

Cheers

Convert Cue Sheets (single -> multiple file)

Reply #16
Great batch script greynol!

I have a couple of questions. I've noticed that the outputed multi-track cuesheets are not tabbed/indented the same way as EAC generates them. This creates a problem when trying to burn the non-compliant cuesheet created with your batch script in Burrrn. This may be a problem with Burrrn itself as EAC loads the non-compliant cuesheets that your batch script creates. I compared a non-compliant cuesheet generated from EAC and one that was generated using your script from the image cuesheet from the same album. The con-compliant cuesheet generated from EAC loads in Burrrn and yours does not. I'm not saying yours is incorrect, there just seems to be a problem with Burrrn and the line indentations. The indent differences are shown below:

EAC Generated non-compliant cuesheet:
Code: [Select]
REM GENRE "Progressive Metal"
REM DATE 2005
REM DISCID 6B11C208
REM COMMENT "ExactAudioCopy v0.95b3"
CATALOG 0075678379321
PERFORMER "Dream Theater"
TITLE "Octavarium"
FILE "01 - The Root Of All Evil.wv" WAVE
  TRACK 01 AUDIO
    TITLE "The Root Of All Evil"
    PERFORMER "Dream Theater"
    ISRC USEE10500937
    FLAGS DCP
    INDEX 01 00:00:00
  TRACK 02 AUDIO
    TITLE "The Answer Lies Within"
    PERFORMER "Dream Theater"
    ISRC USEE10500938
    FLAGS DCP
    INDEX 00 08:07:61
FILE "02 - The Answer Lies Within.wv" WAVE
    INDEX 01 00:00:00
  TRACK 03 AUDIO
    TITLE "These Walls"
    PERFORMER "Dream Theater"
    ISRC USEE10500971
    FLAGS DCP
    INDEX 00 05:26:14
FILE "03 - These Walls.wv" WAVE
    INDEX 01 00:00:00
  TRACK 04 AUDIO
    TITLE "I Walk Beside You"
    PERFORMER "Dream Theater"
    ISRC USEE10500972
    FLAGS DCP
    INDEX 00 06:59:43
FILE "04 - I Walk Beside You.wv" WAVE
    INDEX 01 00:00:00
FILE "05 - Panic Attack.wv" WAVE
  TRACK 05 AUDIO
    TITLE "Panic Attack"
    PERFORMER "Dream Theater"
    ISRC USEE10500973
    FLAGS DCP
    INDEX 01 00:00:00
  TRACK 06 AUDIO
    TITLE "Never Enough"
    PERFORMER "Dream Theater"
    ISRC USEE10500974
    FLAGS DCP
    INDEX 00 07:16:33
FILE "06 - Never Enough.wv" WAVE
    INDEX 01 00:00:00
  TRACK 07 AUDIO
    TITLE "Sacrificed Sons"
    PERFORMER "Dream Theater"
    ISRC USEE10500975
    FLAGS DCP
    INDEX 00 06:33:67
FILE "07 - Sacrificed Sons.wv" WAVE
    INDEX 01 00:00:00
FILE "08 - Octavarium.wv" WAVE
  TRACK 08 AUDIO
    TITLE "Octavarium"
    PERFORMER "Dream Theater"
    ISRC USEE10500976
    FLAGS DCP
    INDEX 01 00:00:00

Batch Script generated non-compliant cuesheet from image file cuesheet generated by EAC:
Code: [Select]
REM GENRE "Progressive Metal"
REM DATE 2005
REM DISCID 6B11C208
REM COMMENT "ExactAudioCopy v0.95b3"
CATALOG 0075678379321
PERFORMER "Dream Theater"
TITLE "Octavarium"
FILE "01 - The Root Of All Evil.wv" WAVE
 TRACK 01 AUDIO
 TITLE "The Root Of All Evil"
 PERFORMER "Dream Theater"
 ISRC USEE10500937
 FLAGS DCP
INDEX 01 00:00:00
 TRACK 02 AUDIO
 TITLE "The Answer Lies Within"
 PERFORMER "Dream Theater"
 ISRC USEE10500938
 FLAGS DCP
INDEX 00 08:07:61
FILE "02 - The Answer Lies Within.wv" WAVE
INDEX 01 00:00:00
 TRACK 03 AUDIO
 TITLE "These Walls"
 PERFORMER "Dream Theater"
 ISRC USEE10500971
 FLAGS DCP
INDEX 00 05:26:14
FILE "03 - These Walls.wv" WAVE
INDEX 01 00:00:00
 TRACK 04 AUDIO
 TITLE "I Walk Beside You"
 PERFORMER "Dream Theater"
 ISRC USEE10500972
 FLAGS DCP
INDEX 00 06:59:43
FILE "04 - I Walk Beside You.wv" WAVE
INDEX 01 00:00:00
FILE "05 - Panic Attack.wv" WAVE
 TRACK 05 AUDIO
 TITLE "Panic Attack"
 PERFORMER "Dream Theater"
 ISRC USEE10500973
 FLAGS DCP
INDEX 01 00:00:00
 TRACK 06 AUDIO
 TITLE "Never Enough"
 PERFORMER "Dream Theater"
 ISRC USEE10500974
 FLAGS DCP
INDEX 00 07:16:33
FILE "06 - Never Enough.wv" WAVE
INDEX 01 00:00:00
 TRACK 07 AUDIO
 TITLE "Sacrificed Sons"
 PERFORMER "Dream Theater"
 ISRC USEE10500975
 FLAGS DCP
INDEX 00 06:33:67
FILE "07 - Sacrificed Sons.wv" WAVE
INDEX 01 00:00:00
FILE "08 - Octavarium.wv" WAVE
 TRACK 08 AUDIO
 TITLE "Octavarium"
 PERFORMER "Dream Theater"
 ISRC USEE10500976
 FLAGS DCP
INDEX 01 00:00:00

Convert Cue Sheets (single -> multiple file)

Reply #17
message does not appear when I eliminate the "&"
Yes, the "&" is a problem that I know about but haven't addressed.

Second is the message that the system is unable to find C:\...\Temp\~cueconv.tmp

I havent tried debugging, maybe you are faster with this.
I'm not sure what the problem is here.  Perhaps another issue with a character that the batch file doesn't like?
How is %TEMP% defined on your system?  I suppose you could have the program place its working tempfile anywhere.

I've noticed that the outputed multi-track cuesheets are not tabbed/indented the same way as EAC generates them.
This could have something to do with the way the codebox on my post displays spaces.  My batch is set up to indent lines in exactly the same way that EAC indents them.

Code: [Select]
IF %_header% EQU 0 (
  IF "%_x%" == "TRACK" (
    SET _x=  TRACK
  ) ELSE (
    SET _x=    %_x%
  )
)

The "_header" variable being 0 is a flag to tell the script that the header was already written and what follows tells the script how to format lines after the header.

There should be two spaces between "_x=" and "TRACK"
There should be four spaces between "_x=" and "%_x%"

This code hasn't exactly been idiot-proofed.  There is nothing preventing it from processing a CUE that isn't for a single file image, for instance.  I also know that people like to use random numbers in the names of script-generated temp files.  Another thing worth mentioning is that I have it set up to generate track file names the way I like them: "XX - Track.wav".

Thanks for the praise.

Convert Cue Sheets (single -> multiple file)

Reply #18
This could have something to do with the way the codebox on my post displays spaces.  My batch is set up to indent lines in exactly the same way that EAC indents them.

Code: [Select]
IF %_header% EQU 0 (
  IF "%_x%" == "TRACK" (
    SET _x=  TRACK
  ) ELSE (
    SET _x=    %_x%
  )
)

The "_header" variable being 0 is a flag to tell the script that the header was already written and what follows tells the script how to format lines after the header.

There should be two spaces between "_x=" and "TRACK"
There should be four spaces between "_x=" and "%_x%"

This code hasn't exactly been idiot-proofed.  There is nothing preventing it from processing a CUE that isn't for a single file image, for instance.  I also know that people like to use random numbers in the names of script-generated temp files.  Another thing worth mentioning is that I have it set up to generate track file names the way I like them: "XX - Track.wav".

Thanks for the praise.

Yeah, pasting the batch code right from the codebox screws with the spacing. I fixed the spacing in my .bat file and everything was correctly indented in the converted cuesheet. Coincidentally, your naming scheme is the same as mine, so this benefits me greatly! (I just changed the .wav output to .wv) 

Convert Cue Sheets (single -> multiple file)

Reply #19
Modifying the code to create filenames using aritst and/or album data should be pretty easy.

Somewhat off-topic, but...
I have a batch file that converts separate track CUEs into single file CUEs, one that converts cg and lg CUEs into nc CUEs, and one that creates a CUE from information in an EAC log.  Currently they all require the source files to be in wave format...
...not any longer!  I've revamped all of my batch cue converters to support ape and flac with the help of shntool and metaflac.  Any other format that shntool supports (such as WavPack) or has the ability to output the size of a decompressed file (like metaflac does) should also work.

I'm also thinking about creating a cue converter that makes compliant sheets from noncompliant sheets assuming that tracks were ripped with gaps appended.  It will basically stip all 00 indices and reformat.

Convert Cue Sheets (single -> multiple file)

Reply #20
Second is the message that the system is unable to find C:\...\Temp\~cueconv.tmp
I think this issue has been fixed.  If the the source CUE ended in an INDEX 01 line (which most do), the temp file would have already been purged.

I will update the code in post #15 to include this fix and add some idiot-proofing.

Convert Cue Sheets (single -> multiple file)

Reply #21
Update:

Fixed the problem with titles that contain an "&" or any other character that may interfere with the operation of the script.

Link to code

Convert Cue Sheets (single -> multiple file)

Reply #22
More praise:

Just returned to this thread after a while and tested the new code: works like a charm.
The indentation issue of course also affects lines that write "INDEX" or "PREGAP" to the output file.

1k thanks

Convert Cue Sheets (single -> multiple file)

Reply #23
Thanks for the praise and you are very welcome!

I'm not clear as to whether you're having trouble with indentation or not.  The problem has to do with how the code gets copied and pasted from your browser.

My suggestion is to click on the [" REPLY] button on the post with the code and then copy the code from there.  The formatting should be preserved.

Convert Cue Sheets (single -> multiple file)

Reply #24
Cunning - I tried around with copying from the codebox, but of course I missed trick with hitting reply.
So I corrected the number of spaces by hand after experiencing a similar error with Burrrn as ChangFest. Now everything I tested works.

I'm also thinking about creating a cue converter that makes compliant sheets from noncompliant sheets assuming that tracks were ripped with gaps appended.  It will basically stip all 00 indices and reformat.

I would also be interested in this one (foobar still can't handle nc, right?).
Has this batch-file emerged yet? And while we are at it: why don't you publish your other nifty scripts.
I am sure there is more praise to be harvested