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: EAC+MAC+TAG+PAR2 (Read 65323 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

EAC+MAC+TAG+PAR2

OK, heres the plan.

1. I want EAC to convert a CD to one APE file, with accompanying cuesheet file
2. I want to add the cuesheet to the APE file using the APEv2 tag CUESHEET
3. I want to create PAR2 files for the APE file.

I want to do these with one click of the mouse.

I can do (1.) on its own, no problem.  However, by introducing the other steps I suspect I will have to come away from the internal Monkeys Audio support, and use the external encoder.

At the moment I am thinking I can achive this with MAREO, MAC, TAG , and PAR2CMDLINE.

However, it doesn't appear that TAG.EXE can get fieled values from a text file.  I can copy tags from another audio file - but that's no use.

Does anyone have any suggestions for a replacement for TAG.EXE - which will allow me to simply create the APEv2 tag "CUESHEET" - passing the path to a CUE file as the paremeter, rather than an absolute value?  Would foobar do this from the command line?

Any other improvements to my way of thinking?

I have posted to a thread regarding the development of MAREO 2 asking whether MAREO could cope with the problem, by getting text from an external file to be used as an internal variable.

Any other ideas?  This really doesn't seem that difficult.  If no-one can suggest how I can do it using existing tools I guess I will be forced to create something myself - but I firmly believe in not re-inventing the wheel.

Disclaimer: I thought this was the best place to post as it does regard "Audio Compression" - and you can't post to a general "Audio Compression" forum.
I'm on a horse.

EAC+MAC+TAG+PAR2

Reply #1
OK, I guess that's a "no" then.

FYI:  As per link above, I have been hassling kwanbis about the possibility of getting MAREO to load the cuesheet into a variable to pass to TAG.  Due to the general inability to pass CRLF in a command line parameter this is a no-goer.  Apologies to kwanbis for wasting his time.

Not to be deterred I have now contacted Case, to see whether he would entertain the possibility of adding the functionality to TAG, e.g:

; Use -f switch to set tag value using text from external file
TAG.EXE -f "CUESHEET=C:\CDImage.ape.cue"

As you can't pass CRLF to a command line I don't think I can programme around this, as I first hoped.  The only way to get this sorted is to get a tagging application that will accept the cue file as a command line parameter.  I am not skilled enough to write one unfortunately, and I can't find a tagging COM object that I could integrate into a VB app.

I am trying to resolve this mainly for my own ends - but I was also expecting that other people would find this useful.  I have seen many posts about using embedded cuesheets in foobar, and assumed that this solution would interest a lot of people.

Would anyone use this same set-up if it was available?  If you take a look at the  MAREO 2 thread you'll see a few other examples that I suggested that this could be used for - I'm sure you can come up with a load more.

If no-one else is interested I may stop hassling people, although it is kinda fun.

[edit]
Thinking about it, I guess people maybe use Matroska for maintaining a collection, and therefore wouldn't use this fucntionality.

Personally, I don't want to introduce yet another element into the equation, when all I want is the image and cuesheet so I can burn back to CD.  Matroska seems like overkill for my needs.
[/edit]
I'm on a horse.

EAC+MAC+TAG+PAR2

Reply #2
I got a response from Case today:

Quote
I don't have any plans to work on Tag anymore, I use it only
occasionally nowadays and its features are enough for my needs.

... so I guess that's the end of my little plan.
I'm on a horse.

EAC+MAC+TAG+PAR2

Reply #3
I believe the source code is available for tag.  Maybe someone else could take a look at it.
"You can fight without ever winning, but never win without a fight."  Neil Peart  'Resist'

EAC+MAC+TAG+PAR2

Reply #4
Quote
I believe the source code is available for tag.  Maybe someone else could take a look at it.
[a href="index.php?act=findpost&pid=235145"][{POST_SNAPBACK}][/a]

If anybody does consider working on Tag would you please also think about adding OptimFrog support.  I think it should be a very minor change:  It can already write APEv2 tags to these files without any problems, but because it doesn't recognise the .ofr and .ofs file extensions you have to use the --nocheck option which is a bit of a pain.  Especially when viewing tags using Speek's Tag Frontend which doesn't allow you to add command line options when clicking View.  So I think it just needs to be modified to recognise these file types.

Thanks, and sorry for going a little off-topic.

EAC+MAC+TAG+PAR2

Reply #5
Quote
I believe the source code is available for tag.  Maybe someone else could take a look at it.
[{POST_SNAPBACK}][/a]

Source here:
[a href="http://www.saunalahti.fi/cse/files/]http://www.saunalahti.fi/cse/files/[/url]
"ONLY THOSE WHO ATTEMPT THE IMPOSSIBLE WILL ACHIEVE THE ABSURD"
        - Oceania Association of Autonomous Astronauts

EAC+MAC+TAG+PAR2

Reply #6
I am no C++ programmer, only VB I'm afraid - but I have spent time today playing with the sources of both TAG and WAPET, and I think a competent coder could achieve it all in an hour or two.

I think I made some headway on file loading - 70% there (I can load a file, but don't really know what to do with it then!) - and I also made some changes that I think would solve the OptimFrog problem (although I may be widly optimistic there).  I also see from the code that the default for APE files is to use APEv1 tags, so I decided to amend the "--ape2" tag so you can override to APEv2 for any file type (rightly or wrongly), and not just MusePack files.

The problem is, I was doing this at work using Visual Studio.NET, and I never managed to compile the thing properly (I was testing my file access using WAPET's source which is much simpler).  I have just installed Visual C++ 6 on my machine at home, and I'm hoping to have better luck here.

I'm not saying that I can do this, but I'm going to give it a try.  If any proper C++ programmer wants to take pity on me please feel free to beat me to it!  It is going to take me some time.

Additional requirements thus far seem to be:
  • The ability to set a tag value from an external text file.  I am suggesting the format -f "<tag>=<filepath>" (as opposed to -t "<tag>=<value>")
  • Proper recognition of OptimFrog files
  • The ability to force other formats to use APEv2, not just Musepack
I think it would be great if we could extend TAG - it seems so many people find it useful it would be nice to improve it further.

[edit] RE: (3.) - I see there is the "--force <tag>" switch, but I see no reason to make things easy and implement the --ape2 change also. [/edit]
I'm on a horse.

EAC+MAC+TAG+PAR2

Reply #7
When I try compiling I am getting:

Code: [Select]
--------------------Configuration: libFLAC_static - Win32 Release--------------------
Performing Custom Build Step on ..\..\include\FLAC\ordinals.h.in
The system cannot find the file specified.
Error executing c:\winnt\system32\cmd.exe.

all - 1 error(s), 0 warning(s)

Any ideas?

This is tricky.  Took me a while to find out about NASM and get that setup, now this... my head hurts.  Once I can compile I can try making changes and testing.
I'm on a horse.

EAC+MAC+TAG+PAR2

Reply #8
Thanks for the effort you are putting in.  It's great to have somebody working on Tag.  Unfortunately I know nothing about C++ either so can't answer your questions.  Lets hope somebody with those skills spots this topic.

EAC+MAC+TAG+PAR2

Reply #9
Quote
Thanks for the effort you are putting in.  It's great to have somebody working on Tag.  Unfortunately I know nothing about C++ either so can't answer your questions.  Lets hope somebody with those skills spots this topic.
[a href="index.php?act=findpost&pid=235358"][{POST_SNAPBACK}][/a]

Indeed.  I am very happy to attempt to resolve this, but it would be so much better if a competent developer would take up the baton.  Although my changes thus far have been very minor I am still a little concerned about putting out an EXE, when I am working in the dark.  I don't want to taint Case's hard work.  Obviously I will test before I post any files.

I have made all code changes now for (2.) & (3.) - if I can get the FLAC code to compile I can create an EXE and test.  Once I can test I will then work on (1.) - there's just no point yet.  It's so frustrating being held up not by a coding problem, but by the compile process!
I'm on a horse.

EAC+MAC+TAG+PAR2

Reply #10
Quote
When I try compiling I am getting:

Code: [Select]
--------------------Configuration: libFLAC_static - Win32 Release--------------------<!--QuoteEBegin-->Performing Custom Build Step on ..\..\include\FLAC\ordinals.h.in<!--QuoteEBegin-->The system cannot find the file specified.<!--QuoteEBegin-->Error executing c:\winnt\system32\cmd.exe.<!--QuoteEBegin--><!--QuoteEBegin-->all - 1 error(s), 0 warning(s)<!--QuoteEBegin-->

Any ideas?[a href="index.php?act=findpost&pid=235351"][{POST_SNAPBACK}][/a]

You didn't mention whether this is the VS2003 or VS6 version, but assuming it is the VS2003 version, then choose "Project->Properties->Common Properties->Build Events" and then edit the Pre- or Post- build event command line and correct the path. 

It looks like maybe you are running a version of windows that is not installed in c:\winnt -- for instance XP is installed in C:\Windows, so it may be as simple as correcting that path.

If you're not using VS2003, then the process should be similar -- I haven't used VS6 in a couple of years so I don't remember where the custom build events live.

If you can find the custom build event in question and still can't figure out what's wrong, paste it in here and I'll help you.

-- Rick
------- Rick -------
--------------------

EAC+MAC+TAG+PAR2

Reply #11
Thanks for your suggestion Rick, but I think I'm past that hurdle now - although it always seems to be a bit hit'n'miss.  It seems to be something to do with \flac-1.1.0\include\FLAC\ordinals.h disappearing, or being deleted.  I just copy it back in from the original source and the error stops.  I have successfully compiled the FLAC libs as a separate project.

NB: I am now using VS6SP6, Win2K - both at home and at work.

I am currently stuck on this one:

Code: [Select]
--------------------Configuration: Tag - Win32 Debug--------------------
Linking...
LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of other libs; use /NODEFAULTLIB:library
libcpd.lib(xlocale.obj) : error LNK2001: unresolved external symbol _errno
libcpd.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol _errno
libcpd.lib(locale.obj) : error LNK2001: unresolved external symbol _errno
libcpd.lib(xwctomb.obj) : error LNK2001: unresolved external symbol _errno
libcpd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol _errno
libcpd.lib(wlocale.obj) : error LNK2001: unresolved external symbol _errno
Debug/Tag.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Tag.exe - 7 error(s), 1 warning(s)

It seems to be something to do with the fact that the seven projects involved (id3lib (MLd), libFLAC_static (MDd), ogg_static (MTd), tag (MDd), vorbis_static (MTd), vorbisfile_static (MTd), and zlib (MTd)) all have different threading models (indicated in brackets), and are causing shared library conflicts.  Are all C++workspaces so difficult?!

I have tried the /NODEFAULTLIB:LIBCMTD switch, as the error suggests, but I just get even more complaints about LIBCPD then (25 I think).  I have also tried setting all projects to the same threading model but that didn't help.

I'm beginning to lose heart. 
I'm on a horse.

EAC+MAC+TAG+PAR2

Reply #12
Hmm...LIBCMTD means C-library, multi-threaded, debug.  I thought _errno was defined in msvcrt (MS Visual C Run Time), but it's been a long time.  You're creating an exe file... I can see I'm not going to be much help for you here, but I have a few more comments.  I'm pretty sure you can link single and multi-thread libraries into a single process.  What you can't do is link together static and dynamic libraries.  I see that most of your included libs are static...  Are you defining _STATIC_CPPLIB?  Have you tried compiling with MLd or MDd?
------- Rick -------
--------------------

EAC+MAC+TAG+PAR2

Reply #13
It did turn out to be because the projects were all using different threading models.  I changed them all to Multithread DLL,  ignored the "libcd" library, and it compiled!

This morning I had the added (minor) hurdle of getting UPX to compress the EXE, but I am proud to say I have finally built version 2.0.40b1!

As per change log:

To come:
(+) The ability to set a tag from the contents of an external text file (-f switch)

Version 2.0.40b1: (amendments by Neil Popham <neilpopham@bigfoot.com>)
(+) Added direct support for Optimfrog files (recognition of file extension, etc.)
(*) Amended --ape2 option to override to APEv2 format on any file, not just MusePack


phwip, I have tested writing, removing and listing OptimFrog tags and it all seems fine.

These changes are very minor.  I haven't made any scary additions as yet - that will be Beta2 with the bit I really want - tag values from text files.  What I'm saying is, the usual disclaimer applies here - I hold no responsibility if I bugger up your machine - but with this version the changes are so aesthetic (both the original and my EXE are 184KB) that the bug factor is miniscule.

If you use OptimFrog, you may want to download this version (before I go buggering around with it any more).

Thanks to everyone who posted on this thread so far, as you gave me the added incentive to pursue this.

Hopefully Beta2 will be around in a week or so.  Using the wapet source I have successfully managed to set a tag using the contents of a file, but at the moment the file has to have the "<tag>=" bit in it as well.  Once I've worked out how to concatenate and substring two seemingly very different variables I should just about be there (although the tag command line handling is different to wapet).

[edit]editted url, as Wanadoo doesn't think "-" is a valid character...[/edit]

[span style='font-size:8pt;line-height:100%']Edit 2005-01-13: Updated URL to blueyonder address[/span]
I'm on a horse.

EAC+MAC+TAG+PAR2

Reply #14
I have added the file loading bit as well now.

It only took me another hour or two to complete the code in Wapet and then adapt to Tag... so here it is.

Beta 1 and Beta 2 can be found here http://www.neilpopham.pwp.blueyonder.co.uk.

I just hope that someone else gets some use out of them.

If you do use it I would appreciate an email just to let me know that you've found it useful.

Maybe I can get a good night's sleep now... this has been plaguing me for the past week or two, and I've gone a bit schitz.

[edit]changed stuff and added things[/edit]

[span style='font-size:8pt;line-height:100%']Edit 2005-01-13: Updated URL to blueyonder address[/span]
I'm on a horse.

EAC+MAC+TAG+PAR2

Reply #15
Wow! That's a great effort, Synthetic Soul! Thanks alot!!!
Now, can anybodey make a short how-to for creating EAC-APE image with embedded CUE & LOG +PAR2? 
Ple-ease

EAC+MAC+TAG+PAR2

Reply #16
aSceT, thanks for the positive response.

I guess I could do that.

It seems quite a fitting end to this thread...
I'm on a horse.

EAC+MAC+TAG+PAR2

Reply #17
Had a quick try last night.

I must say I found it quite hard working with mareo, mainly due to running two applications (TAG and PAR2) that don't create another file - but also as some of the variables don't seem intuative (e.g.: "@pathonly@\@nameonly@.ape" seems a bit of a workaround).  However, I did get it eventually to create the ape file, set the tag from the cuesheet, and then create par2 files.

I ended up with these action lines - perhaps someone can improve them:

Code: [Select]
ape NONE NONE "C:\Program Files\Monkey's Audio\MAC.EXE" "@source@" "@dest@" -C4000
NONE NONE NONE "TAG.EXE" --artist "@artist@" --album "@cdname@" -f "CUESHEET=@pathonly@\CDImage.ape.cue" "@pathonly@\@nameonly@.ape"
NONE NONE NONE "PAR2.EXE" create -s204800 -r10 "@pathonly@\CDImage.ape" "@pathonly@\@nameonly@.ape"

I don't think you can add the EAC log using this set up - as the log is created once mareo exits and returns control to EAC.

Maybe mareo, or a program like mareo, could open a new process just before it closed itself, to undertake any post-processing steps, i.e.:
  • mareo completes last processing step
  • mareo opens new instance and closes itself
  • EAC regains control and writes log
  • new instance runs any post-processing steps, e.g.: checking for log and adding as APEv2tag
Who knows...

I may be wrong about the log - I've never created one before last night.

The process is probably a little easier using Wapet - which I have amended to use the -f switch, as with Tag.  I should be posting that on the website tonight, along with tag 2.0.40b4 maybe - following some very helpful advice from Niko Korhonen - a competent C++ programmer no less.

I guess then I/we could just use:

Code: [Select]
APE NONE NONE "WAPET.EXE" "@dest@" -t "ARTIST=@artist@" -t "ALBUM=@cdname@" -f "CUESHEET=@pathonly@\CDImage.ape.cue" "C:\Program Files\Monkey's Audio\MAC.EXE" "@source@" "@dest@" -C4000
NONE NONE NONE "PAR2.EXE" create -s204800 -r10 "@pathonly@\CDImage.ape" "@pathonly@\@nameonly@.ape"

[span style='font-size:8pt;line-height:100%']Edit: modified second mareo example.[/span]

[span style='font-size:8pt;line-height:100%']Edit 2005-01-13: Updated URL to blueyonder address[/span]
I'm on a horse.

EAC+MAC+TAG+PAR2

Reply #18
I worked out last night that the above won't work.

Basically, until mareo completes all tasks, the file will be named using its EAC-allocated temporary name ("<temp>.ape").

I need the final name (in this example "CDImage.ape") for PAR2.  The action lines above do work, but when you go to verify the PAR2 files it complains - as it is looking for "<temp>.ape", not "CDImage.ape".  You could always rename "CDImage.ape" to "<temp>.ape" - and QuickPar seems like it is clever enough to point this out - but that's not good enough for me.  If I'm going to have two steps there's a lot easier ways.

I have tried so many ways to try to fool EAC and/or mareo, but nothing works.  If I get MAC to encode to "CDImage.ape", and not "<temp>.ape", the PAR2 process will work - but then either mareo or EAC deletes the ape file!

It seems to me the only way to execute such commands is to use the post-processing method described above.  I have done a few tests using batch files, and it looks like that will be possible, using this process:
  • EAC uses CMD.EXE as the encoder EXE
  • in the command line I add "/c C:\DOS\encode.bat" along with the EAC params (%s, etc.)
  • encode.bat runs MAC.EXE
  • encode.bat calls post.bat in a new window, passing it the EAC parameters
  • encode.bat
    • completes, and closes
    • EAC renames "<temp>.ape" to "CDImage.ape"
    • EAC writes its log file
  • post.bat
    • waits for "CDImage.ape"
    • runs PAR2.EXE
    • adds cuesheet using TAG.EXE
    • (waits for EAC log
    • adds log to COMMENT tag using TAG.EXE)
Obviously (5.) and (6.) run simultaneously.

Does anyone know a better way?

Unfortunately this method will work for this scenario, but will be more complicated to adapt for other uses.  I would have like to produce a setup that others could easily adapt for their purpose.  I have considered writing an app to do this, that parses one ini file for processing, and then opens another app to parse a post-processing ini file.  This would be much more user-friendly.  Unfortunately I have too little time at the moment, with my second daugther due imminently.
I'm on a horse.

EAC+MAC+TAG+PAR2

Reply #19
Last night I successfully converted a CD to APE, with CUESHEET tag, and accompanying PAR2 files, using an automated process.

Hopefully tonight (8:00 UK time) I will get to post my guide to http://www.neilpopham.pwp.blueyonder.co.uk/.

I say hopefully as it's possible my wife has begun labour...

[span style='font-size:8pt;line-height:100%']Edit 2005-01-13: Updated URL to blueyonder address[/span]
I'm on a horse.


EAC+MAC+TAG+PAR2

Reply #21
Groundbreaking work, Synthetic Soul, lots and lots of thanks!!!
Just one small question: what about GENRE tag? When you have CUE embedded in APE, you don't really need ALBUM and ARTIST tags, since this info is already written within CUE, but genre is really needed (at least for me) 
There's a genre flag in EAC, wich could be used with external compressors: %m
I tried to add it to eac-enc.bat but failed...
And one more question, about verification. If i don't need the LOG of verification process, then i could just use -v swich in addition to encoding parametres in eac-enc.bat? Something like thet would work:
Code: [Select]
%pathToMac% %2 %3 -t "Genre=%m" -C4000 -v
?

EAC+MAC+TAG+PAR2

Reply #22
Quote
Just one small question: what about GENRE tag? When you have CUE embedded in APE, you don't really need ALBUM and ARTIST tags, since this info is already written within CUE, but genre is really needed (at least for me) 
There's a genre flag in EAC, wich could be used with external compressors: %m
I tried to add it to eac-enc.bat but failed...

The Artist and Album aren't necessarily included in the cuesheet - it depends on your EAC settings.

As a result of your enquiry, I have added an example, Add the Album Genre as a Tag, to the site.

However, for ease, I would suggest downloading these updated batch files and using them with the EAC command line options:

[span style='font-size:10pt;line-height:100%']/c C:\dos\eac-enc.bat %o  %s  %d  "%a"  "%g" "%m" %hHIGH%h[/span]

These batch files:
  • Add the genre tag (as well as Artist and Album)

  • Let you select High or low quality from EAC (to compress at Extra High or Normal compression)

  • Verify the ape file after TAG and PAR2 have executed

  • Delete the cuesheet after it's been added as a tag
If this just confuses things further go with the website explanation to add the genre tag.  Please re-download the batch files though, as I have made minor amends* (otherwise the example won't make total sense).

If you really don't want the Artist and Album tags remove the text [span style='font-size:10pt;line-height:100%']--artist %4 --album %5[/span] from the TAG line in eac-post.bat

Quote
And one more question, about verification. If i don't need the LOG of verification process, then i could just use -v swich in addition to encoding parametres in eac-enc.bat? Something like thet would work:
Code: [Select]
%pathToMac% %2 %3 -t "Genre=%m" -C4000 -v
?

You can't verify and compress at the same time unfortunately.  That said, I think it is better to verify once all other actions have completed anyway, to ensure that none of them have corrupted the file.

Take a look at the alternative batch files to see how I implemented it.

[span style='font-size:8pt;line-height:100%']* I discovered that I don't need to pass the variables pathToMac, pathToTag and pathToPar2 from eac-enc.bat to eac-post.bat as parameters %6, %7 and %8.
eac.post.bat can reference them directly - so it now refers to %pathToTag%, rather than %7[/span]

[span style='font-size:8pt;line-height:100%']Edit 2005-01-13: Updated URL to blueyonder address[/span]
I'm on a horse.

EAC+MAC+TAG+PAR2

Reply #23
There's a small problem occured, while testing. The Album name was "Ambient 1: Music for Airports". When eac-post.bat starts, it waits for LOG:
Quote
Waiting for "Ambient 1: Music for Airports.log" to be created...

But filenames in Windows can't be with ":", so EAC creates "Ambient 1  Music For Airports.log"

EAC+MAC+TAG+PAR2

Reply #24
Working flawlessly here in WinXP environment.    I successfully added GENRE and YEAR tags by inserting the following command line in EAC:

Code: [Select]
/c C:\Batchfiles\eac-enc.bat %o  %s  %d  "%a"  "%g" "%m"  "%y"


and slightly modifying accordingly Synthetic Soul's batchfiles:

Code: [Select]
REM ===================
REM  Parameter mapping
REM ===================
REM  %o  %s  %d  "%a"  "%g"  "%m"  "%y"
REM  %1  %2  %3   %4    %5    %6    %7"


Code: [Select]
ECHO EAC-ENC.BAT
ECHO ===========
ECHO.
ECHO Original    (o) : %1
ECHO Source      (s) : %2
ECHO Destination (d) : %3
ECHO CD Artist   (a) : %4
ECHO CD Title    (g) : %5
ECHO CD Genre    (m) : %6
ECHO CD Year     (y) : %7
ECHO.
ECHO MAC.EXE         : %pathToMac%
ECHO TAG.EXE         : %pathToTag%
ECHO PAR2.EXE        : %pathToPar2%



... and so on, same thing for eac-post.bat


APE 2.0 tags are correctly created and fully integrated in Foobar v.0.83.
What could be the procedure for inserting a COMMENT Tag?
And, I am absolutely no programmer / compiler etc... but I hope to have soon FLAC and/or WAVPACK versions of this pattern!! 

Thank you very much, Synthetic Soul