I've just joined up and tried dBpoweramp r12.3, as I have so far been using Exact Audio copy (EAC) and have been looking around if it supports something akin to iTunesEncode which I've been using on EAC. There may be a guide or How-To somewhere, but I mostly came across a few hints in posts that it could use iTunesEncode, and finally found a reference to the CLI Encoder. So I've installed everything and experimented with the CLI Encoder and iTunesEncode with the help of the helpful Help documentation (more than can be said for EAC; it's developed by a German student with limited time and limited English, so I don't blame him) . So, I thought I'd take what I've learned and produce a How-To guide for using iTunesEncode with dBpoweramp Music Converter. Parts are modified from the dBpoweramp Dynamic CLI Encoder help page and Dynamic CLI Tutorial, other information is derived from posts by the iTunesEncoder developer.

Enjoy.

----------------------------------------------------------------------

If, like me, you're an iTunes user, and perhaps have an iPod, you may wish for greater integration between dBpoweramp Music Converter(dMC) and iTunes, and you may wish to not only have iTunes encode to AAC and tag your songs, but to have them automatically entered into the iTunes library without manually importing them. Well, this is possible because iTunes and QuickTime have an API, or programmer interface, which 3rd party programs can use to convert, tag, and import songs or audiofiles into iTunes. However, on Windows, I'm only aware of one small utility that does this: iTunesEncode. This handy little commandline-utility simply hands the encoding over to iTunes, and by default leaves the resultant files in you iTunes library. It encodes into either AAC, MP3, WAV, AIFF (Macintosh equivalent to WAV), or ALAC (Apple Lossless Audio Codec) from any format supported by iTunes, such as WAV, MP3, MP4, or unprotected WMAs.
When used with programs like dMC and EAC, however, they first have to make an intermediary WAV file as it doesn't seem to support piping directly to iTunes. This also means that you can encode from any filetype, irrespective of what QuickTime or iTunes support, such as FLAC or Monkey's Audio, as iTunes only have to encode from a WAV file.
It has a few bugs and limitations, but unfortunately the developer lost the sourcecode in a harddrive crash, so it won't be updated. I've twice encountered, when using it with EAC, the filename and other tags not being transferred to iTunes for a single file, or some error is produced, but so far has worked when re-converting the file.
It is lacking a few features, for instance it seems there is no setting for Encoding Quality, so it must be set in iTunes first from the Preferences > Advanced > Importing tab. Moreover, when you use a particular encoder, the iTunes import default encoder is changed, so be aware if using iTunes to import later. There are no switches for making Gapless albums or various other newer features of iTunes. It supports passing some parameters which dMC doesn't have any dynamic variables for, such as Comments or Artwork, so some tagging tweaking may still be necessary in iTunes. For individual files, it is possible to pass these parameters manually, but not from the source files. iTunes may be able to find the artwork if the Artist and Album is properly tagged.

There are two methods for using iTunesEncode with dBpoweramp Music converter, both using the optional CLI Encoder (Command Line Interface encoder) available from the Codec Central on this site. Naturally you must have iTunes installed.
The first is simply to use the CLI Encoder and point it to an Encoder executable and set the commandline parameters manually. The second involves some preparatory work to make customised versions for any filetype you want.


Method 1: Manually setting parameters to create M4A, MP3, or AIFF files:
  1. Downloaded and install the CLI Encoder from the Codec Central on this site:
    http://www.dbpoweramp.com/codec-central-cli.htm
    and make sure dBpoweramp Music Converter isn't running.
  2. Download iTunesEncode from Rarewares.org:
    http://www.rarewares.org/aac-encoders.php
    It's also available from the original Hydrogen Audio forum thread:
    http://www.hydrogenaudio.org/forums/...howtopic=29821
    You can extract the Zip anywhere, such as the dBpoweramp directory, as no installation is necessary, or better yet place it in the CLI Encoder directory:
    C:\Program Files\Illustrate\dBpoweramp\encoder\CLI Encoder\
    If you later make copies of it, that does mean multiple versions of it, though.
  3. In the folder C:\Program Files\Illustrate\dBpoweramp\encoder\CLI Encoder\ is a file called encoder.txt. Edit this file to change the extension of the encoder, in this instance .m4a
  4. Start dBpoweramp Music Converter, select a file or files to convert (you can option- and shift-click files to convert multiple files), select the CLI Encoder, and click Locate Encoder to find where you put iTunesEncode.exe. Alternatively choose the CLI Encoder from the dBpoweramp Cd Ripper.
  5. iTunesEncode has a number of parameters preceded with a dash and a letter and a space, such as -e or -a, which can appear in any order. Some are mandatory, such as Encoder type and Input, while others are optional, such as passing ID tags to iTunes. Any parameter that may contain a space, such as Artist or Album, must be enclosed in quotes, others don't need to. Some tags may not be set in the source file, such as Total Tracks or Total Disks, so can be left out.
    Additionally, dMC has a set of dynamic variables marked by square brackets, which are replaced by the relevant value for each file as it is passed to the Encoder.
    In the Commandline input field, put:
    -e "AAC Encoder" -a "[artist]" -l "[album]" -t "[title]" -g "[genre]" -y [year] -n [track] -m [track_total] -j [disc] -k [disc_total] -c "Encoded with iTunes via dBpoweramp" -i "[infile]" -o "[outfile]"
    The -c parameter is the Comment tag, and can contain anything you like. It will be written to the original iTunes file, but if you have “dB Write ID Tags” enabled below, the Output file will have its comment overwritten by those in the Source file, or Comment field in the CD Ripper.
    All of the Tag parameters are optional, but although the -o output file parameter is optional in iTunesEncode, it is mandatory in the CLI Encoder.
    iTunes automatically places the converted file in its library, however if you don't want it there, eg if you are encoding ALAC files for backup, and just want iTunes to encode it and place it in the Output location, you can add -d to the Commandline parameters. The output file is copied to the location set by dMC, and the iTunes original is deleted.
  6. For the other options in the CLI encoder, leave Pass Wave Header and dB Write ID Tags ticked. The latter only affects the Output file, not the iTunes original in its library, which only get the tags we pass it via iTunesEncode. Hence the ID tags in the two versions will be slightly different. Leave all other options as default.
  7. Before encoding, you may want to start iTunes first, otherwise the encoder will open it for you when it is needed.
    Click Convert in dMC to convert your file. The progress window will open, the Encoder will convert the sound file to Wav before passing it to iTunesEncode, which passes it on to iTunes via its API. If iTunes isn't open at this point, it will start up first.
    Upon completion of each ripped song, iTunes usually gives off a chime to indicate encoding is complete, and depending on iTunes settings, may start to play. If you sort by the Date Added column in iTunes (right click the column header anywhere, choose it from the menu, then click on it), your newly-added songs will appear fully-tagged at the top (as far as the encoder options allow and are in the source files).

Technical specifics for iTunesEncode with CLI Encoder variables:
Commandline usage: [options] -i <input.wav> -o <output.m4a>

Tagging Options:
-a "[artist]" Adds an artist tag to the file (String)
-l "[album]" Adds an album tag to the file (String)
-t "[title]" Adds a song title tag to the file (String)
-g "[genre]" Adds a genre tag to the file (String)
-y [year] Adds a year tag to the file (Numeric)
-n [track] Adds a track number tag to the file (Numeric)
-m [track_total] Adds a track count tag to the file (Numeric)
-j [disc] Adds a disc number tag to the file (Numeric)
-k [disc_total] Adds a disc count tag to the file (Numeric)

The following options have no dynamic variables in the CLI Encoder:
-b <BPM> Adds a BPM tag to the file (Numeric)
-c <Comment> Adds a comment tag to the file (String)
-u <Grouping> Adds a grouping tag to the file (String)
-x <Compilation> Adds a compilation tag to the file (Boolean)
-p <Composer> Adds a composer tag to the file (String)
-r <filename> Adds artwork to the file (String)

Tag option notes:
- Options that may contain spaces must use quotes.
- Options y (year), n (track), m (track count), b (BPM), j (Disc Number), k (Disc count) are numeric.
- Option x (compilation) is a boolean and can be either 1, true, yes, T, Y, on, enable
iTunesEncode does not support newer tags such as Gapless playback. Set this in iTunes if needed.


Non-tagging options:
-i "[infile]" Specifies the input file. The input file can be
of any format iTunes can read.
(WAV, AIFF, M4A, MP3, WMA)

-o "[outfile]" Specifies an output file. The resulting encoded
file will be copied here after encoding and
tagging are complete.

-s <delay> Delay to use in milliseconds (default: 4000).
Increase this if you experience problems
using iTunesEncode on long batch encodes.

-e EncoderName Lets you specify the encoder iTunes will use.
Choose from
"AAC Encoder",
"MP3 Encoder",
"WAV Encoder",
"AIFF Encoder", or
"Lossless Encoder" (Apple Lossless Audio Codec, aka Apple Lossless Encoder)
(Default is "AAC Encoder".)

-d This switch will make the program delete the song from
the iTunes library once encoding and copying are complete.

Non-tag option notes:
If the output file exists, it will be overwritten.
Technical specifics for the CLI Encoder:
Dynamic Command Line Items
The following items will be dynamically replaced on usage:
[infile] Input filename, if not present stdin is used. Required by iTunesEncode.
[outfile] Output filename, not required for iTunes as it places the original in its library.
[artist] Artist
[album] Album title
[title] Track title
[genre] Music genre
[year] Year of recording
[track] Track number
[track_total] Total tracks on CD
[disc] Compilation disc number
[disc_total] Compilation disc total

[tag]element[] Embed user defined tag element
[unique] Unique number (not padded)
[extension] Audio format extension
[date] Current date
[time] Current time
[day_of_week] Current day of week
[now_year] Current year

[frequency] Frequency, eg 44100
[channels] Channels, eg 2
[channels_subone] Channels-1, eg 0 for mono
[bits_per_sample] Bits, eg 16
[bytes_per_sample] Bytes (bits / 8), eg 2

Method 2: Customised CLI Encoders for each of the supported formats:
  1. Download iTunesEncode from Rarewares.org:
    http://www.rarewares.org/aac-encoders.php
    It's also available from the original Hydrogen Audio forum thread:
    http://www.hydrogenaudio.org/forums/...howtopic=29821
    Keep it handy for now.
  2. Ensure you've downloaded and installed the CLI Encoder from http://www.dbpoweramp.com/codec-central-cli.htm
    and shut down dBpoweramp Music Converter if it's running.
  3. Browse using Windows Explorer to:
    C:\Program Files\Illustrate\dBpoweramp\encoder
    and copy the file CLI Encoder.dll (right click, drag, and drop; choose "copy" from the menu), rename the duplicate file to iTunes (m4a).dll
    (or whatever name you want to show in Music Converter's encoder list).
  4. Copy the CLI Encoder folder as above by dragging and dropping, choosing to Copy. Rename it to the same name as in Step 2 without the extension, eg iTunes (m4a).
  5. Extract the iTunesEncode executable from the downloaded Zip file into this new folder.
    You should have:
    C:\Program Files\Illustrate\dBpoweramp\encoder\iTunes (m4a).dll
    C:\Program Files\Illustrate\dBpoweramp\encoder\iTunes (m4a)\
    C:\Program Files\Illustrate\dBpoweramp\encoder\iTunes (m4a)\iTunesEncode.exe
  6. Open up the new folder. There should be a text file called encoder.txt. If not, it should be created when it's run.
    This file is to contain the dynamic instructions for dBpoweramp.
    In encoder.txt, place:

    [codec]
    .m4a
    iTunesEncode.exe

    where .m4a is the extension of the resultant file. This is the standard extension for AAC or Apple Lossless audio wrapped in an MPEG-4 container used in iTunes and iPods. Variants are .m4b for Bookmarkable files and .m4p for Protected iTunes Store files. Don't use the latter. There are no technical differences between .m4a and .m4b, the latter is simply recognised as a Bookmarkable (resumable) Audiobook by iTunes and iPod, and placed in the Audiobook folder. Regular .m4a can also be made bookmarkable by going into the iTunes info panel under Options and choosing “Remember playback position”.
    If you want to use the other encoders iTunesEncode can use but use separate extensions, like .aif or .mp3, you will have to make separate profiles by repeating the procedure for each file type, since the CLI Encoder unfortunately doesn't allow the extension to be changed dynamically from user input.
    Using iTunes as the encoder actually means it creates its own copy in its library with the right extension, the above extension only applies to the Output file. So, if you set another extension here, say .m4b, that only applies to the dMC copy, not the one in the iTunes library. To have the iTunes version recognised as an Audiobook, simply change its extension.

    After these initial lines, dynamic items can follow, in any order. In fact, the order used sets how the commandline is constructed, items appearing first will appear first on the commandline. However the order is not important.

    The CLI Encoder allows for a customised interface with Encoder-specific options and controls. This is how the Nero AAC encoder is made, for instance.
    We'll customise the iTunesEncoder interface with an iTunes image, labels, a drop-down menu to choose between AAC and ALAC, and a checkbox offering to delete the iTunes original.
    For the image in the encoder dialog, I searched Google Images for "itunes logo".
    For example
    http://www.namedevelopment.com/blog/archives/iTunesLogo.gif or
    http://www.nubzilla.com/myspace/itunes_logo_175px.jpg
    I used IrfanView to resize the first one to half its original size (67x73px), but obviously any image editor will do, and the size is not critical. Being a GIF, the background is ideal for removal. Save it as a BMP image and place it in the "iTunes Encoder" folder as "iTunesLogo.bmp".

    The entry for the logo is in this format:

    [image]
    X Position in Dialog Units Windows unit relative to default System font.
    Y Position in Dialog Units
    iTunesLogo.bmp BMP image file in the Encoder folder
    yes yes=makes the background transparent; no=no transparency

    Labels are in this format:

    [label]
    X Position in Dialog Units
    Y Position in Dialog Units
    String to display
    Colour in Hexadecimal (same as for webpages).

    The Dropdown combo list is in this format:

    [combo]
    X Position in Dialog Units
    Y Position in Dialog Units
    Width in Dialog Units
    First-run default index (1, 2, 3 etc)
    Menu item 1
    Value 1 set on CLI if Item 1 selected (if none, leave blank line)
    Menu item 2
    Value 2 set on CLI if Item 2 selected (if none, leave blank line)

    Finally, the checkbox:

    [checkbox]
    X Position in Dialog Units
    Y Position in Dialog Units
    First-run default value (0=unchecked, 1=checked)
    Shown Text
    Commandline When Checked (if none, leave blank line)
    Commandline When Unchecked (if none, leave blank line)

    There are various other dMC technical settings, such as Maximum and Minimum frequency in Hertz or number of audio channels supported:

    [minfreq]
    8000 (16000 for MP3)

    [maxfreq]
    96000 (48000 for MP3)

    [maxchannels]
    48

    AAC has a frequency range from 8kHz to 96Khz with a maximum of 48 channels, versus MP3's range of 16kHz to 48kHz and 6 channels. You are not likely to encounter a 48-channel audiofile, and I don't know if iTunes handles this theoretical maximum.
    In our first encoder, however, we'll include Apple Lossless as an option, so we won't use the Frequency settings. We'll make separate M4a AAC and Lossless versions later.

    See the Help documentation for more details (Hint: Click the red "?" In the CLI Encoder).


The final encoder.txt file for the iTunes (m4a) encoder reads:

Code:
[codec]
.m4a
iTunesEncode.exe

[image]
250
3
iTunesLogo.bmp
yes

[label]
10
2
Set quality settings in iTunes preferences under Advanced > Importing

[label]
2
24
Encoder:

[combo]
34
22
96
1
AAC Encoder
 -e "AAC Encoder"
Lossless Encoder (ALAC)
 -e "Lossless Encoder"

[checkbox]
2
46
0
Delete original from the iTunes library
 -d

[clistring]
 -a "[artist]" -l "[album]" -t "[title]" -g "[genre]" -y [year] -n [track] -m [track_total] -j [disc] -k [disc_total] -c "Encoded with iTunes via dBpoweramp" -i "[infile]" -o "[outfile]"

[maxchannels]
48
iTunes (m4b Audiobook) encoder:
For an m4b Audiobook version, copy the CLI Encoder DLL and iTunes (m4a) folder, rename them iTunes (m4b Audiobook), and edit the encoder.txt file. It will probably have reverted to a default file, so copy over the above code, and simply change the extension under [codec] to .m4b and save. That is the only difference. You'll have to set iTunes to a lower bitrate manually. There is a default called "Spoken word" which samples at 64kbps at 22,050kHz. Audioplays with music and sound effects probably need 128kbps.

iTunes (m4a AAC) encoder:
For a plain AAC encoder without the drop-down menu, remove the Combo section and accompanying label, add the commandline option for the AAC Encoder to the [clistring], and add the [minfreq] and [maxfreq] settings:

Code:
[codec]
.m4a
iTunesEncode.exe

[image]
250
3
iTunesLogo.bmp
yes

[label]
10
2
Set quality settings in iTunes preferences under Advanced > Importing

[checkbox]
2
46
0
Delete original from the iTunes library
 -d

[clistring]
 -e "AAC Encoder" -a "[artist]" -l "[album]" -t "[title]" -g "[genre]" -y [year] -n [track] -m [track_total] -j [disc] -k [disc_total] -c "Encoded with iTunes via dBpoweramp" -i "[infile]" -o "[outfile]"

[minfreq]
8000

[maxfreq]
96000

[maxchannels]
48
iTunes (mp3) encoder:
For an MP3 encoder, modify the AAC encoder above, replacing .mp4 with .mp3 under [codec], the "AAC Encoder" in the [clistring] directive with "MP3 Encoder", the [minfreq] is 16000, [maxfreq] is 48000, and [maxchannels] is 6:

Code:
[codec]
.mp3
iTunesEncode.exe

[image]
250
3
iTunesLogo.bmp
yes

[label]
10
2
Set quality settings in iTunes preferences under Advanced > Importing

[checkbox]
2
46
0
Delete original from the iTunes library
 -d

[clistring]
 -e "MP3 Encoder" -a "[artist]" -l "[album]" -t "[title]" -g "[genre]" -y [year] -n [track] -m [track_total] -j [disc] -k [disc_total] -c "Encoded with iTunes via dBpoweramp" -i "[infile]" -o "[outfile]"

[minfreq]
16000

[maxfreq]
48000 

[maxchannels]
6
iTunes (Lossless) encoder:
An Apple Lossless encoder is like the M4A AAC encoder above, but without the [minfreq] and [maxfreq] directives, and the [clistring] set with "Lossless Encoder".

Code:
[codec]
.m4a
iTunesEncode.exe

[image]
250
3
iTunesLogo.bmp
yes

[label]
10
2
Set quality settings in iTunes preferences under Advanced > Importing

[checkbox]
2
46
0
Delete original from the iTunes library
 -d

[clistring]
 -e "Lossless Encoder" -a "[artist]" -l "[album]" -t "[title]" -g "[genre]" -y [year] -n [track] -m [track_total] -j [disc] -k [disc_total] -c "Encoded with iTunes via dBpoweramp" -i "[infile]" -o "[outfile]"
iTunes (aiff) encoder:
An AIFF encoder is like above, with the [clistring] set with "AIFF Encoder", and of course the extension set to .aif or .aiff

Code:
[codec]
.aif
iTunesEncode.exe

[image]
250
3
iTunesLogo.bmp
yes

[label]
10
2
Set quality settings in iTunes preferences under Advanced > Importing

[checkbox]
2
46
0
Delete original from the iTunes library
 -d

[clistring]
 -e "AIFF Encoder" -a "[artist]" -l "[album]" -t "[title]" -g "[genre]" -y [year] -n [track] -m [track_total] -j [disc] -k [disc_total] -c "Encoded with iTunes via dBpoweramp" -i "[infile]" -o "[outfile]"

Well that's it. Hope it was useful.
Final notes:
Here's a PDF of this HowTo.

And if you're too lazy to copy-and-paste, here's the encoder files minus the CLI Encoder.dll. Extract to the encoder directory, copy the CLI Encoder.dll for each one you need and rename it exactly like each folder. It may initially reset the encoder.txt file to a default, if so just copy-and-paste from the zipped ones.