Skip to main content
Topic: APE to WAVPACK with CUE embedded (Read 10280 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

APE to WAVPACK with CUE embedded

Hi, I try to setup a script to convert from ape to wavpack (high asymmetric, no tagging) with cue embedded. Someone suggest me this:

Quote
rem APE2WV
@echo off
set path=%PATH%;%~dp0
mac %1 - -d -|wavpack -mhx3 - "%~dpn1.wv"
echo.
PAUSE


However I obtain the wavpack but without the cue. Can someone help me? How can I do the same from flac and wavpack fast/normal?

Thanks a lot

APE to WAVPACK with CUE embedded

Reply #1
As far as I understand you need an extra step: use Tag.exe with its --fromfile switch.

TAG.EXE --fromfile %1 "%~dpn1.wv"

... or:

FLAC --decode --stdout %1 | wavpack -mhx3 - "%~dpn1.wv"
TAG.EXE --fromfile %1 "%~dpn1.wv"
I'm on a horse.

APE to WAVPACK with CUE embedded

Reply #2
I need to convert an ape+cue separeted file in one wavpack with cue embedded file. I have try this:
Quote
rem APE2WV
@echo off
set path=%PATH%;%~dp0
mac %1 - -d -|wavpack -mhx3 - "%~dpn1.wv"
tag.exe --fromfile %1 "%~dpn1.wv"
echo.
PAUSE

But don't works. I obtain the wv but without cue.

APE to WAVPACK with CUE embedded

Reply #3
Don't know if this helps or not. 

The Command Line Option for EAC when making a WavPack file with embedded cuesheet is:

Code: [Select]
-hlm -w "Cuesheet=@*.cue" -w "Album=%g" -w "Year=%y" -w "Genre=%m" %s


So, you might want to figure in an option that writes the cuesheet to the wavpack file...or maybe you did that already...not a coding genius here.

- Gow
Zune 80, Tak -p4 audio library, Lossless=Choice

APE to WAVPACK with CUE embedded

Reply #4
I need to convert an ape+cue separeted file in one wavpack with cue embedded file.
As Gow says, you will need to use WavPack's -w "Cuesheet=@*.cue" switch to embed an external cuesheet, e.g.:

mac %1 - -d -|wavpack -mhx3 -w "Cuesheet=@*.cue" - "%~dpn1.wv"

If you use that format there can only be one cuesheet in the folder.  You may be able to specify the cuesheet name, e.g.:

mac %1 - -d -|wavpack -mhx3 -w "Cuesheet=@%~dpn1.wv.cue" - "%~dpn1.wv"

How did you get on with the embedded cuesheet files?
I'm on a horse.

APE to WAVPACK with CUE embedded

Reply #5
Playing around with foobar2000 9.2, I discovered you can make FLAC w/ embedded cuesheet and Monkey's Audio w/ embedded cuesheet.  Just an FYI.
Zune 80, Tak -p4 audio library, Lossless=Choice

APE to WAVPACK with CUE embedded

Reply #6
Yes, as a manual process it is easy to embed a cuesheet using foobar.

However, I think it is difficult to convert files with embedded cuesheets, as foobar will split the file into tracks upon loading.  I think it's easier to stick to the command line for that (or perhaps dbPowerAmp, but I don't use it).
I'm on a horse.

APE to WAVPACK with CUE embedded

Reply #7
Thanks Synthetic Soul, Thanks Gow, now all wotks perfect. I use this:

mac %1 - -d -|wavpack -mhx3 -w "Cuesheet=@%~dpn1.cue" - "%~dpn1.wv"

I obtain cue embedded and metadata (title, artist, trak title). I'm not interested in metadata, but there is no problem. I can open the file in foobar, select all traks, properties, remove all metadata. Only another question, for flac file I can change with:

flac -d -c %1 - |wavpack -mhx3 -w "Cuesheet=@%~dpn1.cue" - "%~dpn1.wv"

And for recompress wavpack files from fast to high mode?

APE to WAVPACK with CUE embedded

Reply #8
FLAC --decode --stdout %1 | WAVPACK -mhx3 -w "Cuesheet=@%~dpn1.cue" - "%~dpn1.wv"

WVUNPACK %1 - | WAVPACK -mhx3 -w "Cuesheet=@%~dpn1.cue" - "%~dpn1_h.wv"


If you wanted it to be a little more clever your batch file could possibly (I'm not sure the results you'd get when piping) check the return from WVUNPACK to ensure that it was successful, delete the source, and then rename the new file (REN "%~dpn1_h.wv" "%~n1.wv").

Edit: Corrected "n1.wv" to "%~n1.wv"
I'm on a horse.

APE to WAVPACK with CUE embedded

Reply #9
I have try to add your strig, but nothing appen. There is no problem, I can do some manual work. But if conversion ends successfully can I be sure that no errors occured? A last question, how can I check if burn process works good using MD5 hash?

APE to WAVPACK with CUE embedded

Reply #10
I have try to add your strig, but nothing appen. There is no problem, I can do some manual work.
Without seeing all your code or knowing what you are doing I can't comment.

But if conversion ends successfully can I be sure that no errors occured?
I don't believe that you can; you need to check the exit code is 0 to be sure, I think.  I may well be wrong.

A last question, how can I check if burn process works good using MD5 hash?
Create an MD5 file of all the files you are about to burn (burn it to the disc as well), and then check the files against the MD5 file after burning?  I tend to use QuickSFV a lot of the time for creating and checking MD5 digests.
I'm on a horse.

APE to WAVPACK with CUE embedded

Reply #11
I haven't reread it thoroughly, but I just dug up one of my previous posts that may help you some more.
I'm on a horse.

APE to WAVPACK with CUE embedded

Reply #12
I have used this code:
Quote
rem APE2WV
@echo off
set path=%PATH%;%~dp0
mac %1 - -d -|wavpack -mfx5 -w "Cuesheet=@%~dpn1.cue" - "%~dpn1.wv"
REN "%~dpn1_h.wv" "n1.wv"
echo.
PAUSE

I obtain:

original md5 signature: xxxxxx
created cdimage.wv in xxx secs
succsess
impossible find specified file

APE to WAVPACK with CUE embedded

Reply #13
Ah, that's because you are not creating "<name>_h.wv" with that script.

I suggested the REN statement to go along with the WavPack to WavPack conversion:

WVUNPACK %1 - | WAVPACK -mhx3 -w "Cuesheet=@%~dpn1.cue" - "%~dpn1_h.wv"

As you are converting from one WV file to another you need to amend the destination filename (otherwise you are trying to overwrite the source while you are reading it).  In the code above I append "_h" to the destination's filename.

Therefore:

REN "%~dpn1_h.wv" "%~n1.wv"

... renames "<name>_h.wv" to "<name>.wv".


My idea was that you would check that the operation worked successfully, delete the source, and then rename the destination, e.g.:

WVUNPACK %1 - | WAVPACK -mhx3 -w "Cuesheet=@%~dpn1.cue" - "%~dpn1_h.wv"
IF %ERRORLEVEL% EQU 0 (
DEL %1
REN "%~dpn1_h.wv" "%~n1.wv"
)


... or something like that...

Edit: Corrected "n1.wv" to "%~n1.wv"
I'm on a horse.

APE to WAVPACK with CUE embedded

Reply #14
So I must create the wv file from ape or flac. Then recompress to check it! I have try this two script:
Quote
rem APE2WV
@echo off
set path=%PATH%;%~dp0
WVUNPACK %1 - | WAVPACK -mfx5 -w "Cuesheet=@%~dpn1.cue" - "%~dpn1_h.wv"
IF %ERRORLEVEL% EQU 0 (DEL %1 REN "%~dpn1_h.wv" "n1.wv")
echo.
PAUSE

rem APE2WV
@echo off
set path=%PATH%;%~dp0
WVUNPACK %1 - | WAVPACK -mfx5 -w "Cuesheet=@%~dpn1.cue" - "%~dpn1_h.wv"
IF %ERRORLEVEL% EQU 0
DEL %1
REN "%~dpn1_h.wv" "n1.wv"
echo.
PAUSE


But nothing (thanks for patience  )

APE to WAVPACK with CUE embedded

Reply #15
The first one will fail as you have two commands on one line ((DEL %1 REN "%~dpn1_h.wv" "n1.wv")).

The second fails as you have no brackets to denote a group of commands.

Also, I wrongly used "n1.wv", when I meant "%~n1.wv".

Try:

rem WV2WV
@echo off
set path=%PATH%;%~dp0
WVUNPACK %1 - | WAVPACK -mfx5 -w "Cuesheet=@%~dpn1.cue" - "%~dpn1_h.wv"
IF %ERRORLEVEL% EQU 0 (
DEL %1
REN "%~dpn1_h.wv" "%~n1.wv"
)
echo.
PAUSE
I'm on a horse.

APE to WAVPACK with CUE embedded

Reply #16
Now works great!!! I have created this batch:
Quote
rem APE2WV
@echo off
set path=%PATH%;%~dp0
mac %1 - -d -| WAVPACK -mfx5 -w "Cuesheet=@%~dpn1.cue" - "%~dpn1_h.wv"
IF %ERRORLEVEL% EQU 0 (
DEL %1
REN "%~dpn1_h.wv" "%~n1.wv"
)
echo.
PAUSE

So now I can convert my files in one step and I can be sure that the new file is no corrupted. Thanks so much Synthetic Soul, you are a genius!!!
Do you know if there is a similar way to check mp3 obtained from these lossless files?

(Sorry for the OT)

APE to WAVPACK with CUE embedded

Reply #17
You still don't seem to get the requirement for the DEL and REN statements.

If you are converting from APE to WV they are unrequired.  It is only if you are converting from WV to WV that you need to worry about renaming, deleting and renaming again.

In the example quoted you could just use:

rem APE2WV
@echo off
set path=%PATH%;%~dp0
mac %1 - -d | WAVPACK -mfx5 -w "Cuesheet=@%~dpn1.cue" - "%~dpn1.wv"
echo.
PAUSE


RE: MP3s, most command line applications will return 0 if successful, and a non-zero value if unsuccessful, so you can generally use %ERRORLEVEL% to check whether the application has exited sucessfully.
I'm on a horse.

APE to WAVPACK with CUE embedded

Reply #18
In effect the dos window don't say nothing more, but I have find the ape deleted and the CDimage.wv file, so I have thinked that the script was ok.
Sorry but my english is really poor, I can use the cheking function only from wv to wv conversion? For ape and flac I don't need them or I need to convert from ape to wv to wv (for cheking)?

APE to WAVPACK with CUE embedded

Reply #19
Yes, that is true: if you want to always delete the source then checking the error level and using the DEL statement would be required.

I'm not actually convinced what return code you are getting when piping; is it the return code of the application decoding, or encoding?

The safest way may be to decode to WAV, check the error code of the decoding app, and then only encode if it is 0, e.g.:

Code: [Select]
REM Decode to WAVE
WVUNPACK %1 "%~dpn1.wav"

REM If the return code is 0 encode, otherwise report the error
IF %ERRORLEVEL% EQU 0 (
  WAVPACK -mfx5 -w "Cuesheet=@%~dpn1.cue" "%~dpn1.wav" "%~dpn1.wv"
  IF %ERRORLEVEL% EQU 0 (
    REM Delete source and temporary WAVE
    DEL %1
    DEL "%~dpn1.wav"
    ECHO Successful conversion
  ) ELSE (
    ECHO Problem encoding
  )
) ELSE (
  ECHO Problem decoding
)


I don't know, I think I'm just confusing the issue now.

NB: With the code above you would just edit line 2 to decode from another format.
I'm on a horse.

APE to WAVPACK with CUE embedded

Reply #20
The idea is great, but when I try to drag a wv file a dos window open and immediatly close

APE to WAVPACK with CUE embedded

Reply #21
It worked fine for me,  if I removed the cuesheet switch (as I don't have a cuesheet to test with).

However, I realised that WavPack will be trying to overwrite the source file, so here's an update:

Code: [Select]
@ECHO OFF

REM Decode to WAVE
WVUNPACK %1 "%~dpn1.wav"

REM If the return code is 0 encode, otherwise report the error
IF %ERRORLEVEL% EQU 0 (
  WAVPACK -dymfx5  -w "Cuesheet=@%~dpn1.cue" "%~dpn1.wav" "%~dpn1.wv"
  IF %ERRORLEVEL% EQU 0 (
    ECHO Successful conversion
  ) ELSE (
    ECHO Problem encoding
  )
) ELSE (
  ECHO Problem decoding
)

PAUSE


With the above code WavPack will delete the source WAV (-d switch) and overwrite the source WV (-y switch).
I'm on a horse.

APE to WAVPACK with CUE embedded

Reply #22
I have created a shortcut to the batch and works perfectly!  First decompress to wav, then recompress to wavpack and finally delete the wav file. Only a question: for decode from ape and flac I must edit "WVUNPACK %1" with "mac %1 - -d" and "flac -d -c %1"?

APE to WAVPACK with CUE embedded

Reply #23
Only a question: for decode from ape and flac I must edit "WVUNPACK %1" with "mac %1 - -d" and "flac -d -c %1"?
Remember, you are decompressing to WAVE now.

MAC %1 "%~dpn1.wav" -d

FLAC -d %1

... should do it.
I'm on a horse.

APE to WAVPACK with CUE embedded

Reply #24
OK Synthetic Soul, now works good! Thanks a lot  This script is very useful to convert quick and safetly my music collection for archive them.

 
SimplePortal 1.0.0 RC1 © 2008-2019