REACT:Adding Support For Monkey's Audio

From Hydrogenaudio Knowledgebase
Jump to: navigation, search

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 Monkey's Audio 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[edit]

Settings[edit]

Specify that we want to use Monkey's Audio as our image format.

ImageExt=ape

UserTrackFormats[edit]

Specify that we want to encode tracks using Monkey's Audio.

Ape=1

UserOutputNames[edit]

Specify the directories for Monkey's Audio images and tracks.

ImageDir_Ape=@OutRoot@\APE-images\$cdartist$
TrackDir_Ape=@OutRoot@\APE\$cdartist$\[$year$] $album$

UserSettings[edit]

Specify any encoding options and the version used.

Opt_Ape=-c2000
Ver_Ape=4.01


REACT-image.cfg[edit]

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

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

SET RG_Ape=-t "replaygain_album_gain=%album_gain% dB" -t "replaygain_album_peak=%album_peak%"
SET RG_Ape_acdir=-t $qreplaygain_album_gain=%album_gain% dB$q -t $qreplaygain_album_peak=%album_peak%$q

REM ---- Image ----[edit]

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

As Monkey's Audio does not support inline tagging this section uses mac.exe to encode, and then tag.exe to add APEv2 tags to the newly-created Monkey's Audio file. You will need to add mac.exe and tag.exe to your REACT tools directory.

IF NOT @ImageExt@==ape GOTO end_ape_image
	SET dest="@ImageDir_Ape@"
	IF NOT EXIST %dest% MKDIR %dest%
	@tools@\mac.exe "@source@" "@image@" @Opt_Ape@
	@tools@\tag.exe %RG_Ape% -t "%ArtistField%=@cdartist@" -t album="@album@" -t totaltracks="@numtracks@" -t year="@year@" -t genre="@genre@" -t comment="@comment@" -t encodedby="%USERNAME%" -t encodersettings="Monkey's Audio @Ver_Ape@ @Opt_Ape@" -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_ape_image

REM ---- Tracks ----[edit]

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

This section uses ACDIR to create Monkey's Audio track files. It is complicated by the fact that Monkey's Audio does not support piping, or inline tagging. The 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. Use mac.exe to encode the relevant track WAVE.
  2. Use tag.exe to add APEv2 tags to the Monkey's Audio file.
  3. Delete the WAVE file.
IF NOT @Ape@==1 GOTO end_ape_tracks
	SET dest="@TrackDir_Ape@"
	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 "@tools@\mac.exe $q%TrackName%.wav$q $q%TrackName%.ape$q @Opt_Ape@ && @tools@\tag.exe %RG_Ape_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=$qMonkey's Audio @Ver_Ape@ @Opt_Ape@$q $q%TrackName%.ape$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_ape_tracks

Piping to Mac.exe[edit]

The offical version of mac.exe does not support piping, but the version that can be found on the shntool website does. If you are using this version you can save some time, by replacing the code above with the following:

IF NOT @Ape@==1 GOTO end_ape_tracks
	SET dest="@TrackDir_Ape@"
	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%.ape" --pipe "@tools@\mac.exe - $#o @Opt_Ape@ && @tools@\tag.exe %RG_Ape_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=$qMonkey's Audio @Ver_Ape@ @Opt_Ape@$q $q%TrackName%.ape$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
	TITLE "@album@"
	POPD
:end_ape_tracks

This allows ACDIR to pipe the audio data to mac.exe, rather than creating temporary WAVE files.


REACT-track.cfg[edit]

REM ============== Begin Main Script ==================[edit]

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

SET TrackDir_Ape="@TrackDir_Ape@"

REM ---- Track ----[edit]

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

As Monkey's Audio does not support inline tagging this section uses mac.exe to encode, and then tag.exe to add APEv2 tags to the newly-created Monkey's Audio file. You will need to add mac.exe and tag.exe to your REACT tools directory.

IF NOT @Ape@==1 GOTO end_ape_tracks
	IF NOT EXIST %TrackDir_Ape% MKDIR %TrackDir_Ape%
	PUSHD %TrackDir_Ape%
		IF @various@==1 SET VA_tag=-t "album artist=@VA@"
		ECHO ON
		@tools@\mac.exe "@source@" "%TrackName%.ape" @Opt_Ape@
		@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="Monkey's Audio @Ver_Ape@ @Opt_Ape@" "%TrackName%.ape"
		@ECHO OFF
		IF %have_cover%==1 IF NOT EXIST folder.jpg COPY "@cover@" folder.jpg
		TITLE @track@/@numtracks@ - "@album@"
	POPD
:end_ape_tracks


Related Thread[edit]

This tip is a result of a the discussion in the thread Using REACT 2.0 - I need help........


See Also[edit]


External Links[edit]