REACT:Adding Support For TAK

From Hydrogenaudio Knowledgebase

To configure REACT to use an encoder that is not supported with the original INI and CFG files you will need to make changes to both the INI and CFG file you require.

Below you will find additional text that you will need to add to your config files to use TAK with REACT. This is meant as an example, to demonstrate what is required to add any codec that you choose. The naming schemes and meta data used are based on the examples in the initial INI and CFG files; you may want to change them to fit your methodology.

REACT.ini

Settings

Specify that we want to use TAK as our image format.

ImageExt=tak

UserTrackFormats

Specify that we want to encode tracks using TAK.

Tak=1

UserOutputNames

Specify the directories for TAK images and tracks.

ImageDir_Tak=@OutRoot@\TAK-images\$cdartist$
TrackDir_Tak=@OutRoot@\TAK\$cdartist$\[$year$] $album$

UserSettings

Specify any encoding options and the version used.

Opt_Tak=-pN
Ver_Tak=1.0.1


REACT-image.cfg

REM ** Transfer RG values from Wavgain calculations, instead of recalculation.

Add the text below under the comment above, with the other similar lines.

SET RG_Tak=-t "replaygain_album_gain=%album_gain% dB" -t "replaygain_album_peak=%album_peak%"
SET RG_Tak_acdir=-t $qreplaygain_album_gain=%album_gain% dB$q -t $qreplaygain_album_peak=%album_peak%$q

REM ---- Image ----

Add the text below under the comment above, with the other similar lines. As TAK cannot create tags this section uses takc.exe to encode, and then tag.exe to add APEv2 tags. You will need to add takc.exe and tag.exe to your REACT tools directory.

IF NOT @ImageExt@==tak GOTO end_tak_image
	SET dest="@ImageDir_Tak@"
	IF NOT EXIST %dest% MKDIR %dest%
	IF %embed_cover%==1 SET Cover_tag=--picture="|image/jpeg|||@cover@"
	@tools@\takc.exe -e @Opt_Tak@ "@source@" "@image@"
	@tools@\tag.exe %RG_Tak% -t "%ArtistField%=@cdartist@" -t album="@album@" -t totaltracks="@numtracks@" -t year="@year@" -t genre="@genre@" -t comment="@comment@" -t encodedby="%USERNAME%" -t encodersettings="TAK @Ver_Tak@ @Opt_Tak@" -f cuesheet="@cuesheet@" -f eaclog="@eaclog@" "@image@"
	MOVE /Y "@image@" %dest%
	MOVE /Y "@cuesheet@" %dest%
	IF %have_cover%==1 COPY /Y "@cover@" %dest%\"@basename@.jpg"
:end_tak_image

REM ---- Tracks ----

This section uses ACDIR to create TAK track files. It is complicated by the fact that TAK cannot use STDIN as input or tag itself. This section uses ACDIR to first split the image WAVE into tracks WAVEs, and then uses ACDIR again to execute mutiple commands for each track, these being:

  1. Create a temporary file.
  2. Use tag.exe to add APEv2 tags to the temporary file.
  3. Use takc.exe to encode the track WAVE.
  4. Use tag.exe to copy the APEv2 tags from the temporary file to the TAK file.
  5. Delete the temporary file and WAVE file.

You will need to add takc.exe and tag.exe to your REACT tools directory.

IF NOT @Tak@==1 GOTO end_tak_tracks
	SET dest="@TrackDir_Tak@"
	IF NOT EXIST %dest% MKDIR %dest%
	PUSHD %dest%
		IF @various@==1 SET VA_tag=-t $qalbum artist=@VA@$q
		@tools@\acdir.exe --overwrite --output "%TrackName%.wav" --extract "@sourcecuesheet@"
		@tools@\acdir.exe --exec "ECHO TMP > $q%TrackName%.tmp$q && @tools@\tag.exe --nocheck --ape2 %RG_Tak_acdir% %VA_tag% -t artist=$#a -t album=$#T -t title=$#t -t track=$n/$N -t year=$q@year@$q -t genre=$q@genre@$q -t comment=$q@comment@$q -t encodedby=$q%USERNAME%$q -t encodersettings=$qTAK @Ver_Tak@ @Opt_Tak@$q $q%TrackName%.tmp$q && @tools@\takc.exe -e -overwrite @Opt_Tak@ $q%TrackName%.wav$q $q%TrackName%.tak$q && @tools@\tag.exe --fromfile $q%TrackName%.tmp$q $q%TrackName%.tak$q && DEL $q%TrackName%.tmp$q && DEL $q%TrackName%.wav$q" "@sourcecuesheet@"
		COPY /Y "@eaclog@" "EAClog.txt"
		IF %have_cover%==1 COPY /Y "@cover@" "folder.jpg"
		IF EXIST "@albumfile@.[*].cue" COPY /Y "@albumfile@.[*].cue" .
	POPD
:end_tak_tracks


REACT-track.cfg

REM ============== Begin Main Script ==================

Add the text below under the comment above, with the other similar lines.

SET TrackDir_Tak="@TrackDir_Tak@"

REM ---- Track ----

Add the text below under the comment above, with the other similar lines. As TAK cannot create tags this section uses takc.exe to encode, and then tag.exe to add APEv2 tags. You will need to add takc.exe and tag.exe to your REACT tools directory.

IF NOT @Tak@==1 GOTO end_tak_tracks
	IF NOT EXIST %TrackDir_Tak% MKDIR %TrackDir_Tak%
	PUSHD %TrackDir_Tak%
		IF @various@==1 SET VA_tag=-t "album artist=@VA@"
		ECHO ON
		@tools@\takc.exe -e -overwrite @Opt_Tak@ "@source@" "%TrackName%.tak"
		@tools@\tag.exe %VA_tag% -t artist="@artist@" -t album="@album@" -t track="@track@/@numtracks@" -t title="@title@" -t year="@year@" -t genre="@genre@" -t comment="@comment@" -t encodedby="%USERNAME%" -t encodersettings="TAK @Ver_Tak@ @Opt_Tak@" "%TrackName%.tak"
		@ECHO OFF
		IF %have_cover%==1 IF NOT EXIST folder.jpg COPY "@cover@" folder.jpg
		TITLE @track@/@numtracks@ - "@album@"
	POPD
:end_tak_tracks