Friday, May 2, 2008

VAG Files

Before I delve into the complicated structure of the BJS, let's look at the sound files it contains:
Loops and samples are stored as Sony ADPCM VAG files with byte flipped header values. They're always 16 bit mono at 44,100kHz, but Beats might support other formats. The best apps I've seen for creating VAG files are MFAudio and Awave Audio. MFAudio is freeware and can play VAG files but is very picky about the input format and wouldn't even accept the uncompressed WAVs created with Apple's Soundtrack. Awave is shareware that allows you to do batch conversions between many formats, however the free version is limited to processing one file at a time. Should I finally write an app to automate creating files for Beats, this will be worth the investment.

x00| 56 41 47 70 Magic Number, "VAGp" in ASCII
x04| 01 00 00 00 Version Number. All the VAGs in Beats are version 1
x0C| 10 A3 02 00 Waveform length. All the loops should be the same size for obvious reasons. Samples need not apply.
x10| 44 AC 00 00 Sample rate. 44100
x32| This is a 16 byte internal file name. In the case of JAM_0002, the first file is P1P1_Drums1.wav. This is only used by the VAG for reference, though an easy to understand naming convention is used. In this case this is page 1 (Drums) pad 1 (Default, no directional keys pressed) loop 1 (X button).
x48| 16 byte 00 padding
x64| Waveform begins
When importing or exporting a VAG file made specifically for Beats it's important to flip the values at x04 x0C and x10. Little endian for Beats, big endian for MFAudio/Awave.

No comments: