Monthly Archives: June 2016

afclip

Apple provides a set of audio tools that you can use when you’re mastering music. In particular, the afclip utility is a fantastic analysis tool. You can use to make sure your tracks have enough headroom for a clean encoding in the iTunes Plus format.

To use afclip, first download it from Apple. Run the installer1. Then, open up a terminal window and type afclip FILENAME, where you replace FILENAME with the name of your file. If you don’t want to bother typing out the filename, you can just drag the file onto the terminal window.

When you run the utility, hopefully you’ll just see some text that indicates everything is fine with your file:

afclip : "01_Room_5.17.16.wav"    2 ch,  44100 Hz, 'lpcm' (0x0000000C) 16-bit little-endian signed integer
 -- no samples clipped --

But you may see more detail:

afclip : "06_Wall_5.17.16.wav"    2 ch,  44100 Hz, 'lpcm' (0x0000000C) 16-bit little-endian signed integer
CLIPPED SAMPLES:
    SECONDS          SAMPLE    CHAN    VALUE        DECIBELS
   57.385431       2530697.50    1    -1.006987     0.060476
   65.400034       2884141.50    1    -1.001764     0.015309
  195.992483       8643268.50    2     1.009248     0.079958
  198.687313       8762110.50    1     1.005957     0.051587
  214.678878       9467338.50    1     1.002328     0.020199
  222.696179       9820901.50    1     1.001868     0.016213
  234.043322      10321310.50    1     1.001779     0.015437

   total clipped samples    Left   on-sample:        0    inter-sample:        6
   total clipped samples    Right  on-sample:        0    inter-sample:        1

This indicates that this song would clip in seven places when played back. Interestingly, all of the clips are identified as ‘inter-sample’. This means the waveform exceeds 0dBFS between the samples that are actually present in the file. Inter-sample peaks are often the result of using a non-oversampling brick-wall limiter, such as the Waves L1. These limiters ensure that every sample is below the threshold you set, but they don’t make any promises about the waveform between samples.

In this case, we can fix the issue by just attenuating the track by 0.08dB, which should be inaudible. It could be much worse — in theory, there’s no limit to how large your inter-sample peaks can be. In practice, they’re often less than 2dB.

Inter-sample peaks matter for (at least) two reasons:

  1. When the tracks are played back through a digital-to-analog converter (DAC), the analog signal may clip if the DAC wasn’t designed to provide headroom for inter-sample peaks. This is less of a problem on expensive playback equipment.

  2. Inter-sample peaks can cause distortion when the tracks are being encoded to lossy formats such as MP3 or AAC. Since this is the main way people are getting their music these days, it’s really important to check for this!


  1. Ironically, the installer fails the Gatekeeper check because it is “from an unidentified developer”.