The ADPCM Tools: tabldesign, vadpcm_enc, vadpcm_dec

The ic tool requires wavetables to be compressed in ADPCM format before they are included in a sound bank. ADPCM compression is accomplished using the tabledesign, vadpcm_enc, and vadpcm_dec tools. These tools are described below.

Note: The format described is used only as an interchange format between the compression tools and the instrument compiler. It is not used to store compressed sound data on the ROM.

tabledesign
tabledesign reads an AIFC or AIFF sound file and produces a codebook (written to standard output), which is used by the ADPCM encoder. The codebook is a table of prediction coefficients which the coder selects from to optimize sound quality. The procedure used to design the codebooks is based on an adaptive clustering algorithm.

Invoking tabledesign

    	tabledesign [-s book_size] [-f frame_size]
    		[-i refine_iter] aifcfile

Command-line options are described in the following table.

Table 1 tabledesign Command Line Options

Command Line Option | Function
-s <value> | Value is the base 2 log of the number of entries in the table. Currently up to 8 entries are supported, so the value can range from 0 to 3. The default value for this parameter is 2, giving 4 entries. This seems to be adequate for most sounds.
-f <value> | Value is the size of the frames (in samples) used to estimate predictors. Since the ADPCM encoder operates on frames of 16 samples, this number should be a multiple of 16. The default value is 16. The main benefit of increasing the frame size is that design time is reduced.
-i <value> | Value is the number of iterations used in the refinement step of the clustering algorithm. The default value is 2. Increasing this parameter increases design time, with some possible improvement in quality. The default is adequate for most sounds.

vadpcm_enc
vadpcm_enc encodes AIFC or AIFF sound files and produces a compressed binary file, which is used by ic to prepare banks of sounds. The encoding algorithm is based on a switched ADPCM algorithm which uses a codebook to define a table of prediction coefficients. Coefficients from the table are selected adaptively during encoding to give the best sound quality. The Nintendo 64 compressed sound format currently supports a single loop point, which should be defined in the input file’s Instrument Chunk. The codebook and loop-point definitions are embedded in the final output file.

Invoking vadpcm_enc
The vadpcm_enc tool is invoked as follows:

    	vadpcm_enc -c codebook [-t] [-l minLoopLength]
    		aifcFile codedFile

Table 2 vadpcm_enc Command Line Options

Command Line Option | Function
-c <filename> | Define a file that contains the prediction coefficient codebook constructed by tabledesign(1).
-t | Truncate the encoded file after the loop end point. The portion of the sound after the loop end-point is never used in audio playback.
-l <value> | Set the minimum loop length in the encoded file (see Note below).

Note: The efficiency of wavetable synthesis is dependent on the length of loops. Longer loop lengths can be synthesized more efficiently. A minimum loop length can be set in the ADPCM encoder. The currently defined default minimum loop length is 800 samples. This default length can be changed (see above), with the absolute minimum being 16 samples. Loops shorter than the minimum loop length are repeated until the total loop length is larger than the minimum length. If possible loops should be longer than a single audio frame which is equal to the (SampleRate)/(FrameRate).

vadpcm_dec
vadpcm_dec decodes a sound file that has been encoded in the Nintendo 64 ADPCM format using vadpcm_enc, and writes it to standard output as raw mono 16-bit samples.

Invoking vadpcm_dec
The vadpcm_dec tool is invoked as follows:

    	vadpcm_dec [-l] codedfile

Table 3 vadpcm_dec Command Line Options

Command Line Option | Function
-l | If the sound has a loop, play the loop repeatedly until a key is pressed on the standard input.

Copyright © 1999 Nintendo of America Inc. All Rights Reserved Nintendo and N64 are registered trademarks of Nintendo Last Updated January, 1999