Chapter IV   Audio Data Representations


IV.1   General Audio Encoding


This chapter defines the  format and encoding of  audio data for  a   CD-I 
disc.

Digitally recorded sound in  mono or stereo can  be encoded as  shown   in 
Figure IV.1.  The required sound quality level to  be encoded has to    be 
set for the  sample rate  converter and the  ADPCM encoder,  giving    the 
sampling frequency and number of bits per sample on the disc.  The   ADPCM 
encoded audio data is then formatted into an audio sector.

This chapter  also defines  how the  encoded data  from  a CD-I  disc   is 
decoded back to audible sound.

Abbreviations used in this chapter have the following meanings:

ADPCM :    Adaptive Delta Pulse Code Modulation
PCM   :    Pulse Code Modulation
CD-DA :    Compact Disc - Digital Audio
S/N   :    Signal to noise ratio

Other abbreviations used are defined in the text.

Figure IV.1


                    Digitally Recorded Audio
                    (mono/stereo, emphasis)
                              _
                              _  Input
                       _______________
Required               _             _
Audio Quality  _________ Sample Rate _____  Sampling
Level             _    _  Converter  _   _  Frequency
(A/B/C)           _    _______________   _
                  _           _          _
                  _           _          _
                  _    _______________   _
                  ______    ADPCM    _____
                  ______   Encoder   __________  Mono/Stereo
                  _    _______________   _  _
      Bits/Sample _           _          _  _
                  _           _          _  _
                  _    _______________   _  _
                  _    _             _____  _
                  ______Audio Sector ________
                       _             __________   Emphasis
                       _  Formatter  __________   Form 2
                       _______________
                              _
                              _
                       _______________
                       _ CD-I Sector ___________  File Number
                       _             _
                       _  Formatter  ___________  Channel Number
                       _______________
                              _
                              _
                      CD-I Audio Sector



IV.2  Sound Quality Levels


Audio data from  more than  one audio source  can be  encoded in  a   CD-I 
track.  Each audio source will be identified with an audio channel  number 
in the subheader (see  IV.3) of the CD-I sector.

The encoded sound quality  level is dependent on  the sampling   frequency 
(fs) and the number  of bits used per  sample (b).  The  bit rate   coming 
from the  CD-I player  is constant,  but the  maximum  available   channel 
numbers (N) can vary (see Figure IV.2 below). From the basic audio   level 
parameters  one can derive the maximum:

           - audio bandwidth (BW) and

           - channel numbers (N).

Figure IV.2 gives an overview of the sound quality levels

Figure IV.2

     _____________________________________________________
     _ Level      _   fs     _ b _  BW    _  N  _ Stereo/_
     _            _          _   _        _     _  Mono  _
     _____________________________________________________
     _ CD-DA      _ 44.1 KHZ _16 _ 20 kHz _  1  _ stereo _
     _____________________________________________________
     _ CD-I ADPCM _          _   _        _     _        _
     _  Level A   _ 37.8 kHz _ 8 _ 17 kHz _  2  _ stereo _
     _            _          _   _        _  4  _ mono   _
     _            _          _   _        _     _        _
     _  Level B   _ 37.8 kHz _ 4 _ 17 kHz _  4  _ stereo _
     _            _          _   _        _  8  _ mono   _
     _            _          _   _        _     _        _
     _  Level C   _ 18.9 kHz _ 4 _8.5 kHz _  8  _ stereo _
     _            _          _   _        _ 16  _ mono   _
     _____________________________________________________


IV.3  Audio Sector Data Format


3.1  General


The data field of an audio sector (see II.4.8) contains three fields:

      -  a  subheader  containing  the  file  number,  channel    number, 
      submode, and coding information bytes;

      -an audio block data area containing 2304 bytes; and

      -a padded field containing 20 bytes with value zero.



3.2  Subheader Bytes


3.2.1  File Number


See  III.4.4.2 for a definition of the file number.



3.2.2  Channel Number


See Appendix II.1.2 for  the general definition of  channel numbers.    It 
should be noted that for audio sectors, the channel number can only   have 
the value of 0 to 15.

The audio channel  selection for  the ADPCM decoder  is controlled  by   a 
separate 16-bit audio  channel selection  register.  Any audio    channels 
selected by the  32-bit channel  selection register but  not the    16-bit 
register are  transferred  to  the  host  system along  with  the    other 
(non-audio) channels.  The audio channel selected by the 16-bit   register 
is tranferred to the audio processor.




3.2.3  Submode


The submode byte has to be encoded as  given in Figure IV.3 for an   audio 
sector.


Figure IV.3

                     _________________________________
          bit number _ 7 _ 6 _ 5 _ 4 _ 3 _ 2 _ 1 _ 0 _
                     _________________________________
          bit value  _ x _ x _ 1 _ x _ 0 _ 1 _ 0 _ x _
                     _________________________________
          where x  is defined in II.4.5.3.



3.2.4  Coding Information


The audio Coding Information byte is defined as follows:

  
  ______________________________________________________________
  _ 0  _Emphasis_Bits per Sample_Sampling Frequence_Mono/Stereo_
  ______________________________________________________________
bit 7   6        5             4 3                2 1         0


Reserved
Bit 7 =Set to zero

Emphasis (see IV.4.2)
Bit 6
     0 = Emphasis off
     1 = Emphasis on

Number of Bits per Sample
Bits 5-4
     0 0 = 4 bits
     0 1 = 8 bits
     1 0 = Reserved
     1 1 = Reserved

Sampling Frequency
Bits 3-2
     0 0 = 37.8 kHz
     0 1 = 18.9 kHz
     1 0 = Reserved
     1 1 = Reserved

Mono/Stereo
Bits 1-0
      0 0 = Mono
     0 1 = Stereo
     1 0 = reserved
     1 1 = reserved

3.3  Audio Block


The audio block field bytes B24 to B2327 of a CD-I audio sector   consists 
of 2304 bytes.   The audio  block is further  subdivided into  18    sound 
groups (SG00...SG17) of  128 bytes  each.  The sound  groups have  to   be 
encoded in sequential order (see Figure IV.4).


Figure IV.4

                 _____________________________
                 _ Audio Block _ Sound Group _
                 _____________________________
                 _     B24     _             _
                 _      .      _             _
                 _      .      _    SG00     _
                  _      .      _             _
              _        _             _
                 _     B151    _             _
                 _____________________________
                 _      .      _             _
                 _      .      _    SGxx     _
                 _      .      _             _
                 _____________________________
                 _    B2200    _             _
                 _      .      _    SG17     _
                 _      .      _             _
                 _    B2327    _             _
                 _____________________________



3.4  Sound Group


A sound group is divided into two parts:

     - Sound parameters (SP) : 16 bytes

     - Sampled audio data    : 112 bytes

The bytes Si in the sound group (SG) are indexed per SG from 0 to 127.

Figure IV.5 gives the layout of a sound group.

Figure IV.5

            _______________________________________
            _ Sound Group _                       _
            _ Byte numbers_     Meaning           _
            _______________________________________
            _      S0     _ Sound Parameter       _
            _      .      _       Bytes           _
            _     S15     _                       _
            _______________________________________
            _     S16     _                       _
            _      .      _   Sampled Audio       _
            _      .      _                       _
            _      .      _   Data Bytes          _
            _      .      _                       _
            _     S127    _                       _
            _______________________________________

The sound parameter bytes  each contain the two  sound parameters,   i.e., 
the range (R) and filter (F) (see  IV.4.3).

The sound parameter (SP) has the value given by:
     
     SP = 16* F + R

where the range (R) and filter (F) positions in the sound parameter   byte 
are shown in Figure IV.6.








                         Figure IV.6

         ____________________________________________
         _Sound Parameter Byte SP        _
         ____________________________________________
         _ Filter (F)          _ Range (R)          _
          ____________________________________________ 
_ bits 7 to 4         _ bits 3 to 0        _
          ____________________________________________

3.5  Level A Audio


In level A audio, a sound group (SG) contains four sound units (SUj)  with 
j = 0 to 3.  A sound unit consists  of 4 identical  sound parameter   (SP) 
bytes of 8 bits and 28 sound data bytes.

The sound parameters (SPj) for the sound units (SUj) are encoded in S0  to 
S15 (see IV.3.4) where j is the sound unit index. Here,

    Si = SPj
    where   j = i mod 4  and
        i = the byte number index in sound group (see Figure IV.7)

The 8-bit sound data bytes (SBjk) are encoded  in S16 to S127 where k   is 
the sequential sampling order indexed from 0 to 27. Here,

    Si = SBjk
    where   i = 16 + j + 4*k   (see Figure IV.8)

In mono, the sound units (SU) are encoded sequentially i.e. SU0, SU1,  SU2 
and SU3.

In stereo, the left signal is SU0 and SU2 and the right signal is SU1  and 
SU3.  The sound units (SU) are encoded in sequential pairs, i.e. SU0   and 
SU1 are encoded together, followed by the pair SU2 and SU3.

Figure IV.7 shows the  sound parameter layout for  level A audio    whilst 
Figure IV.8 gives the sound data layout for this audio level.


Figure IV.7

             ______________________________
         _ Sound Group  _ Sound Unit  _
         _ Byte Number  _   Number    _
         _    (=i)      _    (=j)     _
                ______________________________
         _      0       _      0      _
         _      1       _      1      _
         _      2       _      2      _
         _      3       _      3      _
         _      4       _      0      _
         _      5       _      1      _
         _      6       _      2      _
         _      7       _      3      _
         _      8       _      0      _
         _      9       _      1      _
         _     10       _      2      _
         _     11       _      3      _
         _     12       _      0      _
         _     13       _      1      _
         _     14       _      2      _
         _     15       _      3      _
         ______________________________

Figure IV.8

_____________________________________________
_ Sound Group  _ Sound Unit  _ Sound Sample _
          _ Byte Number  _   Number    _    Number    _
          _    (=i)      _     (=j)    _    (=k)      _
          _____________________________________________
_     16       _      0      _      0       _
_     17       _      1      _      0       _
_     18       _      2      _      0       _
_     19       _      3      _      0       _
_     20       _      0      _      1       _
_     21       _      1      _      1       _
_      .       _      .      _      .       _
_      .       _      .      _      .       _
_    126       _      2      _     27       _
_    127       _      3      _     27       _
_____________________________________________





3.6  Level B and Level C Audio


In levels B and  C audio, a sound  group (SG) consists  of 8 sound   units 
(SUj) where j  = 0  to 7.  A  sound unit  consists of  2 identical   sound 
parameter bytes of 8 bits and 28 sound data nibbles (SDjk) of 4 bits.

The sound parameters (SPj) for the sound units (SUj) are encoded in S0  to 
S15 (see IV.3.4) and j is the sound unit index. Here,

    Si = SPj
    where the relation between i and j is given by Figure IV.9.

The 4 bit sound  data (SDjk) from two  sound units are  combined into    a 
sound byte (SBlk) where k is the sequential sampling order indexed from  0 
to 27 in the following manner:

    SBlk = SDjk + 16*SDj+1k  (see Figure IV.10)
    where   j =2 * l and
       l = 0 to 3

These sound bytes (SBlk) are encoded in S16 to S127.  Here,

    Si = SBlk
    where   i = 16 + l + 4*k

In mono,  the  sound  units  are  encoded sequentially  i.e.  SU0,    SU1, 
SU2...SU7.  In stereo, the left signal is given by SU0, SU2, SU4, and  SU6 
and the right signal is given by SU1,  SU3, SU5 and SU7. The sound   units 
are encoded in sequential pairs i.e. SUn and  SUn+1 are encoded   together 
where n = 0, 2, 4 and 6.

Figure IV.9 shows the sound parameter layout for levels B and C audio  and 
Figure IV.10 gives the sound data layout for these audio levels.

 Figure IV.9

_____________________________
_ Sound Group  _ Sound Unit _
                  _ Byte number  _   number   _
                  _     (= i)   _    (= j)   _
                  _____________________________
_      0       _     0      _
_      1       _     1      _
_      2       _     2      _
_      3       _     3      _
_      4       _     0      _
_      5       _     1      _
_      6       _     2      _
_      7       _     3      _
_      8       _     4      _
_      9       _     5      _
_     10       _     6      _
_     11       _     7      _
_     12       _     4      _
_     13       _     5      _
_     14       _     6      _
_     15       _     7      _
_____________________________



Figure IV.10

         ___________________________________________
         _ Sound Group _ Sound Unit _ Sound Sample _
         _ Byte Number _   Number   _    Number    _
         _    (= i)    _   (= j)    _    (= k)     _
         ___________________________________________
         _     16      _  1 and 0   _      0       _
         _     17      _  3 and 2   _      0       _
         _     18      _  5 and 4   _      0       _
         _     19      _  7 and 6   _      0       _
         _     20      _  1 and 0   _      1       _
         _     21      _  3 and 2   _      1       _
         _      .      _      .     _      .       _
         _      .      _      .     _      .       _
         _    126      _  5 and 4   _     27       _
         _    127      _  7 and 6   _     27       _
         ___________________________________________




3.7  Audio Sector Interleaving


Figure IV.11


          ____________________________________________________
          _            Relative Sector Number                _
 _____________________________________________________________
 _  Level _0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _10_11_12_13_14_15_16_
 _____________________________________________________________
 _A stereo_* _  _* _  _* _  _* _  _* _  _* _  _* _  _* _  _* _
 _____________________________________________________________
 _A mono  _* _  _  _  _* _  _  _  _* _  _  _  _* _  _  _  _* _
 _____________________________________________________________
 _B stereo_* _  _  _  _* _  _  _  _* _  _  _  _* _  _  _  _* _
 _____________________________________________________________
 _B mono  _* _  _  _  _  _  _  _  _* _  _  _  _  _  _  _  _* _
 _____________________________________________________________
 _C stereo_* _  _  _  _  _  _  _  _* _  _  _  _  _  _  _  _* _
 _____________________________________________________________
 _C mono  _* _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _* _
 _____________________________________________________________



Figure IV.11 shows some  examples of audio sector  interleaving for    the 
case of a real-time  bit being set to  one.  The interleave  factors   are 
fixed for each quality level and refer to the audio sectors with the  same 
file number and channel number; the other audio sectors must have  another 
file number or channel number.

The audio  sector  interleaving is  not  necessarily applicable  if    the 
real-time bit  is  zero for  audio  sectors. It  should  be  noted    that 
non-real-time audio data must be sent to a soundmap.

IV.4  Audio Data Encoding

4.1  General


The principal feature of the ADPCM system (see  Figure IV.12) is that   it 
provides multiple prediction filters in order to respond  effectively   to 
fluctuations in the frequency  distribution of the signal.   This   system 
employs near instantaneous  compression to  compress the dynamic    range. 
The prediction filters  and noise-shaping  filters of the  system   switch 
simultaneously in order to minimize the energy of output noise.

Only first  order  and second-order  digital  filters are  used  in    the 
encoder.

The encoder  selects  which predictor  is  most suitable  in  the   manner 
defined below.

  - The predictor adaptation  unit in Figures IV.12  and IV.13   compares 
the peak value  of the  prediction errors sampled  over 28  samples in   a 
sound unit and then selects the filter which generates the minimum peak.

  - Prediction  errors  which are  chosen  are   gain-controlled          
(normalized by their maximum value) and noise shaping is     executed   at 
the same time.

As a result of the above mentioned strategy, first-order and second  order 
filters are used for signals in the low  and middle frequencies and    the 
straight pass through filter is used for high frequency signals. This   is 
done in order to obtain a high instantaneous Signal/Noise ratio.

Different strategies of selecting filters are allowed.  The above set   is 
only one approach.

All data  processing  has to  be  done in  2's  complement  code with    a 
sufficient number of bits to avoid extra quantization distortion.

The quantizer output of 4- or 8-bit audio  data is a rounded value    when 
inputted.



Figure IV.12

      Sampled Audio Data Input (once for mono, twice for stereo)
      _________________________________________________
           _              _             _             _
           _              _             _             _
      _____________  ____________  ____________  ____________
      _           _  _          _  _          _  _          _
      _ Predictor _  _Predictor _  _Predictor _  _Predictor _
      _  Unit 0   _  _  Unit 1  _  _  Unit 2  _  _  Unit 3  _
      _           _  _          _  _          _  _          _
      _____________  ____________  ____________  ____________
        _ ______________      _      _     _      _   _
Peak    _ _  _________________________     _      _   _
Value   _ _  _ _ __________________________________   _
        _ _  _ _____________  _      _______          _
        _ _  _   _   PD0   _  _ PD1  _ PD2            _
        _ _  _   _         _  _      _                _
      ______________      _____________               _
      _Filter and  _ F    _ Predictor _________________
      _   Range    ________    Unit   _       PD3
      _  Selector  _  _   _ Selector  _
      ______________  _   _____________
       R  _    ________      -  _  +           SF (to all units)
    _______    _     _                         _____________
    _     _    _     ________   +
    _     _    _     __
    _     _    _     __         _
    _     _    _     __         _
    _ ______________ __   ______________
    _ _Noise Shaper_ __   _Gain Control_
    _ _   Unit     ____   _   Unit     _________ R
    _ ______________ _    ______________
    _    _     _     _          _
    _    _     __________________
    _    _           _          _
    _    _           _    __________________     AL
    _    _           _    _ Quantizer Unit _________________
    _    _           _    __________________
    _    _           _          _     R = Range value
    _    ________________________     F = Filter value
    _                _          _     PD= Predicted Data
    _                _          _     AL= Audio Level (A,B or C)
    ______           _          _     SF= Sampling Frequency
         _           _          _
         _           _          _
         _           _          _
       Range       Filter     4- or 8-bit Audio
       Value       Value        Data Output
4.2  ADPCM Encoder


Figure IV.12 gives the general configuration of the  ADPCM encoder   which 
needs to be done once for mono and twice for stereo.

If the  input  data has  been  recorded with  emphasis  (see  the    CD-DA 
specification, page 1A) then the emphasis bit in  the coding   information 
byte has a value of 1; otherwise it has the value 0.

There are four predictor units indexed here as 0 to 3 (see Figure IV.12).

The filter and range selector generates the values called filter (F)   and 
range (R) (see  IV.4.3) depending on the peak  values from the   predictor 
units.  The predictor unit with the lowest peak value is selected.

The predictor selector unit  sends the chosen data  to the gain    control 
unit.  The gain control  unit multiplies the input  data value with    the 
gain factor 2R where R is the range value (see IV.4.3).

The purpose of the noise shaper unit (see Figure IV.14) is to   compensate 
for extra noise introduced in the predictor unit.

The output value is rounded to 8 or 4 bits of audio data in the  quantizer 
depending on the required audio level (A, B or C).

Figure IV.13


Predictor Unit


Input                  +           ___________
Sample  O____O___________ +  _______   T28   _____ PDi
Data         _            _ - _    ___________
           ____           _   _
           _T1_         +     _    ___________
           ____ ____ K0 _ +   _    _  Peak   _
             O___         _ + ______         _____ Peak Valuei
           ____           _        _  Hold   _
           _T1_           _        ___________
           ____           _
             _______ K1 ___


T1  = one sample delay

T28 = 28 sample delay

K0 and K1 are gain factors and depend on the filter selected (see IV.4.3)

i   = 0 to 3

Figure IV.14


Noise Shaper Unit

                              _____________     ___  +  ______
                              _                      _    Noise
                              _             K1       _    Shaper
                           ________                  _    Unit
                           _  T1  _                  _    Output
                           ________                  _
                              _                      _
                              O____________      _____
                              _
                           ________         K0
                           _  T1  _
                           ________
                              _
Range Value                   _

_____________________________ G      G = 2-R

                              _
                              _
                        +          -
                    _________ + _________
                    _                   _
                    _                   _
                    _                   _
                    _                   _
                    _                   _

      from Quantizer Output    from Quantizer Input

T1 = one sample delay

K0 and K1 are gain factors and depend on the filter selected values.


4.3  Sound Parameters

Figure IV.15 shows the values of the gain for the various filters of   the 
sound parameter and Figure IV.16 shows the range values.


Figure IV.15

             _____________________________________
             _ Filter  _    K0     _     K1      _
             _         _           _             _
             _____________________________________
             _    0    _ 0         _ 0           _
             _         _ 0.000000* _ 0.000000*   _
             _____________________________________
             _    1    _ 0.9375    _ 0           _
             _         _ 0.111100* _ 0.000000*   _
             _____________________________________
             _    2    _ 1.796875  _ -0.8125     _
             _         _ 1.110011* _ -0.110100*  _
             _____________________________________
             _    3    _ 1.53125   _ -0.859375   _
             _         _ 1.100010* _ -0.110111*  _
             _____________________________________
                  (*) Base 2 rational numbers


Figure IV.16

                     ________________________
                _ Sound Quality Levels _
                 ________________________
                   _   A  _   B   _  C    _
       _______________________________________
       _ Range Values _0 to 8_0 to 12_0 to 12_
         _______________________________________














IV.5  ADPCM Decoder



5.1  Audio Decoder Model


Figure IV.17




                                                 Ext
                        (A)                  Left   Right
CD-DA _______________________                  _      _
Data                        _                  _      _
        C) _________   ____________          ____________
CD-I________ADPCM  _   _  Audio   ___Left ____   Audio  ___Left
Sector _   _Decoder_____Processing_          _  Mixing  _
       _   _       _(B)_  Unit    ___Right____   Unit   ___Right
       _   _________   ____________          ____________
       _       _            _                      _
       _       _(D)         _                      _
       _   __________
       _(C)_Soundmap_       _                      _
       _____  Unit  _
           __________       _                      _
               _
               _(E)         _                      _
           ____________
           _  Micro-  _ _ _ _                      _
            _Processing_              ***         Extension           ***        
_  Unit    _ _ _ _ _ _ _ _ _ _ _ _ _ _ __
           ____________      * * * * * * * * *

___ = data flow
--- = control


A   = CD-DA data from CD-DA track,
B   = decoded ADPCM audio data from CD-I sectors,
C           =ADPCM audio data from CD-I Form 2 sectors to a soundmap   or 
        directly to the ADPCM decoder,
D   = ADPCM audio data from a soundmap,
E   = soundmap data from the microprocessing unit
      
      *** Extension ***

Ext = external audio.
      
      *****************
      








5.2  Audio Processing Unit


The audio processing  unit (see  Figure IV.17) converts  digitally   coded 
audio information to the analog outputs called left and right.

This unit can process audio data coming from  a CD-DA track on the    disc 
(A) or audio data coming from the ADPCM decoder (B).

This unit  also  supports  audio  mixing  and attenuation  control    (see 
IV.6.3).

* * * *  EXTENSION  *  * * *

After the audio processing unit an audio mixing  unit may be used to   mix 
and/or attenuate  external audio  signals (e.g.  synthesizer) with    CD-I 
generated audio under the control of the microprocessing unit.

* * * * * * * * * * * * * * *





5.3  ADPCM Decoder


The ADPCM  decoder (see  Figure IV.18)  converts the  CD-I  audio   sector 
encoded data to 2's complement 16-bit PCM coded  audio (B). The   sampling 
frequency depends however on the audio quality level used (see  IV.2).

This unit has  to buffer  the CD-I audio  data in  order to  decode    the 
time-multiplexed signals.   The input  can come  from the  Compact    Disc 
Control Unit (see VIII.1) directly (C) or from  a sound map in the    CD-I 
system memory (D) (see Figure IV.17).

A 4 or  8-bit data  word is converted  into a  16-bit word  by the   ADPCM 
decoder (see Figure IV.18).


Figure IV.18

      _____         +                          ___    16-bit
      _ Data __  G __ +  _________ _____________Q_____Output (B)
      _          _      +               _      ___
      _ 4 or 8   _    _               ______
      _ bits     _    _               _ T1 _
      _          _    _               ______
      _          _       +              _
      _          _    +  ____  K0  ______     T1 = one sample
   C  _          _  +                   _            delay
  or  _ Range ____    _               ______
   D  _               _               _ T1 _
      _ 4 - bits      _               ______
      _               _                 _
      _               ______   K1  ______
      _
      _                       _
      _ Filter    _____________
      _
      _ 4 - bits
      _____

The multiplier G adjusts  the gain of the  system by means  of the   range 
value so that the audio data is decoded into 16-bit words.


The multiplier algorithm is given below.

For level A the multiplier algorithm is:
          Word value = Audio data value * 2 (8-R)

For levels B and C the multiplier algorithm is:
       Word value = Audio data value * 2 (12-R)
     
In each case the Range (R) is:
       Range = Range data value (see Figure IV.16)

The filter data controls the coefficients K0 and K1 of the filter.   These 
coefficients are the  same as  those used for  the encoder  (see    Figure 
IV.15)

The output data is quantized to 16 bits by the quantizer Q.  If   overflow 
occurs then these must be limited (clipped) to the maximum values.

5.4  Soundmap Unit


The soundmap unit holds one or more soundmaps  created by the CDFM    (see 
Figure IV.17). These  are located  in the CD-I  system memory  (RAM)   and 
contain CD-I formatted audio data.  The soundmap can  be filled from   the 
Compact Disc Control Unit (see C in Figure  IV.17 or VIII.2) or from   the 
microprocessing unit (E).  The soundmap cannot be filled with CD-DA  coded 
audio from the disc.

The CD-I audio sector  data bytes going to  the ADPCM decoder  cannot   be 
sent concurrently to the soundmap unit.

Normally the soundmap contains, in RAM, the whole or a part of the   audio 
part of a real-time  record.  It is possible  to fill one  soundmap   from 
disc (see Figure IV.17;C) or from the micro- processing unit (see   Figure 
IV.17; E) and, in real time, send data  to the ADPCM decoder (see   Figure 
IV.17;D) from another soundmap concurrently.

It is  recommended  that the  soundmap  contains an  integer  number    of 
contiguous CD-I audio sectors (each containing 18 sound  groups) in   RAM. 
The memory representation of a soundmap is that  of a contiguous set    of 
sound groups.

Note that  the 20  last unused  bytes of  each  CD-I audio  sector    are, 
consequently, not present in a soundmap.




5.5  Microprocessing Unit


The microprocessing unit (see Figure IV.17) can rearrange audio data in  a 
soundmap.  It can  also generate  new audio data  into a  soundmap   under 
software control for special sound effects or phonetically coded speech.

This unit is responsible  for controlling the mixing  and attenuation   of 
the:

- Audio Processing Unit.

* * * * * * EXTENSION * * * * * *

- Audio Mixing Unit.

* * * * * * * * * * * * * * * * *


IV.6  Audio Data Rearrangements


6.1  Non Real-time Rearrangements


The application may create one or more soundmaps and fill them with   data 
from the disc or from data within the application itself.  The number   of 
soundmaps and their size is limited only by the total amount of RAM.

If necessary, two soundmaps  can be combined into  a single soundmap   for 
output to the audio processor.  Two mono soundmaps may be combined into  a 
stereo soundmap, or the  left (or right) channel  of one stereo   soundmap 
may be combined  with the  left (or right)  channel of  a second    stereo 
soundmap to create a third stereo soundmap.

The two soundmaps must always be of the same audio quality level.

When combining  two large  soundmaps, it  is considered  a   non-real-time 
operation because the sound is not being output as this mixing is done.


6.2  Real-time Rearrangements

In  IV.5.4 it was stated that it is  allowed to transfer CD-I audio   data 
from disc to  a soundmap  while concurrently playing  back audio  from   a 
second soundmap.

By using  the  mixing feature  of  CDFM (see  VII.2.2.4.2,  SD_MMix    and 
SD_SMix), it is possible to read the data  from the disc one sector at   a 
time, mix it with a sector in memory and output the combined data to   the 
audio processor with  only a  small delay in  the audio  signal.  It    is 
required that it takes less than 1/75 of a second (13 ms) to mix two   one 
sector buffers.
This would allow an application to have a soundtrack on the disc and   mix 
in sound effects from soundmaps in memory (see Figure IV.19a and 19b).

In this example,  the application  would set the  play control  lists   to 
alternate between filling soundmap  B and soundmap C.   As each of   these 
buffers is filled it is mixed with a sector from soundmap A into  soundmap 
D or E respectively.  Finally, soundmaps D or E  are output to the   audio 
processor.

In this manner, the  actual delay in the  soundtrack is less  than 13   ms 
from its unmixed time.   To avoid a delay  when initiating the    soundmap 
mixing it is recommended to mix the soundtrack  with a sector of   silence 
so that the delay is constant.

Figure 19a


                        ________
                        _      _    ________    ________
                        _      _    _      _    _      _
                        _  A   _    _  B   _    _  D   _
                        _      _    ________    ________
          sound         _      _    ________    ________
          effects _______      _    _      _    _      _
                        _      _    _  C   _    _  E   _
                        _      _    ________    ________
                        ________



Figure 19b



              _ A  _    _ A  _    _ A  _    _ A  _    _ A  _
              ______________________________________________
read data     ______    ______    ______    ______    ______

mix                ______    ______    ______    ______

output data             _________________________________________

6.3  Audio Mixing Control Unit


The Audio mixing control unit, which is a  part of the audio    processing 
unit (see Figure IV.20), consists of four attenuators between left-in  and 
left-out, left-in and right-out, right-in and right-out, and right-in  and 
left-out.  The attenuation is controlled by the CDFM in steps of 1 db.

The control value for the attenuators is an 8-bit value.

If bit 7  is zero  (range 0 to  127), then  bit 6  to bit 0  defines   the 
attenuation value in db.

If bit 7 is one then the signal at the output of the attenuator should  be 
muted.

The Audio mixing control unit can control both the volume and balance  for 
a stereo signal and the volume and panning for two mono signals.


Figure IV.20


                          ___________
       Left input  ______ _ Mixing  _______ Left  output
       Right input ______ _ Control _______ Right output
                          _ Unit    _
                          ___________
                               _
                               _
       CDFM control ____________


* * * * * * * * EXTENSION * * * * * * * *

The mixing control in the audio mixing unit  (see Figure IV.17) has    the 
same capabilities  as  the  audio  mixing  control  unit  of  the    audio 
processing unit defined above.

* * * * * * * * * * * * * * * * * * * * *


IV.7  Extended Audio Playing Time


Longer playing  times can  be achieved  in two  ways.   The first  is   by 
playing the CD-I track  more than once with  a different channel    number 
selected for each scan.

For level  C  audio,  there  is  a maximum  of  16  concurrent    channels 
available.

Figure IV.21  is  an example  of  longer playing  time  with  this   first 
approach using level C audio.


Figure IV.21

_____________________________________________________________
_Channel  First logical     Time                Last logical_
_         sector          __________            sector      _
_____________________________________________________________
_   0     ______________________________________________    _
_                                                           _
_                                                           _
_   1     ______________________________________________    _
_   .                                                       _
_   .                                                       _
_   .                                                       _
_   .                                                       _
_                                                           _
_  13     ______________________________________________    _
_                                                           _
_                                                           _
_  14     ______________________________________________    _
_                                                           _
_                                                           _
_  15     ______________________________________________    _
_                                                           _
_____________________________________________________________
          ____ = Real-time playback

           ---- = Access of first logical sector of next channel


If the disc is replayed 16 times with 16 different channel numbers,   then 
the total  playing time  relative to  a CD-DA  play  time will    increase 
sixteenfold. A delay of a few seconds may be experienced between the   end 
of one channel  and the  beginning of a  new channel,  depending on    the 
length of the CD-I track.

The second way  of achieving  extended playing time  may be  achieved   by 
filling a  soundmap with  a 'non-real-time'  audio record  while   another 
previously filled soundmap is  used for playback in  real-time. When   the 
last soundmap is empty the next soundmap is used for playback and  another 
soundmap can be filled from the disc. In the case of level C the   filling 
rate is, at most, a factor of 16 times faster than the playback rate.   In 
this example the player  has to pause to  keep up with  the average   data 
rate. This method gives, for level (C) mono  a total playing time of    16 
times that for CD-DA without any delays.












