analoq

Not quite analog.

So I’d like to import Apple Loops in a future project.  One problem:  the format specification is undocumented.  It has been reverse engineered before but I haven’t come across anyone’s findings so I figured I’d give it a shot myself…

AIFF Primer

Apple Loops are AIFF sound files with additional data chunks for transients, categorisation, etc.  ”Chunks” are the building blocks of IFF formatted files, they start with a four-byte identifier (FourCC) then an unsigned 32-bit number representing the data length and finally the data itself afterwards.

Standard AIFF chunks include the Common “COMM” chunk which details the sample rate, bit depth, channels etc. and the Sound Data “SSND” chunk which contains the raw PCM data.

PDF: Complete AIFF specifications

Apple Loop Chunk: basc

This is an 84 byte chunk with the ID “basc” that consists of information about the loop’s time signature, key, etc.

struct

{

unsigned int unknown1; // loopable flag?  always seems to be 1

unsigned int numBeats;

unsigned short key; // MIDI note 48(C) thru 59(B) or 0 for none

enum {Minor=1, Major=2, Neither=3, Both=4} scale:16;

unsigned short timeSigNum;

unsigned short timeSigDen;

char unknown2[68]; // filler? always seems to be the same

} basc;

Apple Loop Chunk: trns

This chunk with the ID of “trns” consists of information about the loop’s transient markers.  There is a 100 byte header followed by 24 byte descriptions of each transient marker.

struct

{

char unknown[100];

} trnsHeader;

The values at 0Ah and 0Bh change, but I’m not sure what  they represent.  Maybe a checksum of sorts?

struct

{

unsigned int unknown1; // flags? always seems to be 65536

unsigned int framePosition; // sample frame location of transient

char unknown2[16]; // filler? always seems the same

} Transient;

Apple Loop Chunk: cate

This chunk with the ID of “cate” consists of information about the loop’s categorisation.  I haven’t looked into this yet.

As you can see, this is a work in progress which I will update as I find out more.  Any help or corrections would be greatly appreciated.

3 Responses

  1. analoq » Sampler

    [...] Formats: This started out as a SoundFont player but I kept the code so it can import SF2 files with some level of accuracy.  I also wrote my own WAV and AIFF file parsers.  If you include MIDI, that’s four file formats under my belt now and I’ve mostly reverse engineered Apple Loops. [...]

  2. Jacinta Rogian

    I was recommended this website by my cousin. I’m not sure whether this post is written by him as no one else know such detailed about my problem. You are wonderful! Thanks!

  3. Scott

    Hi, I’m wondering if you’ve been able to get more details on the apple loop specification. I’m personally trying to convert some wav files to the apple loop format.
    Any help would be great!

Leave a Reply