
5.6.5
Key-Click Functionality With Beep Generator
TSC2117
Low-Power Audio Codec With Embedded miniDSP, Stereo Class-D
Speaker Amplifier, and Smart Four-Wire Touch-Screen Controller
www.ti.com
SLAS550A – APRIL 2009 – REVISED JUNE 2009
A special algorithm has been included in the digital signal processing block for generating a digital
sine-wave signal that is sent to the DAC. This functionality is intended for generating key-click sounds for
user feedback. The sine-wave generator is very flexible (see
Table 5-35) and is completely register
programmable. Programming page 0/registers 71–79 (8 bits each) completely controls the functionality of
this generator and allows for differentiating sounds.
The two registers used for programming the 16-bit sine-wave coefficient are page 0/registers 76 and 77.
The two registers used for programming the 16-bit cosine-wave coefficient are page 0/registers 78 and 79.
This coefficient resolution allows virtually any frequency of sine wave in the audio band to be generated,
up to fS/2.
The three registers used to control the length of the sine-burst waveform are page 0/registers 73–75. The
resolution (bit) in the registers of the sine-burst length is one sample time, so this allows great control on
the overall time of the sine-burst waveform. This 24-bit length timer supports 16,777,215 sample times.
(For example, if fS is set at 48 kHz, and the register value equals 96,000d (01 7700h), then the sine burst
lasts exactly 2 seconds.) The default settings for the tone generator, based on using a sample rate of
48 kHz, are 1-kHz (approximately) sine wave, with a sine-burst length of five cycles (5 ms).
Table 5-35. Beep Generator Register Locations (Page 00h)
LEFT
RIGHT
BEEP LENGTH
SINE
COSINE
BEEP
MSB
MID
LSB
MSB
LSB
MSB
LSB
CONTROL
REGISTER
71
72
73
74
75
76
77
78
79
Table 5-36. Example Beep-Generator Settings for a 1000-Hz Tone
BEEP FREQUENCY
BEEP LENGTH
SINE
COSINE
SAMPLE RATE
MSB
MID
LSB
MSB
LSB
MSB
LSB
Hz
(hex)
1000(1)
0
EE
10
D8
7E
E3
48,000
(1)
These are the default settings.
Two registers are used to control the left sine-wave volume and the right sine-wave volume independently.
The 6-bit digital volume control used allows level control of 2 dB to –61 dB in 1-dB steps. The left-channel
volume is controlled by writing to page 0/register 71, bits D5–D0. The right-channel volume is controlled
by writing to page 0, register 72, bits D5–D0. A master volume control that controls the left and right
channels of the beep generator can be set up by writing to page 0/register 72, bits D7–D6. The default
volume control setting is 2 dB, which provides the maximum tone-generator output level.
For generating other tones, the three tone-generator coefficients can be found by running the following
script using MATLAB:
Sine = dec2hex(round(sin(2*pi*Fin/Fs)*2^15))
Cosine = dec2hex(round(cos(2*pi*Fin/Fs)*2^15))
Beep Length = dec2hex(floor(Fs*Cycle/Fin))
where,
fin = Beep frequency desired.
fS = Sample rate.
Cycle = Number of beep (sine wave) cycles that are needed.
dec2hex = Decimal to Hexadecimal conversion function.
NOTES:
1. fin should be less than fS/4.
2. For the sine and cosine values, if the number of bits is less than the full 16-bit value, then the unused
MSBs must be written as 0s.
APPLICATION INFORMATION
59