The challenge

I would like to convert a large collection of WAV files to AAC using the "iTunes Plus" setting in iTunes. iTunes describes this setting as:

128 kbps (mono) / 256 kbps (stereo), 44.100 kHz, VBR, optimized for MMX/SSE2.

I would like to automate this import process.

Trial and error

The afconvert command line tool can convert between audio file formats. I've tried a few settings and the closest I could get is:

afconvert -v -d aac -b 256000 -f m4af -q 127 -s 2 --soundcheck-generate input.wav output.m4a

So: be verbose (-v), use the AAC data format (-d aac), encode at 256 kbps (-b 256000), store in the Apple MPEG-4 Audio file format (-f m4af), use the highest quality (-q 127), use VBR constrained (-s 2) and add SoundCheck data to the file.

I've also created an m4a file using the iTunes Plus setting.

The m4a file created by afconvert is about the same size as the iTunes file; just 65536 bytes smaller.


Using the afinfo tool, I compared the file generated by iTunes to the file generated by afconvert. There are two differences in the afinfo output:

  1. The file generated by iTunes has an audio data file offset of 131072, the one by afconvert 65536. This explains the difference in file size
  2. Somehow the file generated by iTunes has different sound check values than the one converted by afconvert:

    • iTunes file:

      sc ave perceived power coeff             343 407
      sc max perceived power coeff             6873 8940
      sc peak amplitude msec                   154389 194861
      sc max perceived power msec              194025 194025
      sc peak amplitude                        31129 30928
    • afconvert file:

      sc ave perceived power coeff             341 388
      sc max perceived power coeff             6087 4157
      sc peak amplitude msec                   212509 152323
      sc max perceived power msec              215481 185017
      sc peak amplitude                        31024 29857

    Especially the sc peak amplitude msec and sc max perceived power msec values differ quite a lot. These are the exact same input files, what could cause this difference?


Is there a way to get results even closer to the "iTunes Plus" setting?

2 Answers 2


I had the exact same obsession, and ended up creating a FLAC-to-iTunes importer that decodes FLAC files to WAV and imports them into iTunes using iTunes' own encoder: https://github.com/cbguder/FLAC2iTunes

It should be easy enough to modify FLAC2iTunes to support direct WAV input.

As for the soundcheck values, I compared iTunes, XLD and afconvert by encoding WAV files to AAC and decoding them back to WAV and comparing the decoded audio data. I also compared afinfo outputs for the encoded files. While the souncheck values are different for each file, the decoded WAVs are exactly the same, so even if you use XLD or afconvert, the chances are the resulting files will sound exactly the same.

For afconvert, I used the parameters suggested by Apple in the "Mastered for iTunes" guide, with an intermediate CAF file:

afconvert source.wav intermediate.caf -d 0 -f caff --soundcheck-generate
afconvert intermediate.caf -d aac -f m4af -u pgcm 2 --soundcheck-read -b 256000 -q 127 -s 2 final.m4a

On newest versions of afconvert:

afconvert intermediate.caf -d aac -f m4af -ue pgcm 2 --soundcheck-read -b 256000 -q 127 -s 2 final.m4a

For XLD, I used these settings:

Format: MPEG-4 AAC
Mode: VBR (Constrained)
Encoder Quality: Max
Sample Rate: Auto
Target bitrate: 256 kbps
Add gapless information for iTunes: checked
Write accurate bitrate information: checked
  • Thanks, I had not tried decompressing the two AAC files and comparing the two decoded files. I'm still not sure why the sound check values would be different, and what they actually mean. I'll accept your answer. (And: I actually have a lot of FLAC files too ;-))
    – rdvdijk
    May 4, 2012 at 7:03
  • OSX 11.4 and I'm not able to add the user property -u pgcm 2 for caf > m4a anymore: results in error: Couldn't set audio converter property ('prop'). Is there a new setting or new documentation? The apple docs still recommend it: images.apple.com/ca/itunes/mastered-for-itunes/docs/… Aug 22, 2021 at 19:51

You can use the "Mastering For iTunes" droplet available on apple's website.


I did need to modify the script to run on Yosemite/ El Capitan, but it's fairly trivial:

  • Show the package contents of the app in Finder (Applications/ Utilities/ Master for iTunes Droplet).
  • Navigate to Contents/ Resources/ Scripts
  • Open main.scpt
  • Update system version compare lines to "10.10" (there are two lines that need this change):

    if systemVersion is less than "10.10" then

  • Save main.scpt

Now you can simply drag and drop your FLAC or WAV files onto the droplet and it will create an intermediate CAFF file followed by the iTunes Plus AAC file.


For those interested, it looks like the afconvert subroutines use the following commands (note these are pulled out of context of the code and will not run as-is):


    • if the sampleRate is greater than "44100":

    afconvert -d LEF32@44100 -f caff --soundcheck-generate --src-complexity bats -r 127

    • else

    afconvert -d 0 -f caff --soundcheck-generate

  • CAFF to AAC

    afconvert -d aac -f m4af -u pgcm 2 --soundcheck-read -b 256000 -q 127 -s 2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .