Handbook for Sound Engineers

(Wang) #1
DSP Technology 1177

cally processes an input stream of data to produce some
output data. The processing of this data is performed
under the direction of the application program, which
usually includes one or more algorithms programmed
on the DSP. The DSP application program consists of
acquiring the input stream data, using the algorithms to
process the data, and then outputting the processed data
to the output data stream. An example of this is a speech
data compression system where the input stream is a
data stream representing uncompressed speech. The
output stream, in this case, is the compressed speech
data and the application consists of getting the uncom-
pressed input speech data, compressing the data, and
then sending the compressed data to the output stream.


One of the most important factors that a DSP I/O
system must address is the idea of real-time. An
extremely important aspect of these real time A/D and
D/A systems is that the samples must be produced and
consumed at a fixed rate in order for the system to work
in real-time. Although an A/D or D/A converter is a
common example of a real-time device, other devices not
directly related to real-time data acquisition can also
have real time constraints. This is particularly true if they
are being used to supply, collect, or transfer real-time
information from devices such as disk drives and inter-
processor communication links. In the speech compres-
sion example, the output stream might be connected to a
modem that would transmit the compressed speech to
another DSP system that would uncompress the speech.
The I/O system should be designed to interface to these
devices (or any other) as well.


Another important aspect of a real-time I/O system is
the amount of delay imposed from input to output. For
instance, when DSPs are used for in-room reinforce-
ment or two-way speech communication (i.e., telecom-
munications), the delay must be minimized. If the DSP
system causes a noticeable delay, the conversation
would be awkward and the system would be considered
unacceptable. Therefore, the DSP I/O system should be
capable of minimizing I/O delay to a reasonable value.


Programming a DSP is usually accomplished in a
combination of C and assembly languages. The C code
provides a portable implementation that can potentially
be run on multiple different platforms. Assembly
language allows for a more computationally efficient
implementation at the expense of increased develop-
ment time and decreased portability. By starting in C,
the developer can incrementally optimize the imple-
mentation by benchmarking which subroutines are
taking the most time, optimizing these routines, and
then finding the next subroutine to optimize.


The typical C code shell for implementing a DSP
algorithm is shown in Fig. 31-18. Here, the C code allo-
cates some buffer memory to store signal data, opens an
I/O signal stream, and then gets data, processes the data,
and then sends the data to the output stream. The input
and output streams typically have lower level device
drivers for talking directly to the A/D and D/A
converters, respectively.

31.10 Conclusion

This chapter has introduced the fundamentals of DSP
from a theoretical perspective (signal and system the-
ory), and a practical perspective. The concepts of
real-time systems, data acquisition, and digital signal
processors have been introduced. DSP is a large and
encompassing subject and the interested reader is
encouraged to learn more through the exhaustive treat-
ment given to this material in the references.1,2

#include <stdio.h>
#include <aspi_io.h>
#include <malloc.h>
#define LEN 800
void main(argc,argp)
char **argp;
int argc;
{
SIG_Stream input, output;
SIG_Attrs sig_attrs;
BUF_Buffer buffer;
buffer = BUF_create(SEG_DRAM,LEN,0);
input = SIG_open(argp[1],SIG_READ,buffer,0);
SIG_getattrs(input,&sig_attrs);
output =
SIG_open(argp[2],SIG_WRITE,buffer,&sig_attrs);
while (SIG_get(input,buffer))
{
/* data processing of buffer */
my_DSP_algorithm(buffer);
SIG_put(output,buffer);
}
return(0);
}

Figure 31-18. An example C program for collecting data
from an A/D using an input signal stream created with
SIG_open and sending data to the D/A using the output
signal stream and processing the data with the function
my_DSP_algorithm().
Free download pdf