9.2 Wave Data
9.2.1 ROM Map

Waveform data used for sounds are stored in DDROM ( See "Chapter 4, 64DD Internal ROM") in a form such as that shown on the following page.

Contents

Offset from the beginning of the wave data

Header:

Header

0x000000-0x00001F

int version code(0x19970123)

int number of waveforms stored (0x00000124 = 292)

unsigned int *WavePointer

unsigned int *BookPointer

unsigned int *LoopPointer

Book_Table *BookData

Loop_Table *LoopData

Info_Table *Information

WaveData:

ADPCM waveform data

0x000020-0x2B3D5F

waveform(32Khz & 16Khz)

BookData:

ADPCM predictor data

0x2B4000-0x2B88FF

64 bytes/waveform

LoopData:

ADPCM loop data

0x2B9000-0x2BAFFF

32 bytes/waveform

WavePointer:

waveform data pointer table

0x2BB000-0x2BB48F

4 bytes/waveform

BookPointer:

predictor pointer table

0x2BB500-0x2BB98F

4 bytes/waveform

LoopPointer:

loop pointer table

0x2BBA00-0x2BBE8F

4 bytes/waveform

Information:

additional waveform information

0x2BC000-0x2BE47F

32 bytes/waveform


9.2.2 Detailed Description

Information structure:32-byte configuration

Waveform information is contained in the information area of the sound ROM.


struct {
	u32	version;		/* 0x19970123 */
	u32	adpcmsize;		/* compressed size */
	u32	samplesize;		/* noncompressed size */
	u32	loop_startsamplepoint;	/* oop starting point.  0 with non-looped data */
	u32	loop_endsamplepoint;	/* loop ending point */
	u16	loop_count;		/* 0 with non-looped, -1 with looped data */
	u8	book_bytes;		/* always 64 */
	u8	samplingbaseMIDIkey;	/* key base value */
	f32	samplingrate;		/* sampling rate */
	f32	tuning_C4_32K;		/* detune value */
} Waveinformation_;

The same information is described in the file romsound.infos.txt in the ddsound directory (see "Chapter 14, Important Directories") of the DD development environment. Please refer to this file when creating the bank control file (.ctl).

In addition, please refer to the examples of this file shown in Appendix A.

Pointer Tables

The individual pointer tables for waveform data, predictor data, and loop data indicate how far the storage addresses of each of these types of data are from the beginning (Header) of sound ROM (offset from Header).

For non-looped sound, 0x002D8FFF is stored in the the corresponding loop pointer in the loop pointer table.


9.2.3 Usage

To use sound ROM data, the starting storage address of the data must be known. This starting address is defined in leo.h as DDROM_WAVEDATA_START. Specifically, wnen the EPi function is used to transfer sound data from DDROM by DMA, the following should be used as the address.

DDROM_WAVEDATA_START+offset

Offset is the offset address given in the table in section 9.2.1 ROM Map.

To use sound ROM data, the starting storage address of the data must be known. This starting address is defined in leo.h as DDROM_WAVEDATA_START. (Support for 64DD sound development began with ver. 2.0 of NINTENDO 64 Sound Tools. Those using prior versions are encouraged to upgrade to the latest version.)

The following section discusses audio development with the NW version.

When developing audio, use the following procedure to create a sound ROM .ctl file.

  1. Create an inst file for using the provided (see "Chapter 14, Important Directories.") AIFC data for the disk sound generator.
  2. Compile using the ic (Instrument Compiler). In doing so, use the -v option for output of information on the arrangement of .ctl data.
  3. Substitute the sound ROM address for the waveform offset specified in the .ctl file. This is easily done by preparing a patch program for this purpose beforehand.

For details, please see "Chapter 18, Audio Tools," of the N64 Online Programming Manual.


9.2.4 Supplementary Information on Use with SGI Drivers

When SGI drivers are used, the waveform offset specified in the .ctl file must be rewritten. Although this can be accomplished using such tools as a binary editor, it can easily be accomplished by creating a patch-application program beforehand. The information below is provided to aid in creating this program.

The patch-application program performs tasks such as the following.

Compiles using the ic and creates a bank file. Outputting the name of the archived original waveform file and the offset address in the archive (accomplished using the -v option; e.g. % ic -v -o sample sample.inst > info.txt) at this time facilitates subsequent tasks.

The patch program reads the bank control file (.ctl) and corrects the waveform address.

Specifically, assuming structure ALBankfile *bf; is used, the program rewrites the following in sequence:

bf->bankArray[b]->instArray[i]->soundArray[s]->wavetable->base

For details on these structures, please see "Chapter 19, Audio File Format," of the N64 Programming Manual.

When performing this procedure, the waveform items to be rewritten by original data must be selected. If the previously mentioned output file (abbreviated as info below) containing the name of the archived original waveform file and the offset address in the archive does exist, the data can be rewritten using the following general process.

  1. Identify the waveform name by comparing the base value with the waveform offset value in the info file.
  2. Search for this waveform name in romsound.exinfo (see "Chapter 14, Important Directories"). The sound ROM waveform offset address can be obtained at this location.
  3. Write the sound ROM offset address in place of the value of base.

The following specific methods can be used.

First search for Wave Table: in the info file. The waveform name is a written as a continuation of Wave Table:, so use this as a reference. This data item's offset value is the offset address stored by the ALWaveTable structure for that waveform; base is the value described in the .ctl file as the value of base for ALWaveTable.
Next open the .ctl file and replace the value of base at the location of Offset with the sound ROM offset address.

If the info file cannot be obtained, the waveform can only be identified without the base address. Because the waveform length and loop information are likely to be different for all waveforms, the reference tables for these types of information can probably also be integrated into the patch program. When doing this, it is convenient to also include as a table in the patch file the rom waveform offset information written in romsound.exinfo.