ITALIANO OTRAS
NIVEL 2: Conflictos, desarrollo sostenible y medio ambiente 5.5.1.1 Datos Básicos del Nivel 2
Figure 7.2 shows a block diagram of the entire software architecture for the single-channel (mono) case running on Microsoft Windows OS. This system primarily consists of three components: the audio module, the echo cancellation module, and the network module. An overview of these modules follows.
2.1 THE AUDIO MODULE
The audio module is an interface between our software and the Windows DirectX interface [8]. DirectX provides a general interface between the Win-dows OS and different sound card drivers. The WinWin-dows DirectX interface is relatively well defined and stable. However, a significant concern is the so-called device driver between this interface and the actual sound card hardware.
This driver is designed by the manufacturer of the sound card hardware and it is difficult to predict how it interacts with the Windows OS.
sequences of, and solutions to, these problems are shown in the following.
2.1.1 Stream synchronization problem caused by OS sample-rate con-version. On a multitasking OS, more than one application can generate sound at a time. Thus, the OS must mix the different audio streams together. Since the streams can only be mixed if they have a common sample rate, it is nec-essary to apply sample-rate conversion. To avoid loss of sound quality, the common sample rate is chosen to be the highest sample rate of the different sound streams.
The problem for the sound card driver software, which realizes the sample-rate conversion, is that it is usually restricted to the use of certain block sizes. To implement an exact conversion between two sample rates, it is often necessary to change the input or output block sizes with time, e.g., when converting from 44.1 kHz to our sample rate of 16 kHz is necessary. To simplify the implementation, some manufacturers tend to omit or insert samples to keep the block sizes constant. In this case synchronization between input and output streams suffers from a constant phase drift, or jitter, which results in poor echo cancellation.
The best way to resolve this problem is to take complete control over sample-rate conversion by performing it at the application layer. To make sure the driver does not modify the signal, the application up-samples to the highest sample rate offered by the sound card. As such, no other sample rate can be chosen by the OS without incurring loss of audio quality, and the sound card does not need to apply sample-rate conversion to play and record the streams.
2.1.2 Synchronization failure following temporary bursts of CPU uti-lization. The general flowchart of a block-oriented, full-duplex audio appli-cation consists of three boxes: a sound card read box, which queries the audio data from the sound interface; a signal processing box where echo cancellation is done; and a third box that writes the processed data to the sound interface. The first box usually holds the data flow until a new input data block is captured by the sound card. To be sure that the application runs stable even at nearly 100%
CPU usage, the minimum audio latency must not be shorter than the duration of one data block. Therefore, the third box writes the processed data exactly one block further than the play position at the time a new block is read by the sound-in box. Unfortunately, if the operating system reaches the CPU limit, the difference between read and write position in the buffers changes abruptly and
stays steady at a new value. This phenomenon occurs on many sound cards. To combat this situation, a precise measurement of the current read and write posi-tion must be available to correct the synchronizaposi-tion failure. Unfortunately, the buffer read and write positions reported by the sound interface are inaccurate.
In this implementation, the positions are queried often during regular operation and averaged to reduce the variance of the measurement when a failure happens.
2.2 THE NETWORK MODULE
The network module controls the data transfer between the two connected clients. Its main tasks are buffering the different network-side audio streams and compressing (audio/speech coding) the audio data, if desired.
To keep the actual network interface as simple as possible and to avoid excessive overhead due to additional headers, the Windows Socket interface is used to transmit the data through the network as a user datagram protocol (UDP) packet. This interface deals with all protocol tasks and requires only a port number and the IP address of the receiving client. At the receiving client the different audio modes (sample rate, compression mode) are distinguished by the block size of the incoming data. To detect missing or repeated packets, a modulo 256 counter is added at the beginning of the actual audio data and is incremented each time a new packet is sent.
The socket buffer is basically a FIFO (first in, first out) buffer which acts as a cache between the clients. It deals with three tasks: synchronization of data blocks, adjustment to different block sizes, and correcting for buffer underflow because of network problems. The latter two points are effects of the network and cannot be predicted whereas the first one is caused by the client itself. Since two clients are in general not synchronized, there is a small offset between the sample rates of the sound cards. As a result, one client transmits more packets in a certain time period than the other which results in a permanent drift in the FIFO buffer causing over- or under-runs. In this implementation, we simply detect these errors in the buffer and delete extra packets or insert packets filled with zeros to clear or refill the buffer. It is clear that these corrections will introduce audible effects, but if the buffer length is relative long and the sample rate offset is not too high, corrections are rarely necessary. On the other hand, enlarging the buffer will raise the overall audio latency of the connection. Therefore, the buffer size presents a trade-off between audio latency and immunity against synchronization problems. A more sophisticated solution would be to apply sample-rate correction to the incoming audio stream. In this case, however, the sample-rate offset must be estimated and the sample-rate conversion algorithm must be capable of converting to arbitrary sample rates.
The core echo canceler consists of a robust two-channel frequency-domain adaptive algorithm, a pseudo-coherence-based double-talk detector, and a resid-ual echo suppression unit. The choice of this solution is based on the need for a low-complexity algorithm, as compared to a time-domain solution, as well as the need to handle the problem of slow convergence in the two-channel case. This could be achieved with a subband solution as in [10], however, a more complicated adaptive algorithm (fast recursive least squares) would be required. The frequency-domain solution has been shown to provide a rea-sonable trade-off between complexity and performance [11, 5]. The specific problem of stereophonic echo cancellation, i.e., the nonuniqueness problem, is handled by nonlinear distortion as described in [12]. Details regarding the The suppression algorithm attenuates the residual echo
adaptive algorithm and double-talk detector are presented in the next sections.
(Fig. 7.1) depend-ing on the actual amount of echo cancellation. The adaptation of the attenuation is based on voice activity detection decisions and an echo-return-loss measure-ment. All the measurements are based on the envelopes of the speech signals and the noise.
If the dynamic range of the received signal is near full range, unmodeled nonlinearities in the echo path will likely be excited. Therefore, compression of the incoming far-end signal’s amplitude is done.
Since the analog input signal for the sound card must be amplified with analog circuits prior to analog-to-digital (A/D) conversion, it is most likely that the captured signal carries an unwanted DC component. This DC offset can lead to performance degradation or even to instability of the adaptive algorithm and must therefore be removed with a high-pass filter.