FAQSound related
BackForward
FAQ / Sound related

ADPCM



What library and method do I use to play ADPCM?

Q)
What library and method do I use to play ADPCM?

A)
The ADPCM encoder provided by SEGA outputs CD-ROM XA standard data. Since the ADPCM level and mode are not recorded in the encoded file, it is necessary to remember the level / mode used when creating the data and set the CD-ROM in the subheader when creating it (Mode 2 Form 2).

This playback can only be played from a CD-ROM, and this reading requires the STM library.
This is because the GFS library cannot get the subheader information.
This playback example is included in the sample program of the PCM library, so please refer to it (SMPPCM2).


Please tell me about ADPCM.

Q)
Please tell me about ADPCM.

A)
The ADPCM, stands for A daptive D elta P ulse C ode M odulation, saved from previous data, predicted by the algorithm in the current data, the data in the form of error between the actual value and the predicted value It is a data format that compresses data and is included in the CD-ROM XA standard.

When playing back ADPCM data, it takes longer than PCM data to decode one sample of data because the predicted value must first be calculated and the data corrected.

Some have this decoding work in hardware, but in the case of Sega Saturn, since such a chip is not installed, all decoding is done by software.
For this reason, in Sega Saturn, playing ADPCM should be considered a very burdensome task.
CD-ROM XA has two ADPCM levels, B and C, depending on the data compression conditions.

 Level B → Sample frequency 37.8kHz 4bit FM level sound quality Level C → Sample frequency 18.9kHz 4bit AM level sound quality

Each of the above is divided into STEREO / MONO modes.

This information is not attached to the file, but is recorded in the submode of the subheader part, which is the standard of CD-ROM XA (Mode 2 Form 2).
Therefore, for playback, it is necessary to refer to this subheader part to obtain information on which level (B or C) and which mode (STEREO or MONO).
With the library provided by SEGA, this information acquisition work can be performed with the STM library.


I created ADPCM data, what kind of tool should I use?

Q)
Please let me know if there is any software recommended as an encoder for XA data.

A)
Currently, as ADPCM encoders, there is a tool called AudioStack of CRC Research Institute and SEGA ADPCM Encoder provided here.
Since the format of the output data is slightly different for each tool, it is necessary to use it properly depending on the playback style.
Since the Audio Stack outputs ADPCM data as an AIFF data format, on-memory playback using the PCM / ADPCM playback library sample, which requires header information, is possible. If you remove this header information and create pure ADPCM data, you can play ADPCM in CDROM-XA format.
Since the data created by SEGA ADPCM Encoder is pure ADPCM data without a header, ADPCM playback in CDROM-XA format is possible, but since there is no header information on the data side, On Memory using the PCM / ADPCM playback library sample It cannot be played.

What is the AIFF bit width used for ADPCM data?

Q)
How many bits are input to an AIFF format file when compressing to ADPCM format?

A)
It will be 16 bits.

What is the bit width of the ADPCM unit sample?

Q)
What is the number of bits in one sample in ADPCM format after being encoded in ADPCM format?

A)
It will be 4 bits.

What is the bit width of the restored sample when the ADPCM data is decompressed?

Q)
What is the number of bits of output data when decompressing ADPCM format data?

A)
It will be 16 bits.

How different is the load between ADPCM and PCM stream?

Q)
How much does the transfer load increase when using ADPCM compared to playing a PCM stream from a CD?

A)
It takes about twice as long.

Noise due to different encoders

Q)
AudioStack produces noise that is not produced by the ADPCM encoder provided by SEGA.
Investigate the difference between the two and the cause of the noise.
The data with noise is "AIFF, 18.9KHz, 16Bit, mono".

A)
The audio stack has AIFF-compliant headers so you can use the file system. Since each sector contains data that is not used during playback, this may cause noise.
The encoder provided by SEGA is just an array of solid ADPCM data, and its size is also smaller.
However, it can only be used with stream systems.
There may be a problem with the AIFF of the material, so try resampling once with another tool (SD2 or Alchemy).
Since the output form of AIFF marker chunks differs depending on the tool, our encoder changes this chunk at the time of conversion according to the specifications of the tone editor.
For solid ADPCM data, the two tools may or may not output the same data, depending on which compression algorithm is used internally.

Please tell me how to play ADPCM data on CD-XA.

Q)
Please tell me how to play ADPCM data on CD-XA.

A)

  1. Compress with our ADPCM encoder.

  2. Describe the created data in the VCD script file.
    However, please note that CD-XA can only be used with FORM2 in MODE2.

    (Example) When not interleaving (37.8KHz, Mono)

     File SAMPLE1.XA; 1
         FileSource "SAMPLE1.ADP"
         RealTime
         DataType FORM2
         SourceType MONO_B
         CodingInformation 0
         EndFileSource
     EndFile
    

  3. The file on the disc image after build will be played.
    See the SGL documentation "SGL \ DOC \ ADPCM.TXT" for more information.

Please tell me how to play ADPCM data on memory.

Q)
Please tell me how to play ADPCM data on memory.

A)
Since the "ADPCM encoder" provided by our company can output only solid ADPCM data without header information, on-memory playback that requires header information is not possible.
Use "Audio Stack" for on-memory playback.
Since this is output as an AIFF data format, it can be played using the "PCM / ADPCM playback library".
For details, refer to the sample program "SGL \ SAMPLE \ SMPPCM3".

Please tell me the procedure for creating data to be used during ADPCM playback.

Q)
Please tell me the procedure for creating data to be used during ADPCM playback.

A)
There are two types of ADPCM data: CD-XA compliant ADPCM method and ADPCM method with header.
There are only two sampling rates, 18.9kHz (B MODE) and 37.8kHz (C MODE).
As for the creation method, the sampled AIFF waveform is resampled to the above sampling rate using a commercially available waveform editing tool.
When compressing with the ADPCM method, use our ADPCM encoder provided by Nifty.
For APCM method

CRC Research Institute

TEL: 03-5634-5678

Create data by compressing with a tool called "AudioStack" sold by.


If the sound that is played properly in PCM is ADPCM, the end will be cut off.

Q)
Regardless of the size, when I try to compress the audio data that is normally played to the end with the audio stack and play it, the end is cut off.
In the playback program, the task is called at the timing of slSync () without using the loop playback mode.
I removed the end judgment and added a process to wait about 0.5 seconds after the status changed, but there was no change in the symptoms.

A)
It is a sampling rate issue that the last does not play properly.
There is no problem if the rate is only a divisor of 44.1KHz or an integer part such as 16KHz, but at 18.9KHz or 37.8KHz, the following pitch calculation will cause an error.
This is a hardware limitation and can't be helped.

Calculation formula -oct
       FNS = (2 x 1024 x Fs) / 44.1-1024

oct value 5.5 125KHz → -3
      11.0250KHz → -2
      22.0500KHz → -1
      44.1000KHz → 0
      88.2000KHz → 1

 For example, when the rate is "18.9KHz", the OCT value is -2 and the FNS value is-(-2).
 FNS = (2 x 1024 x 18.9) / 44.1-1024

     = (4 x 1024 x 18.9) / 44.1-1024

     = 731.4285714

Therefore, the FNS setting will have an error in both 2DB and 2DC.
To avoid this, add silence data at the end of the data to make it unaffected by the error.
For the data size, it is okay to add about 0.21 seconds for 1000 samples, which is equivalent to one ring buffer.


BackForward
FAQSound related
Copyright SEGA ENTERPRISES, LTD ,. 1997