Docsity

Efficient Voice Coding: Sampling & Delta Modulation in Digital Voice Processing, Lab Reports of Electrical and Electronics Engineering

Toggle sidebar
bg1
1
Rensselaer Polytechnic Institute
ECSE-4760 Computer Applications Laboratory
DIGITAL VOICE PROCESSING EXPERIMENT
Number of Sessions – 4
INTRODUCTION
The idea of converting the human voice to a digital format traces back to the 1940's. One of the
original motivations was messa ge security. It was thought that the digitized form was so odd and the
equipment so expensive that eavesdroppers would pose little threat. Digital techniques were not to
appear in more practical ways until the integrated circuit era.
Today, digital voice processing is an attractive alternative to analog processing for many reasons.
1) The digital format allows long distance transmission through a chain of repeaters. The noise
introduced by such a chain increases much more slowly in a digital chain than in an analo g one.
Carrying telephone calls through light fibers, for instance, is difficult over any great distance
without digital transmission.
2) Digital processing and switching have steadily dropped in cost as the price of integrated circuits
has dropped. The filters and other circuits needed for analog transmission remain relatively
expensive.
3) Message security is much easier to maintain with digital transmission because it is easy to
encrypt bit streams. New services such as car telephones that use the open radio medium have a
particular need for this protection.
4) Different digital messages may be multiplexed onto a single transmission line and separated at
the receiving end without crosstalk between them. Voice, data, and video may easily be combined
on the same line.
The heart of a digital voice processor is a conversion of the analog signal from a microphone or
other input into digital format. Some processors convert the signal into fewer b its per analog sample
than others. If two systems both achieve the same quality of conversion, the one with the lower bit
rate is likely to be much more complicated and expensive. A practical design is a compromise
between quality, bit rate, and cost. The simplest voice converter is the simple PCM (Pulse Code
Modulation) scheme, w hich just maps the sample amplitude to a binary code (a 12 bit code in our
PC). The code is transmitted and reconverted to analog format at the receiver end.
The first part of the Digital Voice Processing experiment is a study of digital sampling. It shows
voice coding as an application of PCM A/D and D/A conversion and it explores some of the problems
that arise here. It is assumed that you have already performed the lab dealing with A/D and D/A
converters. Of interest is the time spent on conversion and the total time used by the computer
program, since these control the maximum rate of conversion which in turn sets an upper limit on
voice quality. The effect of coarse quantization is also studied.
The second part of the experiment explores the properties of the voice signal. The human voice
contains certain periodic and non-periodic segments that alternate and it has a definite peak-to-rms
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Efficient Voice Coding: Sampling & Delta Modulation in Digital Voice Processing and more Lab Reports Electrical and Electronics Engineering in PDF only on Docsity!

Rensselaer Polytechnic Institute

ECSE-4760 Computer Applications Laboratory

DIGITAL VOICE PROCESSING EXPERIMENT

Number of Sessions – 4

INTRODUCTION

The idea of converting the human voice to a digital format traces back to the 1940's. One of the

original motivations was message security. It was thought that the digitized form was so odd and the

equipment so expensive that eavesdroppers would pose little threat. Digital techniques were not to

appear in more practical ways until the integrated circuit era.

Today, digital voice processing is an attractive alternative to analog processing for many reasons.

  1. The digital format allows long distance transmission through a chain of repeaters. The noise

introduced by such a chain increases much more slowly in a digital chain than in an analog one.

Carrying telephone calls through light fibers, for instance, is difficult over any great distance

without digital transmission.

  1. Digital processing and switching have steadily dropped in cost as the price of integrated circuits

has dropped. The filters and other circuits needed for analog transmission remain relatively

expensive.

  1. Message security is much easier to maintain with digital transmission because it is easy to

encrypt bit streams. New services such as car telephones that use the open radio medium have a

particular need for this protection.

  1. Different digital messages may be multiplexed onto a single transmission line and separated at

the receiving end without crosstalk between them. Voice, data, and video may easily be combined

on the same line.

The heart of a digital voice processor is a conversion of the analog signal from a microphone or

other input into digital format. Some processors convert the signal into fewer bits per analog sample

than others. If two systems both achieve the same quality of conversion, the one with the lower bit

rate is likely to be much more complicated and expensive. A practical design is a compromise

between quality, bit rate, and cost. The simplest voice converter is the simple PCM (Pulse Code

Modulation) scheme, which just maps the sample amplitude to a binary code (a 12 bit code in our

PC). The code is transmitted and reconverted to analog format at the receiver end.

The first part of the Digital Voice Processing experiment is a study of digital sampling. It shows

voice coding as an application of PCM A/D and D/A conversion and it explores some of the problems

that arise here. It is assumed that you have already performed the lab dealing with A/D and D/A

converters. Of interest is the time spent on conversion and the total time used by the computer

program, since these control the maximum rate of conversion which in turn sets an upper limit on

voice quality. The effect of coarse quantization is also studied.

The second part of the experiment explores the properties of the voice signal. The human voice

contains certain periodic and non-periodic segments that alternate and it has a definite peak-to-rms

ratio (known as the crest factor). These and other properties may be used to design voice coders that

are more efficient than simple PCM.

The third part deals with one of these alternative voice coders called delta modulation. This

scheme digitizes the difference between successive voice samples, rather than the sample values

themselves. This approach requires fewer bits/second than PCM for the same voice quality.

PART I - DIGITAL SAMPLING

THEORY

Figure 1 shows the basic steps in the digital transmission of analog signals by PCM. You should

already be familiar with the operation of the A/D and D/A converters in the PC.

Sampler Medium Input Output

A/D D/A

FIGURE 1. Basic digital system, including a sampler, A/D converter, and D/A converter.

The output assumes that the D/A contains a sample and hold circuit.

Two factors affect the quality of the transmission in Figure 1:

  1. Discreteness in amplitude. The number of bits that describe each sample is called N. The lab

will demonstrate the effect of quantization on an intelligible signal.

  1. Discreteness in time. The rate at which the signal is sampled is R samples per second. R must

be greater than twice the maximum frequency component in the voice signal. Experience has

shown that an 8-bit resolution at a sampling rate of 8 kHz will encode good quality voice, a

quality similar to that of a good telephone call. It is assumed that the amplitude of the analog

voice is well matched to the A/D amplitude range. The overall bit rate here is

C = (8 bits) × (8 kHz) = 64000 bits/second

Lowering the number of bits/sample reduces the voice quality somewhat, and so does lowering

the sampling rate at the same bit resolution. Consequently, the overall bit rate, C, is a rough

measure of the coding quality. C also specifies the bit rate needed in the transmission medium. Thus

C is an important parameter in the voice system design.

People who design voice systems are interested in finding the lowest bit rate that gives

intelligible output. The cost of transmitting a digital signal through space (as with a telephone) or

through time (as with a compact disc) is proportional to the number of bits transmitted. There are

several approaches to bit rate reduction. One is to design a more sophisticated digitizer, that uses

the properties of speech to reduce the bit rate at a given voice quality level. A simple method that we

will explore is delta modulation, which takes advantage of the spectral nature of speech. Because

speech is low pass, each sample of it is close in amplitude to the next sample, and serves as a good

predictor of the sample. The delta modulator encodes only this small difference, instead of the large

sample amplitude. There are other voice coding methods that take advantage of the predictability of

the speech signal, notably a method called differential PCM, or DPCM. DPCM is much more efficient

than delta modulation, but it is beyond our scope.

f max

V(f)

-R +R

Aliasing: R< 2f

max

V(f)

f max

-R +R

No Aliasing: R> 2f

max

FIGURE 4. The aliasing phenomenon, shown in the frequency domain. R is the sampling

rate in Hz.

Another kind of distortion will occur when a non-ideal low pass filter is used and parts of the

spectral replicas appear at the filter output. This kind of distortion is called reconstruction error.

You may hear it during the experiments as a tingling sound above the voice signal in frequency. If

you encounter aliasing, it will lie within the voice bandwidth and have a more sour sound (because it

is non-harmonic).

EXPERIMENTAL PROCEDURE

The object of this part is for you to try out a variety of overall bit rates and find a minimal rate

that allows intelligible reconstruction of a voice. Different combinations of sampling rates and PCM

resolution bits should be tried at the same overall bit rate in order to find a good combination. A

Nyquist rate appropriate to your voice input should also be tried.

Figure 5 shows the setup for this experiment. A microphone is the voice source. A small preamp

boosts the signal to sufficient amplitude (10 V peak) to feed a 16-bit A/D converter. The DSP CODEC

input spans the range – 1.3 V to +1.3V, providing an LSB accuracy of 0.0397 mV. A 16-bit D/A

converter produces an analog signal in the same voltage range. After passing through a low pass

filter (abbreviated LPF), the signal ready for subsequent playback. An oscilloscope monitors this

output signal.

Background:

This program simulates two methods for recording and playing back audio signals in a digital

format. The first method is basic storing of sampled data values and playback. The mode of sampling

can be represented with 1 bit per sample (the coarsest, but most compact) to 16 bits per sample (the

finest (smoothest) but least compact). The second method is delta modulation, which records the

changes between adjacent values. Depending on the delta response, it can use 1, 2, or 3 bits per

sample. The coarseness is determined by the minimum step size of the response. For Part II - Voice

Signal Characteristics portion of the lab, follow the procedures on Page 9. For this part and Part III -

Delta Modulation portion follow these steps.

Equipment:

  • DSP56303EVM and 12V power supply
  • Headphones, Microphone and Preamp
  • BNC to Banana cables, audio cables, BNC – alligator cables or BNC –

1

8

” stereo mini plug

  • Oscilloscope and Function generator
  • PC or Sun workstation with PC card
  • RS 232 9 pin cables – available in the studio if not already attached to the PC

FIGURE 5. The experimental setup.

Equipment Setup:

  1. Connect the RS232 COM1 port on the PC to the EVM DB9 port P2 ( DEBUG ) and the RS

COM2 port (or COM5 from the SUN PC USB/RS232 converter) to the EVM DB9 port P.

  1. Attach the function generator output to channel 1 of scope and to bottom (left) audio-in port ( P

LINE IN ) on the EVM using a BNC-

1

8

” stereo mini plug cable or BNC-alligator and audio cables.

Alternatively, this signal may instead come from the speaker out port on the computer’s

soundcard or the microphone preamplifier. Note: on the

1

8

” stereo mini plug, the sleeve is ground,

the tip is positive-right channel and the ring is positive-left channel.

  1. With another BNC-mini plug cable or audio cable and a BNC-alligator, connect the output top

(right) audio port ( P6 LINE OUT ) on the EVM to channel 2 of the scope.

conversion on the input signal, masking the low order bits to force the value into the required

number of bits, then sending it back out through the D/A converter. Resolutions of 1 to 16 bits can be

accomplished. By pressing 1 through 9 and a through g in the ProComm Plus window, the resolution

will be changed, 1 - 9 corresponding to 1 - 9 and a - g to 10 - 16.

The amount of memory required to hold one second of a sound sample using this algorithm is

calculated by multiplying the resolution (in bits) by the sampling rate in kHz. This gives a result in

kilobits per second. Divide this result by 8 to get kbytes/sec.

There are three adjustable parameters used by this program. They are the sampling frequency

(48 kHz maximum), the number of bits (16 bits maximum) to be used by the A/D and D/A converters,

and the mode of operation: basic sampling or delta modulation. The default values are 48 kHz and 8

bits. Type go start in to execute the loaded program (VOICEDLT.CLD).

The basic mode is used in all steps 1 through 7 below and the delta modulator is used in Part III.

When executing, data is passed through the A/D converter, with the parameters specified, and is

subsequently passed through the D/A converter. The status line s - 8 - 48/1 appears on the

terminal. This line tells you the current sample rate and bit resolution. The s identifies the mode of

operation. The last fraction (decimal 48/1) is the sample frequency. The last digit (1) is the divide-by

value for the sample rate. The signal was originally sampled at 48,000 samples per second. To get

the output sample rate, divide 48,000 by the number that appears. The default value of 1 yields an

output rate of 48,000 samples per second.

To change the output sample rate, type the corresponding keyboard character d where d is the

divide-by ratio in decimal. The following table shows the correspondence between d and the sample

frequency.

Keystroke {with } d Sample frequency

1 {!} 1 48,000 Hz

2 {@} 2 24,000 Hz

3 {#} 3 16,000 Hz

4 {$} 4 12,000 Hz

5 {%} 5 9,600 Hz

6 {^} 6 8,000 Hz

7 {&} 7 6,857 Hz

8 (*) 8 6,000 Hz

9 ( ( ) 9 5,333 Hz

A 10 4,800 Hz

B 16 3,000 Hz

C 24 2,000 Hz

D 32 1,500 Hz

The value $FFFF00 is the hexadecimal bit mask. Each hex digit represents 4 bits of precision. To

change the output bit resolution, type the corresponding keyboard character. The following table

shows the correspondence between the keystroke and the number of bits of resolution.

Keystroke hhhhhh Resolution Delta modulator Step size

g ffff00 16 bits (Do not use)

f fffe00 15 bits 1.13 V

e fffc00 14 bits 0.56 V

d fff800 13 bits 0.28 V

c fff000 12 bits 0.14 V

b ffe000 11 bits 75.0 mV

a ffc000 10 bits 40.7 mV

9 ff8000 9 bits 20.3 mV

8 ff0000 8 bits 10.2 mV

7 fe0000 7 bits 5.08 mV

6 fc0000 6 bits 2.54 mV

5 f80000 5 bits 1.27 mV

4 f00000 4 bits 0.635 mV

3 e00000 3 bits 0.317 mV

2 c00000 2 bits 0.159 mV

1 800000 1 bits 0.0794 mV

0 000000 0 bits (Do not use)

The program will sample the voice signal picked up by the microphone, signal generator, or the

PC’s line out audio signal. This will start when the command go start is entered. You will hear your

voice echoed in the headphones during the sampling. Ideally, the program would be able to record

about 5 seconds of audio at maximum resolution and then permit repeated playing back of the clip

using different sample frequencies and bit resolution allowing qualitative comparison to a fixed

standard signal. For now the best work-around is using an audio clip (preferably just plain talking)

off a CD as an input signal that can be replayed over and over. If you have problems, use the

command quit to exit out of the program and start over at the DOS prompt.

A suggested step-by-step procedure is as follows:

  1. Set the sampling frequency to the maximum value. Using all 16 bits of resolution, connect a sine

generator to the A/D converter. (Do not exceed the voltage range of ±1.3 Volts of the A/D

converter). Set the cutoff of the LPF to 3 kHz.

  1. Run the program, and observe the output of the LPF on the oscilloscope as the input signal

frequency is varied from 0 to 5 kHz. Note the relative phase of the input to output. Provide an

explanation.

  1. Repeat the above using different bit resolutions. Note that it is not possible to remove bits out of

sequence as was possible in the Introductory experiment.

  1. Vary the cutoff of the LPF, and observe any changes in the output signal.
  2. Remove the sine generator and connect the microphone-preamplifier combination to the A/D

converter. Now repeat steps 2., 3., and 4. while observing the voice waveform on the oscilloscope

directly. The same sentence may be used repeatedly while the sample frequency and bit

resolution are changed.

  1. Determine the lowest number of bits that give intelligible transmission of voice at several

sampling frequencies.

  1. (Optional) A portable CD, cassette player, or the PC’s CD drive may be used as an alternative

sound source to observe the quantization and sampling effects on music.

PART II – VOICE SIGNAL CHARACTERISTICS

THEORY

Speech is a sequence of different sounds, the alternation of which carries intelligence. There are

some 75 of these basic sounds, called phonemes , in human speech. A language like English uses most

but not all of this list. Spoken phonemes last from 40 ms to perhaps 400 ms, after which a new

phoneme begins. Some phonemes are really continuous transitions from one sound to another, and in

switching from one phoneme to another, the human vocal apparatus slides to the next phoneme in a

continuous manner. For these reasons, human speech sound can change as rapidly as every 10 ms.

The human vocal apparatus consists of the vocal cords (in the trachea), the mouth, and the nose.

Sound begins, or is excited in the trachea, and is shaped and modified in the mouth and nose

cavities. Phonemes are broadly divided into two classes, voiced and unvoiced phonemes. A voiced

speech sound is one for which the excitation is in the vibrating vocal cords. Examples of voiced

sounds are the vowel sounds. The excitation of all the vowels is the same, namely the vocal cords;

which vowel is produced depends on spectral filtering by the nose and mouth. Many consonants are

voiced as well; an example is the ‘z’ sound in ‘ zinc’. On a plot of a voice signal v(t), you can recognize

voiced sounds by their periodic nature. They are periodic because their excitation is periodic.

NOTE: The files may be too large to be read into PC-MATLAB directly. They have been

segmented into files with 2000 words each, and may be read into MATLAB using the load filename

command. There are 8 files corresponding to each sentence, indexed a through h. For example,

samp.one is broken up into files file1a.dat , file1b.dat , … file1h.dat. All files, the original

complete sentences, as well as the segments, are on the development PC, in the directory

C:\CAL_LAB\SPEECH and on the RCS file system in /afs/rpi.edu/dept/ecse/cal/speech. To load

a file on the RCS workstations, you may need to use the full pathname, e.g. load

/dept/ecse/cal/speech/samp1.dat. Use plot(samp1(1:500)) to only display the first 500 points of

the vector. Any portion of the vector may be displayed this way.

Now you can manipulate and analyze the waveform with different MATLAB functions. A

suggested procedure is as follows:

1 Determine what parts of the files are voiced or unvoiced. If they are voiced, measure the pitch

period. (Typical pitch periods are 5-10 ms).

2 Find the peak-to-rms ratio for the waveforms. Compare what you find to the peak-to-rms ratio

for a simple waveform like a sine wave. (Speech ratios can be very high, as large as 10; however,

speech peaks may be truncated without much audible distortion).

3 Try to identify consonants as opposed to vowels in your waveforms. Trace any changes in the

short-term average energy of the consonants.

4 Determine the Fourier transform of some sections of the speech waveform, using the fft function

in MATLAB. Transforms of voiced segments should show a line spectrum, at least roughly.

Example Calculations:

Sample period =

!

1

8 kHz

= 0.125 ms; Signal Period = 60 samples; Pitch Period = 60×0.125 ms = 7.5 ms.

Signal Period can be found when you zoom into a MATLAB plot of a sample – samp1. The distance

between the peaks will be the signal period – usually between 50 and 75 depending on the words.

Average peak-to-rms ratio for say samples between 8000 and 10000 – MATLAB code

load sample1.dat

y=abs(sample1(8000:10000));

rms=sqrt((sample1(8000:10000)*sample1(8000:10000)’)/size(sample1(8000:10000),2));

crestfact=max(y)/rms;

You may substitute the average of a few peaks in the range instead of the single highest peak max(y)

FFT – MATLAB code

z=sample1(8000:10000);

f=fft(z);

r=real(fft(z));

i=imag(fft(z));

subplot(2,1,1), plot(r), subplot(2,1,2), plot(i); plot(abs(f));

PART III – DELTA MODULATION

THEORY

Because of the low pass spectral nature of speech, the difference between successive samples is

small compared to the signal's peak amplitude. It is therefore more economical to digitize the

difference between successive samples, rather than their amplitudes. Because the difference is much

smaller than the amplitudes, fewer bits are needed for a given size of quantization error. At the

receiving end, each difference is added to the previous output to form the new, updated output value.

The third part of the voice processing lab will study the simplest of the differential voice digitizers,

the delta modulator.

Before looking into delta modulation, let us summarize what we have learned about the different

kinds of voice digitizers. Simple PCM is the simplest digitizer and it produces the highest overall

output bit rate; it requires perhaps 40 to 60 kb/sec for good quality voice. Schemes that use the

differential idea need 16 to 40 kb/sec for the same quality, depending on how subtly they make use of

the correlation among the speech samples. Really low rate speech digitizers must obtain and use the

speech sound parameters that we discussed in the previous section. These schemes range in rate

down to 1 kb/sec, although their voice quality is not very good below 4 kb/sec.

Delta modulation is the simplest of the differential schemes. It is illustrated in Figure 7. An

input analog sample is compared to the sum of all the previous incremental steps, which have been

accumulated in the box labeled “ADD”. In the most basic delta modulator, the difference between the

sample and the sum is 1-bit quantized. If the difference is positive, the quantizer henceforth

represents it as +V and the digital output is ‘1’; otherwise, the representation is - V and the output is

‘0’. In effect, the quantizer extracts the sign of the difference. Successive values of +V and - V

accumulate in the “ADD” box.

The delta modulation receiver is simply an “ADD” box that accumulates the +V and - V steps.

Each channel bit either increments or decrements this box. The approximation to the analog signal

is a series of up and down stairsteps.

Figure 8 shows the signal approximation when the input is a step function. At first the delta

modulation output climbs up a flight of stairs. Note that in the steady state the output oscillates in a

limit cycle about the desired value. This is because the 1-bit quantizer never gives a zero output, and

the modulator output must increase or decrease each time. If this oscillation were large (i.e., the

increment size is too large) the output would be a poor representation of the input. This puts a limit

on how large the increment size may be. On the other hand, if the increment is too small, the

approximation will be slow to follow the step change. Voice engineers call this a slope overload. The

best increment size V must be the result of a tradeoff between slope overload noise and quantization

noise from the coarseness of the steps.

Transmission

Medium

Input

!

+v

-v

1-bit Quantizer

ADD

Synch

ADD

Synch

X

Output

FIGURE 7. A block diagram of a delta modulator. The "output" and the signal at "X" will

be the same in the absence of errors in the medium

Figure 9 shows the circuit operation for a sine wave input. An important thing to note is that

when the sinusoid reaches its maximum slope, the approximation has the most trouble keeping up.

The maximum rate at which the output may change is V/T, where T is the time between samples.

For the output to follow the analog input accurately, V/T must be comparable to the maximum slope

of the sine wave. To make this happen, we may increase V or decrease T.

An extension of the delta modulator idea is the 2-bit (or 4 level) modulator shown in Figure 10. It

is the same as the 1-bit scheme except for the 2-bit quantizer and the arrangement of the binary

output into pairs of bits. The 2-bit quantizer is defined by the three parameters A, B and D. Convince

yourself that the two implementations in the figure are equivalent.

Another attractive alternative to this concept is illustrated in Figure 11 and is referred to as

asynchronous delta modulation. The input signal is quantized into discrete levels. Whenever the

input passes from one level to another, a pulse is transmitted. The sign of the pulse indicates

whether there was an upward level transition or downward transition. Although the transmission

rate is higher than the Nyquist rate, it has the advantage of using only a three state pulse (+, - , 0).

Note that the control has its maximum number of changes when the signal has maximum slope, and

fewest changes when the signal is flat. However, normal synchronous delta modulation lends itself

more easily to digital methods and will be the only mode studied in this experiment.

EXPERIMENTAL PROCEDURE

The setup for this part of the lab is the same as the one in Figure 5. The delta modulator

performance will be explored by processing voice and a function generator waveform in the 0-24 kHz

range. The modulator is a short program in the DSP. To use it, run EVM30xW under Programs in

the Start menu. The variables are the sampling frequency and A, B, C and D which define the 1- or

2 - bit quantizer. (see Figure 12). To what must A, B, C and D be set to create a 1-bit quantizer with

outputs +V and - V? As before, the program uses keystrokes to change parameters in the program on

the Motorola 56303.

q(kT)

A

-A

+B

-B

-D

+D

e(kT)

!

+A

-A

! ADD

s(kT) q(kT) s(kT)

^

+D

-D

B-A

A-B

e(kT)

FIGURE 10. A block diagram of a 2-bit delta modulator. The two quantizer boxes above

may be replaced by the single quantizer characteristic below. The upper of the two boxes

above is a deadband quantizer.

    1. 2 0
    1. 0 0
    1. 8 0
    1. 6 0
    1. 4 0
    1. 2 0

Input

Voltage

Output

Pulses

FIGURE 11. Asynchronous delta modulation.

-C

q(kT)

Vout

A

-A

+B

-B

+C

e(kT)

Vin

-D

+D

C=D=

A=

B=.

C=D=.

A=

B=.

Four-Level Delta Modulator with Deadband

B D < Vin

A C < Vin! D

0 -C < Vin! C

-A -D < Vin! -C

-B Vin! -D

Vout =

!

"

C=

D=.

A=.

B=.

FIGURE 12. The general input/output characteristics for a two-bit (four-level) delta

modulator with deadband and possible implementations of simpler modulators.

  1. Start with delta mode D0, choose several sampling frequencies for observing details on input and

output signals, capture these pictures, and mark sample period and step size. Are they true to

what you might expect? Explain.

  1. Keep the mode the same but vary the step size and frequency. Observe and note the results.
  2. Do the same for D1, D2 and D3 modes.
  3. Obtain the settings for the best approximation of the input signal, i.e. what step size and

sampling frequency outputs the best representation of the input signal.

Using the Program:

Once the program is running (following the steps on pages 6 and 7), the mode, sampling rate,

and resolution/step size are changed as follows.

Mode : Press the M key to cycle through the 6 modes - Basic Sampling (S), Delta 0 (D0), Delta 1

(D1), Delta 2 (D2), Delta 3 (D3), Delta 4 (D4).

Sampling Rate : Hold down the **** key and press 1 – 9 or A - D for sample frequencies of

48 kHz to 1.5 kHz. Refer to the table on page 7.

Resolution/stepsize : Press 1 – 9 or a – g for 1 – 9 bits and 10 – 16 bits.

The values of the A, B, C and D parameters may be adjusted by following instructions on the

terminal if they are adjustable. The selected mode will determine which parameters are relevant and

available for adjustment and the current version of the software will explain what can be done. For

modes D0 – D3 the step size is B as shown in Figure 13. For D1, D = B/2 as in Figure 13b. For D2, D

= 9B/14, C = 3B/14 and A = 2B/7 as in Figure 13c.

Again, ideally the program would be able to record about 5 seconds of audio at maximum

resolution and then permit repeated playing back of the clip using different sample frequencies, step

sizes and deadband thresholds, allowing qualitative comparison to a fixed standard signal. As before,

use an audio clip (preferably just plain talking initially) off a CD as an input signal that can be

replayed over and over. Once the program is started, it runs continuously, sampling the input signal

and reconstructing the output based on the current mode and parameter settings.

B

B

D

B

C D

A

a. Delta 0 b. Delta 1 c. Delta 2 d. Delta 3

FIGURE 13. Three Delta Modulator voltage input/output functions.

KNOWN ISSUES: Using 16 bits for the step size in the delta modulators should be avoided since it

does not work correctly in all modes. In general the larger step sizes are less than what the formula

predicts due to slew rate and other hardware limitations. Occasionally the reconstruction will jump

up and down on the y-axis and produce smaller steps than should be allowed. This can usually be

fixed by choosing a different value for the step size and then going back to the original value,

repeating if necessary.

Here is a suggested procedure:

  1. 1 - bit delta modulation

a) Set up the 1-bit quantizer and verify that it works properly by observing the output on the

oscilloscope for triangle and square wave inputs (1.25 volt amplitude; 2.5 volt p-p). Verify the

B

sampling rate and the increment size V and explain how you did this. This signal should bypass

the amplifier and LPF and go directly to the DSP input.

b) Vary the input sinusoid frequency from 0 to 24 kHz for several increment sizes and note the

effect on the output. Find the highest frequency that the modulator will track for each increment

size. Compare the ratio V/T to the theoretical maximum slope of this sine wave. Make sketches

at several frequencies and discuss what is occurring.

  1. The deadband modulator

In this variation, the quantizer puts out the three level output (-V, 0, +V) instead of - V and +V.

a) Set up this scheme and try it out on a sine wave. Note that there is a second parameter hidden in

the definition, namely the width of the quantizer input range over which the output is 0; this is

the deadband.

b) What are the advantages and disadvantages of the deadband modulator?

  1. 2 - bit delta modulation (with deadband)

a) Set up the 2-bit quantizer configuration and verify the sampling rate and the quantizer input-

output characteristic.

b) Find and record sets of parameters A, B, C and D (set B and determine the corresponding values

of A, C & D) that give the best reconstruction of sinusoids of 50 Hz, 100 Hz and 200 Hz at input

levels 0.3 and 1.2 Volts. Explain the effect on the output of changing one parameter while

holding the others constant, in varying degrees and combinations. Explain any oscillations that

you observe at the peaks of the waveforms.

  1. Compare the advantages and disadvantages of 1-bit versus 2-bit delta modulators. Compare

delta modulation to straight PCM at the same overall bit rate. In comparing these three, think

about which has the highest audio quality and which is the simplest to implement.

  1. Assume that a signal sample is random and is equally likely to fall anywhere in the ±10 Volt

range. Derive the relationship between the quantization noise and the bits per sample in a

simple PCM digitizer.

APPENDIX

Signal Sources on the Suns and Sun PCs

The workstations can be used as signal sources for this lab. The CD drives can be used with audio

CDs to generate voice & music signals and the NCH Tone Generator program under Start →

Programs → Tone Generator can be used to create sine, square, triangle, sawtooth, impulse, and

white noise signals.

Sun Audio Jacks Sun PC card Audio Jacks

Microphone purple Ω Microphone red Ω

Headphones black ⊃ Headphones black ⊃

Line-in black ← Line-in purple ←

Line-out pink → Line-out green →