XA Audio

From XentaxWiki
Jump to: navigation, search

XA


Format Specifications

 
// XA file format 
// Used in PlayStation 1 games

// little endian

//header
4 bytes (char) - magic // "RIFF"
4 bytes (uint32) - filesize - 8
8 bytes (char) - XA ID string // "CDXAfmt "
4 bytes (uint32) - size of next block
16 bytes - some block // "=UXA"
4 bytes (char) - data ID string " // "data"
4 bytes (uint32) - size of data

// Note: num_of_sectors can be calculated 
// like this: size_of_data / 2352

//audio data (2352 bytes per entry)
num_of_sectors *
{
   24 bytes - sync + header + submode + subheader
   128*18 bytes - sound groups  // 128 bytes per sound group
   24 bytes - unused + edc
}

Related Structures

 
// ADPCM RAW sector file format

// Note: RAW data of a CD sector is 2352 bytes 
// per sector, this sector has the below structure

BYTE	sync[12]={ 0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0  }; // the sync pattern 

struct
{
	BYTE	minutes;	// timecode relative to start of disk
	BYTE	seconds;	// timecode relative to start of disk
	BYTE	sectors;	// timecode relative to start of disk
	BYTE	mode;		// Form 2 for ADPCM audio sectors
} header;

struct
{
	BYTE	file_number;	// used to identify sectors belonging to the same file
	BYTE	channel;	// 0-15 for ADPCM audio
	BYTE
	{
		bit 7: eof_marker;	// 0 for all sectors except last sector of file
		bit 6: real_time;	// 1 for real time mode, see above description
		bit 5: form;		// 1 for ADPCM sector (form 2, 0 for form 1)?
		bit 4: trigger;		// used for application
		bit 3: data;		// dependant on sector type, 0 for ADPCM sector
		bit 2: audio;		// dependant on sector type, 1 for ADPCM sector
		bit 1: video;		// dependant on sector type, 0 for ADPCM sector
		bit 0: end_of_record;	// identifies end of audio frame
	} submode;
	BYTE
	{
		bit 7: reserved;		// "0"
		bit 6: emphasis;
		bit 5,4: bits_per_sample;	// 00=4bits (B,C format) 01=8bits
		bit 3,2: sample_rate;		// 00=37.8kHz (A,B format) 01=18.9kHz
		bit 1,0: mono_stereo;	// 00=mono 01=stereo, other values reserved
	} coding_info;
	BYTE	copy_of_file_number;	// file_number
	BYTE	copy_of_channel;	// channel
	BYTE	copy_of_submode;	// submode
	BYTE	copy_of_coding_info;	// coding_info

} subheader;

struct
{
	BYTE	sound_parameters[16];		
	BYTE	audio_sample_bytes[112];	
} soundgroups[18];


BYTE	unused_for_adpcm[20];
BYTE	edc[4];				// error correction code or 0

MultiEx BMS Script

Not written yet.

Notes and Comments

  • XA files are PlayStation 1 audio files.
  • XA stands for "eXtended Architecture" (extending the "Yellow Book" standard).
  • The XA ADPCM Audio on PlayStation discs are stored in "Green Book" "Mode 2 Form 2" sectors. These sectors also have a 24 byte header, but there is no data at the end for error correction--just 4 leftover bytes. This leaves 2324 bytes for data.

Games

List of games using this file format:

Compatible Programs

  • CDXATOOL
  • CDXAUtil
  • CDXA
  • xa2wav
  • XA2WAVE
  • xacopy
  • XAEX
  • xaplay
  • XA Audio Converter
  • PSound