User Manual
VS1003
9 OPERATION
9.4 ADPCM Recording
This chapter explains how to create RIFF/WAV file with IMA ADPCM format. This is a widely
supported ADPCM format and many PC audio playback programs can play it. IMA ADPCM
recording gives roughly a compression ratio of 4:1 compared to linear, 16-bit audio. This makes
it possible to record 8 kHz audio at 32.44 kbit/s.
9.4.1 Activating ADPCM mode
IMA ADPCM recording mode is activated by setting bits SM_RESET and SM_ADPCM in
SCI_MODE. Optionally a high-pass-filter can be enabled for 8 kHz sample rate by also set-
ting SM_ADPCM_HP at the same time. Line input is used instead of mic if SM_LINE_IN is set.
Before activating ADPCM recording, user must write a clock divider value to SCI_AICTRL0
and gain to SCI_AICTRL1.
The differences of using SM_ADPCM_HP are presented in figure 17 (page 30). As a general
rule, audio will be fuller and closer to original if SM_ADPCM_HP is not used. However, speech
may be more intelligible with the high-pass filter active. Use the filter only with 8 kHz sample
rate.
Before activating ADPCM recording, user should write a clock divider value to SCI_AICTRL0.
The sampling frequency is calculated from the following formula: f
s
=
F
c
256×d
, where F
c
is the
internal clock (CLKI) and d is the divider value in SCI_AICTRL0. The lowest valid value for d is
4. If SCI_AICTRL0 contains 0, the default divider value 12 is used.
Examples:
F
c
= 2.0 × 12.288 MHz, d = 12. Now f
s
=
2.0×12288000
256×12
= 8000 Hz.
F
c
= 2.5 × 14.745 MHz, d = 18. Now f
s
=
2.5×14745000
256×18
= 8000 Hz.
F
c
= 2.5 × 13 MHz, d = 16. Now f
s
=
2.5×13000000
256×16
= 7935 Hz.
Also, before activating ADPCM mode, the user has to set linear recording gain control to register
SCI_AICTRL1. 1024 is equal to digital gain 1, 512 is equal to digital gain 0.5 and so on. If the
user wants to use automatic gain control (AGC), SCI_AICTRL1 should be set to 0. Typical
speech applications usually are better off using AGC, as this takes care of relatively uniform
speech loudness in recordings.
Since VS1033c SCI_AICTRL2 controls the maximum AGC gain. If SCI_AICTRL2 is zero, the
maximum gain is 65535 (64×), i.e. whole range is used. This is compatible with previous
operation.
9.4.2 Reading IMA ADPCM Data
After IMA ADPCM recording has been activated, registers SCI_HDAT0 and SCI_HDAT1 have
new functions.
The IMA ADPCM sample buffer is 1024 16-bit words. The fill status of the buffer can be read
from SCI_HDAT1. If SCI_HDAT1 is greater than 0, you can read as many 16-bit words from
SCI_HDAT0. If the data is not read fast enough, the buffer overflows and returns to empty state.
Version: 1.08, 2014-12-19 38