Japanese
FAQSound related
BackForward
FAQ/Sound related

ADPCM



Please tell me which library and method to use to play ADPCM.

Q)
Please tell me which library and method to use to play ADPCM.

A)
The ADPCM encoder provided by SEGA outputs data in accordance with the CD-ROM XA standard. 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 it in the subheader when creating the CD-ROM (Mode2 Form 2).

This playback can only be done from the CD-ROM, and the STM library is required for this reading.
This is because the GFS library cannot obtain 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)
ADPCM is an abbreviation for Adaptive Delta Pulse Code Modulation , which predicts the current data using a certain algorithm from previous data, and stores the data in the form of the error between the predicted value and the actual value . This is a data format that aims to compress data and is included in the CD-ROM XA standard.

Even when playing ADPCM data, predicted values must first be calculated and data correction must be performed, so decoding one sample of data takes more time than PCM data.

Some devices perform this decoding in hardware, but the Sega Saturn does not have such a chip, so all decoding is done by software.
For this reason, please note that ADPCM playback is a very demanding job on the Sega Saturn.
CD-ROM XA has two ADPCM levels, B and C, depending on 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 according to the CD-ROM XA standard (Mode2 Form2).
Therefore, for playback, it is necessary to refer to this subheader to obtain information about which level (B or C) and mode (STEREO or MONO).
With the library provided by SEGA, this information acquisition work can be performed using the STM library.


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

Q)
If there is any software you recommend as an encoder for XA data, please let me know.

A)
Currently, ADPCM encoders include a tool called AudioStack from CRC Research Institute and SEGA ADPCM Encoder provided here.
Each tool outputs slightly different data formats, so you need to use them depending on the playback style.
Audio Stack outputs ADPCM data in AIFF data format, so it is possible to perform On Memory playback using PCM/ADPCM playback library samples that require header information. If you remove this header information and create pure ADPCM data, you can play ADPCM in CDROM-XA format.
The data created with SEGA ADPCM Encoder is pure ADPCM data without a header, so it can play ADPCM in CDROM-XA format, but since there is no header information on the data side, On Memory using the PCM/ADPCM playback library sample Cannot be played.

What is the bit width of AIFF used for ADPCM data?

Q)
How many bits is the input AIFF format file when compressing to ADPCM format?

A)
It will be 16 bit.

What is the bit width of ADPCM unit sample?

Q)
How many bits does one sample in ADPCM format have after being encoded into ADPCM format?

A)
It will be 4 bits.

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

Q)
How many bits is the output data when ADPCM format data is expanded?

A)
It will be 16 bit.

How much is the load different between ADPCM and PCM streams?

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

A)
It will take about twice as long.

Noise due to encoder differences

Q)
AudioStack generates noise that does not occur with the ADPCM encoder provided by SEGA.
Find out 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 an AIFF-compliant header, so you can use the file system. Each sector contains data that is not used during playback, so this may be the cause of noise.
The encoder provided by SEGA simply arranges solid ADPCM data and is small in size.
However, it can only be used with stream systems.
There may be a problem with the AIFF of the material, so please try resampling it with another tool (SD2 or Alchemy).
Since the output format of AIFF marker chunks differs depending on the tool, our encoder changes this chunk to match the specifications of the tone editor when converting.
In the case of solid ADPCM data, the two tools may output the same data or different 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 using the ADPCM encoder provided by our company.

  2. Write the created data in the VCD script file.
    However, please note that CD-XA can only be used with FORM2 of 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 built disk image will be played.
    For details, please refer to the SGL document "SGL\DOC\ADPCM.TXT".

Please tell me how to play ADPCM data on-memory.

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

A)
The "ADPCM encoder" provided by our company can only output solid ADPCM data without header information, so on-memory playback that requires header information is not possible.
Use "AudioStack" for on-memory playback.
This is output as AIFF data format, so 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 the data used during ADPCM playback.

Q)
Please tell me the procedure for creating the data 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).
To create it, resample the sampled AIFF waveform to the above sampling rate using a commercially available waveform editing tool.
When compressing using the ADPCM method, use our ADPCM encoder provided by Nifty.
In the case of APCM method,

CRC Research Institute

TEL:03-5634-5678

Create data by compressing it using a tool called "AudioStack" sold by .


With PCM, the sound is played properly, but with ADPCM, the end is cut off.

Q)
Regardless of the size, AIFF normally plays all the way to the end of audio data, but when I try to compress it with the audio stack and play it back, the end gets cut off.
The playback program calls a task at the timing of slSync() without using any loop playback mode.
I tried removing the termination judgment and adding a process that waits about 0.5 seconds after the status changes, but there was no change in the symptoms.

A)
The reason why the last part is not played properly is due to a sampling rate problem.
There is no problem if the rate is only a divisor of 44.1KHz or an integer part such as 16KHz, but if the rate is 18.9KHz or 37.8KHz, an error will occur in the pitch calculation below.
This is a hardware restriction and there is nothing that can be done about it.

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

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

 For example, if the rate is "18.9KHz", the OCT value will be -2 and the FNS value will be:
         -(-2)
 FNS = (2     ×1024×18.9)/44.1-1024
     = (4     ×1024×18.9)/44.1-1024
     = 731.4285714

Therefore, errors will occur whether the FNS setting is 2DB or 2DC.
To avoid this, add silent data at the end of the data to avoid being affected by the error.
You should be fine if you add about 0.21 seconds for 1000 samples, which is equivalent to one ring buffer, to the data size.


BackForward
FAQSound related
Copyright SEGA ENTERPRISES, LTD. 1997